anvilui 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +483 -0
- package/README.md +60 -40
- package/bin/anvilui.mjs +83 -0
- package/dist/colors/colors.d.ts +10 -2
- package/dist/components/Accordion/Accordion.d.ts +36 -0
- package/dist/components/AnimatedNumber/AnimatedNumber.d.ts +17 -0
- package/dist/components/AnvilRoot/AnvilContext.d.ts +22 -2
- package/dist/components/AnvilRoot/AnvilRoot.d.ts +44 -6
- package/dist/components/AppBar/AppBar.d.ts +13 -2
- package/dist/components/Avatar/Avatar.d.ts +6 -2
- package/dist/components/Avatar/AvatarGroupContext.d.ts +1 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +25 -0
- package/dist/components/Badge/Badge.d.ts +4 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +22 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Calendar/Calendar.d.ts +19 -0
- package/dist/components/Card/Card.d.ts +36 -0
- package/dist/components/Carousel/Carousel.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Chip/Chip.d.ts +25 -2
- package/dist/components/Combobox/Combobox.d.ts +48 -0
- package/dist/components/Confetti/Confetti.d.ts +31 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
- package/dist/components/DateInput/DateInput.d.ts +39 -0
- package/dist/components/Dialog/Dialog.d.ts +32 -0
- package/dist/components/Divider/Divider.d.ts +8 -0
- package/dist/components/FAB/FAB.d.ts +4 -0
- package/dist/components/FAB/magnet.d.ts +2 -0
- package/dist/components/FABMenu/FABMenu.d.ts +55 -0
- package/dist/components/Field/Field.d.ts +20 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +15 -0
- package/dist/components/HoldButton/HoldButton.d.ts +4 -1
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/IconButton/IconButton.d.ts +14 -1
- package/dist/components/Input/Input.d.ts +14 -3
- package/dist/components/Kbd/Kbd.d.ts +21 -0
- package/dist/components/List/List.d.ts +10 -1
- package/dist/components/Menu/Menu.d.ts +32 -0
- package/dist/components/Menubar/Menubar.d.ts +17 -0
- package/dist/components/NavigationBar/NavigationBar.d.ts +10 -0
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +22 -0
- package/dist/components/NavigationList/NavigationList.d.ts +27 -0
- package/dist/components/NavigationRail/NavigationRail.d.ts +25 -9
- package/dist/components/PinInput/PinInput.d.ts +33 -0
- package/dist/components/Popover/Popover.d.ts +30 -2
- package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
- package/dist/components/Progress/Progress.d.ts +12 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +14 -2
- package/dist/components/Search/Search.d.ts +55 -0
- package/dist/components/Select/Select.d.ts +21 -4
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Slider/Slider.d.ts +7 -1
- package/dist/components/Snackbar/Snackbar.d.ts +7 -2
- package/dist/components/SplitButton/SplitButton.d.ts +13 -0
- package/dist/components/SquigglyWave/SquigglyWave.d.ts +26 -4
- package/dist/components/Sticker/Sticker.d.ts +21 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Table/Table.d.ts +36 -0
- package/dist/components/Tabs/Tabs.d.ts +17 -0
- package/dist/components/Textarea/Textarea.d.ts +14 -3
- package/dist/components/TimePicker/TimePicker.d.ts +47 -0
- package/dist/components/Toggle/Toggle.d.ts +42 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +16 -4
- package/dist/components/Tooltip/Tooltip.d.ts +10 -1
- package/dist/components/Typography/Typography.d.ts +13 -1
- package/dist/datetime.d.ts +12 -0
- package/dist/dev.d.ts +15 -0
- package/dist/index.cjs +3365 -654
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1443 -367
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +50 -4
- package/dist/index.js +3362 -667
- package/dist/index.js.map +1 -1
- package/dist/themes/baseTheme.d.ts +2 -0
- package/dist/themes/createTheme.d.ts +22 -0
- package/dist/themes/monochromeTheme.d.ts +2 -0
- package/dist/themes/types.d.ts +13 -8
- package/dist/tokens/baseTokens.d.ts +4 -0
- package/dist/tokens/types.d.ts +34 -0
- package/dist/utils.d.ts +4 -0
- package/docs/accordion.md +47 -0
- package/docs/animated-number.md +31 -0
- package/docs/app-bar.md +53 -0
- package/docs/avatar-group.md +35 -0
- package/docs/avatar.md +34 -0
- package/docs/badge.md +41 -0
- package/docs/bottom-sheet.md +65 -0
- package/docs/button.md +63 -0
- package/docs/calendar.md +26 -0
- package/docs/card.md +71 -0
- package/docs/carousel.md +43 -0
- package/docs/checkbox.md +37 -0
- package/docs/chip.md +48 -0
- package/docs/combobox.md +73 -0
- package/docs/composition.md +80 -0
- package/docs/confetti.md +30 -0
- package/docs/context-menu.md +42 -0
- package/docs/date-input.md +42 -0
- package/docs/dialog.md +106 -0
- package/docs/divider.md +31 -0
- package/docs/fab-menu.md +55 -0
- package/docs/fab.md +43 -0
- package/docs/field.md +59 -0
- package/docs/floating-toolbar.md +48 -0
- package/docs/forms.md +81 -0
- package/docs/hold-button.md +32 -0
- package/docs/icon-button.md +55 -0
- package/docs/icons.md +38 -0
- package/docs/input.md +51 -0
- package/docs/kbd.md +25 -0
- package/docs/list.md +65 -0
- package/docs/llms-index.md +82 -0
- package/docs/menu.md +88 -0
- package/docs/menubar.md +34 -0
- package/docs/morph.md +54 -0
- package/docs/navigation-bar.md +48 -0
- package/docs/navigation-drawer.md +72 -0
- package/docs/navigation-list.md +40 -0
- package/docs/navigation-rail.md +53 -0
- package/docs/pin-input.md +38 -0
- package/docs/popover.md +78 -0
- package/docs/preview-card.md +40 -0
- package/docs/progress.md +37 -0
- package/docs/radio-group.md +64 -0
- package/docs/search.md +77 -0
- package/docs/select.md +65 -0
- package/docs/setup.md +106 -0
- package/docs/skeleton.md +33 -0
- package/docs/slider.md +49 -0
- package/docs/snackbar.md +50 -0
- package/docs/split-button.md +44 -0
- package/docs/sticker.md +27 -0
- package/docs/switch.md +44 -0
- package/docs/table.md +66 -0
- package/docs/tabs.md +51 -0
- package/docs/textarea.md +23 -0
- package/docs/theming.md +183 -0
- package/docs/time-picker.md +39 -0
- package/docs/toggle-group.md +70 -0
- package/docs/toggle.md +49 -0
- package/docs/tooltip.md +42 -0
- package/docs/typography.md +41 -0
- package/package.json +25 -5
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentColor } from '../../colors/colors';
|
|
2
|
+
import './confetti.css';
|
|
3
|
+
export type ConfettiOptions = {
|
|
4
|
+
/** How many pieces to throw. @default 80 */
|
|
5
|
+
count?: number;
|
|
6
|
+
/** Direction of the burst in degrees, 0 is straight up. @default 0 */
|
|
7
|
+
angle?: number;
|
|
8
|
+
/** How wide the burst fans out, in degrees. @default 70 */
|
|
9
|
+
spread?: number;
|
|
10
|
+
/** How hard the pieces are thrown. @default 1 */
|
|
11
|
+
power?: number;
|
|
12
|
+
/** Theme color roles the pieces are picked from. @default ['primary', 'tonal', 'success', 'warning', 'error'] */
|
|
13
|
+
colors?: ComponentColor[];
|
|
14
|
+
};
|
|
15
|
+
/** Where the burst starts: an element's center, or a point in the viewport. */
|
|
16
|
+
export type ConfettiOrigin = Element | {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns a function that fires a burst of confetti in the theme's colors.
|
|
22
|
+
* Pass the element that triggered it (a button, say) to burst from there.
|
|
23
|
+
* The pieces are decorative: hidden from screen readers, they don't catch
|
|
24
|
+
* the pointer, and nothing fires when the user prefers reduced motion.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const fire = useConfetti()
|
|
28
|
+
* <Button onClick={(e) => fire(e.currentTarget)}>Celebrate</Button>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useConfetti(): (origin?: ConfettiOrigin, options?: ConfettiOptions) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
|
|
2
|
+
/**
|
|
3
|
+
* A menu that opens at the pointer on right-click (or long-press on touch).
|
|
4
|
+
* Put a `ContextMenuTrigger` around the area, then a `MenuPopup` with
|
|
5
|
+
* `MenuItem`s, `MenuGroup`s and `MenuSubmenu`s, the same parts as `Menu`.
|
|
6
|
+
* Holds the open state (`open` / `defaultOpen` / `onOpenChange`).
|
|
7
|
+
*/
|
|
8
|
+
export type ContextMenuProps = BaseContextMenu.Root.Props;
|
|
9
|
+
/**
|
|
10
|
+
* A menu that opens at the pointer on right-click or long-press. Uses
|
|
11
|
+
* `Menu`'s `MenuPopup` and `MenuItem` for its content.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <ContextMenu>
|
|
15
|
+
* <ContextMenuTrigger>Right-click here</ContextMenuTrigger>
|
|
16
|
+
* <MenuPopup>
|
|
17
|
+
* <MenuItem onClick={copy}>Copy</MenuItem>
|
|
18
|
+
* </MenuPopup>
|
|
19
|
+
* </ContextMenu>
|
|
20
|
+
*/
|
|
21
|
+
export declare function ContextMenu(props: ContextMenuProps): import("react").JSX.Element;
|
|
22
|
+
export type ContextMenuTriggerProps = BaseContextMenu.Trigger.Props;
|
|
23
|
+
/** The area that opens the menu. Renders a `<div>`, or pass `render`. */
|
|
24
|
+
export declare function ContextMenuTrigger({ className, ...props }: ContextMenuTriggerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import './date-input.css';
|
|
5
|
+
export type DateInputProps = Omit<BaseInput.Props, 'value' | 'defaultValue' | 'onValueChange' | 'type' | 'size' | 'className' | 'style' | 'placeholder'> & {
|
|
6
|
+
/** Applied to the outer wrapper, with `className`. */
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
/** The date as `"YYYY-MM-DD"` (like `<input type="date">`), or `null` for none. */
|
|
9
|
+
value?: string | null;
|
|
10
|
+
/** Starting date when `value` isn't controlled. @default null */
|
|
11
|
+
defaultValue?: string | null;
|
|
12
|
+
/** Called with the new `"YYYY-MM-DD"`, or `null` once the field is cleared. */
|
|
13
|
+
onValueChange?: (value: string | null) => void;
|
|
14
|
+
/**
|
|
15
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
16
|
+
* once there's text. @default 'normal'
|
|
17
|
+
*/
|
|
18
|
+
size?: 'small' | 'normal';
|
|
19
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
20
|
+
className?: string;
|
|
21
|
+
} & ({
|
|
22
|
+
/** Floating label, like Input's. */
|
|
23
|
+
label: ReactNode;
|
|
24
|
+
'aria-label'?: never;
|
|
25
|
+
} | {
|
|
26
|
+
label?: undefined;
|
|
27
|
+
/** Without a visible `label`, the field needs a name for screen readers. */
|
|
28
|
+
'aria-label': string;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* A text field for a date, typed in the locale's format (10/29/2026,
|
|
32
|
+
* 29.10.2026, ...) or picked from a calendar. The value is `"YYYY-MM-DD"`,
|
|
33
|
+
* the same format as `<input type="date">`, not a `Date`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const [date, setDate] = useState<string | null>(null)
|
|
37
|
+
* <DateInput label="Start date" value={date} onValueChange={setDate} />
|
|
38
|
+
*/
|
|
39
|
+
export declare function DateInput({ value: valueProp, defaultValue, onValueChange, label, size, disabled, id, onBlur, className, style, ref, ...props }: DateInputProps): import("react").JSX.Element;
|
|
@@ -9,16 +9,48 @@ export type DialogProps = BaseDialog.Root.Props & {
|
|
|
9
9
|
*/
|
|
10
10
|
morph?: boolean;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* A modal dialog. Holds the open state: `open` / `defaultOpen` /
|
|
14
|
+
* `onOpenChange`. Parts: `DialogTrigger`, `DialogPopup` (already includes the
|
|
15
|
+
* portal and backdrop; there is no DialogContent or DialogOverlay),
|
|
16
|
+
* `DialogTitle`, `DialogDescription`, `DialogActions` (the footer row) and
|
|
17
|
+
* `DialogClose`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Dialog>
|
|
21
|
+
* <DialogTrigger render={<Button />}>Delete</DialogTrigger>
|
|
22
|
+
* <DialogPopup>
|
|
23
|
+
* <DialogTitle>Delete file?</DialogTitle>
|
|
24
|
+
* <DialogDescription>This can't be undone.</DialogDescription>
|
|
25
|
+
* <DialogActions>
|
|
26
|
+
* <DialogClose render={<Button fillType="text" />}>Cancel</DialogClose>
|
|
27
|
+
* <Button color="error" onClick={remove}>Delete</Button>
|
|
28
|
+
* </DialogActions>
|
|
29
|
+
* </DialogPopup>
|
|
30
|
+
* </Dialog>
|
|
31
|
+
*/
|
|
12
32
|
export declare function Dialog({ morph, defaultOpen, ...props }: DialogProps): import("react").JSX.Element;
|
|
13
33
|
export type DialogTriggerProps = BaseDialog.Trigger.Props;
|
|
34
|
+
/**
|
|
35
|
+
* Opens the dialog. Renders a bare, unstyled `<button>`: pass
|
|
36
|
+
* `render={<Button />}` to use the library's button (not `asChild`).
|
|
37
|
+
*/
|
|
14
38
|
export declare function DialogTrigger({ className, ref, ...props }: DialogTriggerProps): import("react").JSX.Element;
|
|
15
39
|
export type DialogPopupProps = BaseDialog.Popup.Props;
|
|
40
|
+
/** The dialog box. Also renders the portal and the dimmed backdrop behind it. */
|
|
16
41
|
export declare function DialogPopup({ className, ref, ...props }: DialogPopupProps): import("react").JSX.Element;
|
|
17
42
|
export type DialogTitleProps = BaseDialog.Title.Props;
|
|
43
|
+
/** Names the dialog for screen readers. Renders an `<h2>`. */
|
|
18
44
|
export declare function DialogTitle({ className, ...props }: DialogTitleProps): import("react").JSX.Element;
|
|
19
45
|
export type DialogDescriptionProps = BaseDialog.Description.Props;
|
|
46
|
+
/** Supporting text under the title; screen readers read it as the description. */
|
|
20
47
|
export declare function DialogDescription({ className, ...props }: DialogDescriptionProps): import("react").JSX.Element;
|
|
21
48
|
export type DialogActionsProps = ComponentProps<'div'>;
|
|
49
|
+
/** The row of buttons at the bottom, aligned to the end (the "footer"). */
|
|
22
50
|
export declare function DialogActions({ className, ...props }: DialogActionsProps): import("react").JSX.Element;
|
|
23
51
|
export type DialogCloseProps = BaseDialog.Close.Props;
|
|
52
|
+
/**
|
|
53
|
+
* Closes the dialog. Renders a bare `<button>`; pass `render={<Button />}`
|
|
54
|
+
* to use the library's.
|
|
55
|
+
*/
|
|
24
56
|
export declare function DialogClose({ className, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
@@ -13,4 +13,12 @@ export type DividerProps = Separator.Props & {
|
|
|
13
13
|
*/
|
|
14
14
|
squiggly?: boolean;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* A thin line between groups of content. Renders a separator `<div>`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Divider />
|
|
21
|
+
* <Divider label="or" />
|
|
22
|
+
* <div style={{ display: 'flex' }}>A<Divider orientation="vertical" />B</div>
|
|
23
|
+
*/
|
|
16
24
|
export declare function Divider({ label, squiggly, className, ...props }: DividerProps): import("react").JSX.Element;
|
|
@@ -20,5 +20,9 @@ export type FABProps = Omit<BaseButtonProps, 'children'> & ColorProps & {
|
|
|
20
20
|
/**
|
|
21
21
|
* The floating action button: the screen's main action. Place it yourself,
|
|
22
22
|
* usually `position: fixed` in the bottom-end corner.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <FAB icon="edit" aria-label="Compose" style={{ position: 'fixed', insetInlineEnd: 16, bottom: 16 }} />
|
|
26
|
+
* <FAB icon="edit" label="Compose" />
|
|
23
27
|
*/
|
|
24
28
|
export declare function FAB({ icon, label, size, sticky, color, fillType, className, ref, ...props }: FABProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { type ComponentColor, type ComponentFillType } from '../../colors/colors';
|
|
4
|
+
import '../FAB/fab.css';
|
|
5
|
+
import './fab-menu.css';
|
|
6
|
+
export type FABMenuProps = Omit<BaseMenu.Root.Props, 'children' | 'orientation'> & {
|
|
7
|
+
/** Material Symbol on the closed FAB. */
|
|
8
|
+
icon: MaterialSymbol;
|
|
9
|
+
/** Material Symbol on the open FAB. @default 'close' */
|
|
10
|
+
closeIcon?: MaterialSymbol;
|
|
11
|
+
/** Screen reader name for the FAB, which has no visible text. */
|
|
12
|
+
'aria-label': string;
|
|
13
|
+
/**
|
|
14
|
+
* Theme color role for the FAB. Its items use the same role's container
|
|
15
|
+
* shade (`primary-container` for `primary`). @default 'primary'
|
|
16
|
+
*/
|
|
17
|
+
color?: ComponentColor;
|
|
18
|
+
/** How the FAB's color is applied. @default 'filled' */
|
|
19
|
+
fillType?: ComponentFillType;
|
|
20
|
+
/** Which side of the FAB the items open on. @default 'top' */
|
|
21
|
+
side?: BaseMenu.Positioner.Props['side'];
|
|
22
|
+
/** How the items line up with the FAB. @default 'end' */
|
|
23
|
+
align?: BaseMenu.Positioner.Props['align'];
|
|
24
|
+
/** Stick to a mouse cursor that comes close, while closed. @default true */
|
|
25
|
+
sticky?: boolean;
|
|
26
|
+
/** Extra classes for the FAB itself. */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** `FABMenuItem`s, listed top to bottom. */
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A FAB that splits into a stack of labeled actions. The FAB turns into
|
|
33
|
+
* a close button while open. Place it yourself, like a FAB, usually
|
|
34
|
+
* `position: fixed` in the bottom-end corner.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <FABMenu icon="add" aria-label="Create">
|
|
38
|
+
* <FABMenuItem icon="description" onClick={newDoc}>Document</FABMenuItem>
|
|
39
|
+
* <FABMenuItem icon="folder" onClick={newFolder}>Folder</FABMenuItem>
|
|
40
|
+
* </FABMenu>
|
|
41
|
+
*/
|
|
42
|
+
export declare function FABMenu({ icon, closeIcon, 'aria-label': ariaLabel, color, fillType, side, align, sticky, className, children, ...props }: FABMenuProps): import("react").JSX.Element;
|
|
43
|
+
export type FABMenuItemProps = Omit<BaseMenu.Item.Props, 'children'> & {
|
|
44
|
+
/** Material Symbol before the label. */
|
|
45
|
+
icon: MaterialSymbol;
|
|
46
|
+
/** The visible label. */
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Theme color role, shown in its softer container shade.
|
|
50
|
+
* @default the FABMenu's color
|
|
51
|
+
*/
|
|
52
|
+
color?: ComponentColor;
|
|
53
|
+
};
|
|
54
|
+
/** One labeled action in a `FABMenu`. Use `onClick` to act on it. */
|
|
55
|
+
export declare function FABMenuItem({ icon, color, className, children, ...props }: FABMenuItemProps): import("react").JSX.Element;
|
|
@@ -9,8 +9,28 @@ import './field.css';
|
|
|
9
9
|
* earlier, set `validationMode="onBlur"` or `"onChange"`.
|
|
10
10
|
*/
|
|
11
11
|
export type FieldProps = BaseField.Root.Props;
|
|
12
|
+
/**
|
|
13
|
+
* Wraps one control to add helper text, an error message and validation.
|
|
14
|
+
* The control keeps its own `label`; there is no FieldLabel.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Field name="email" validationMode="onBlur">
|
|
18
|
+
* <Input label="Email" type="email" required />
|
|
19
|
+
* <FieldDescription>We never share it.</FieldDescription>
|
|
20
|
+
* <FieldError />
|
|
21
|
+
* </Field>
|
|
22
|
+
*/
|
|
12
23
|
export declare function Field({ className, ...props }: FieldProps): import("react").JSX.Element;
|
|
13
24
|
export type FieldDescriptionProps = BaseField.Description.Props;
|
|
25
|
+
/** Helper text under the control. Hidden while a FieldError is showing. */
|
|
14
26
|
export declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
|
|
15
27
|
export type FieldErrorProps = BaseField.Error.Props;
|
|
28
|
+
/**
|
|
29
|
+
* Shows while the field is invalid. Without children it shows the browser's
|
|
30
|
+
* message or the one `validate` returned. Pass `match` (e.g. "valueMissing")
|
|
31
|
+
* to show it only for one kind of problem.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <FieldError match="valueMissing">Enter your email.</FieldError>
|
|
35
|
+
*/
|
|
16
36
|
export declare function FieldError({ className, ...props }: FieldErrorProps): import("react").JSX.Element;
|
|
@@ -11,12 +11,27 @@ export type FloatingToolbarProps = BaseToolbar.Root.Props & {
|
|
|
11
11
|
/** Use the theme's inverse colors, so it stands out over busy content. @default false */
|
|
12
12
|
inverseColor?: boolean;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* A floating pill of icon buttons.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <FloatingToolbar aria-label="Formatting" style={{ position: 'fixed', bottom: 16, left: '50%', translate: '-50%' }}>
|
|
19
|
+
* <FloatingToolbarButton icon="format_bold" aria-label="Bold" />
|
|
20
|
+
* <FloatingToolbarSeparator />
|
|
21
|
+
* <FloatingToolbarButton icon="send" aria-label="Send" fillType="filled" />
|
|
22
|
+
* </FloatingToolbar>
|
|
23
|
+
*/
|
|
14
24
|
export declare function FloatingToolbar({ inverseColor, className, ...props }: FloatingToolbarProps): import("react").JSX.Element;
|
|
15
25
|
/**
|
|
16
26
|
* An `IconButton` that joins the toolbar's arrow-key navigation. Text style
|
|
17
27
|
* by default; `fillType="filled"` makes it the wider, highlighted one.
|
|
18
28
|
*/
|
|
19
29
|
export type FloatingToolbarButtonProps = IconButtonProps;
|
|
30
|
+
/**
|
|
31
|
+
* An `IconButton` that joins the toolbar's arrow-key navigation. Text style
|
|
32
|
+
* by default; `fillType="filled"` makes it the wider, highlighted one.
|
|
33
|
+
*/
|
|
20
34
|
export declare function FloatingToolbarButton({ fillType, color, disabled, ...props }: FloatingToolbarButtonProps): import("react").JSX.Element;
|
|
21
35
|
export type FloatingToolbarSeparatorProps = BaseToolbar.Separator.Props;
|
|
36
|
+
/** A thin line between groups of buttons. */
|
|
22
37
|
export declare function FloatingToolbarSeparator({ className, ...props }: FloatingToolbarSeparatorProps): import("react").JSX.Element;
|
|
@@ -10,6 +10,9 @@ export type HoldButtonProps = Omit<ButtonProps, 'loading'> & {
|
|
|
10
10
|
* A button for destructive actions: press and hold until the fill sweeps
|
|
11
11
|
* across, instead of a confirm dialog. Letting go early cancels. Works with
|
|
12
12
|
* Space and Enter too; a screen reader's click, which can't be held,
|
|
13
|
-
* confirms straight away.
|
|
13
|
+
* confirms straight away. Use `onConfirm`, not `onClick`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <HoldButton color="error" startIcon="delete" onConfirm={deleteAll}>Hold to delete</HoldButton>
|
|
14
17
|
*/
|
|
15
18
|
export declare function HoldButton({ onConfirm, holdDuration, className, style, disabled, onPointerDown, onPointerUp, onPointerLeave, onPointerCancel, onKeyDown, onKeyUp, onClick, onContextMenu, ...props }: HoldButtonProps): import("react").JSX.Element;
|
|
@@ -2,6 +2,20 @@ import type { MaterialSymbol } from 'material-symbols';
|
|
|
2
2
|
import 'material-symbols/rounded.css';
|
|
3
3
|
import './icon.css';
|
|
4
4
|
export type IconProps = Omit<React.ComponentProps<'span'>, 'children'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Material Symbols (Rounded) name in snake_case, e.g. `'home'`,
|
|
7
|
+
* `'arrow_back'`, `'more_vert'`. Browse them at fonts.google.com/icons.
|
|
8
|
+
*/
|
|
5
9
|
name: MaterialSymbol;
|
|
6
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* A Material Symbols icon. It's hidden from screen readers unless you give
|
|
13
|
+
* it an `aria-label`. Size follows `font-size`, color follows `color`.
|
|
14
|
+
* Other components take icon names directly (`startIcon="add"`), so you
|
|
15
|
+
* rarely need this.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <Icon name="favorite" />
|
|
19
|
+
* <Icon name="warning" aria-label="Warning" style={{ fontSize: 32 }} />
|
|
20
|
+
*/
|
|
7
21
|
export declare function Icon({ name, ...props }: IconProps): import("react").JSX.Element;
|
|
@@ -3,9 +3,22 @@ import type { MaterialSymbol } from 'material-symbols';
|
|
|
3
3
|
import { ComponentColor, ComponentFillType } from '../../colors/colors';
|
|
4
4
|
import './icon-button.css';
|
|
5
5
|
export type IconButtonProps = Omit<BaseButtonProps, 'children'> & {
|
|
6
|
+
/** Material Symbol name to show, e.g. `'delete'`. Takes no children. */
|
|
6
7
|
icon: MaterialSymbol;
|
|
8
|
+
/** How the color is applied. @default 'filled' */
|
|
7
9
|
fillType?: ComponentFillType;
|
|
10
|
+
/** Color role from the theme. @default 'primary' */
|
|
8
11
|
color?: ComponentColor;
|
|
12
|
+
/** 32px, 40px or 48px, the same heights as `Button`. @default 'normal' */
|
|
13
|
+
size?: 'small' | 'normal' | 'big';
|
|
14
|
+
/** Required: there is no visible text, so screen readers read this. */
|
|
9
15
|
'aria-label': string;
|
|
10
16
|
};
|
|
11
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A round button that shows only an icon.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <IconButton icon="delete" aria-label="Delete" fillType="text" color="container" />
|
|
22
|
+
* <IconButton icon="add" aria-label="Add" size="big" />
|
|
23
|
+
*/
|
|
24
|
+
export declare function IconButton({ icon, color, fillType, size, className, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
3
|
import './input.css';
|
|
4
|
-
export type InputProps = Omit<BaseInput.Props, 'className' | 'size'> & {
|
|
4
|
+
export type InputProps = Omit<BaseInput.Props, 'className' | 'style' | 'size'> & {
|
|
5
|
+
/** Applied to the outer wrapper, with `className`. */
|
|
6
|
+
style?: CSSProperties;
|
|
5
7
|
/** Floating label. Sits inside the field and moves onto the border once it has focus or a value. */
|
|
6
8
|
label?: ReactNode;
|
|
7
9
|
/**
|
|
@@ -12,4 +14,13 @@ export type InputProps = Omit<BaseInput.Props, 'className' | 'size'> & {
|
|
|
12
14
|
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
13
15
|
className?: string;
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A text field with a floating label. `value` / `defaultValue` with either
|
|
19
|
+
* `onChange` (event) or `onValueChange` (string). `className` goes on the
|
|
20
|
+
* wrapper; `ref` and other props go on the `<input>`. Wrap it in a `Field`
|
|
21
|
+
* for helper text and validation.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Input label="Email" type="email" value={email} onValueChange={setEmail} />
|
|
25
|
+
*/
|
|
26
|
+
export declare function Input({ label, size, className, style, placeholder, ...props }: InputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import './kbd.css';
|
|
3
|
+
export type KbdProps = ComponentProps<'kbd'> & {
|
|
4
|
+
/** Press down while the user holds the key. @default true */
|
|
5
|
+
listen?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The key that presses this one down, as a `KeyboardEvent.key` value
|
|
8
|
+
* like `'k'`, `'Meta'` or `'Enter'`.
|
|
9
|
+
* @default worked out from the text: 'K', '⌘', 'Ctrl', 'Esc', '↵', ...
|
|
10
|
+
*/
|
|
11
|
+
listenFor?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A keyboard key, for shortcuts like ⌘ K. It presses down while the user
|
|
15
|
+
* holds that key on their own keyboard. Put one per key, with a `+` or a
|
|
16
|
+
* space between them for combinations.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Kbd>⌘</Kbd> + <Kbd>K</Kbd>
|
|
20
|
+
*/
|
|
21
|
+
export declare function Kbd({ listen, listenFor, className, children, ...props }: KbdProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,15 @@ export type ListProps = ComponentProps<'ul'> & {
|
|
|
5
5
|
/** Thin lines between the items. @default false */
|
|
6
6
|
divided?: boolean;
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A column of `ListItem`s. Renders a `<ul>`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <List divided>
|
|
13
|
+
* <ListItem label="Wi-Fi" description="Connected" start={<Icon name="wifi" />} end={<Switch defaultChecked />} render={<label />} />
|
|
14
|
+
* <ListItem label="Account" end={<Icon name="chevron_right" />} render={<a href="/account" />} />
|
|
15
|
+
* </List>
|
|
16
|
+
*/
|
|
9
17
|
export declare function List({ divided, className, ...props }: ListProps): import("react").JSX.Element;
|
|
10
18
|
/**
|
|
11
19
|
* One row. Static by default; pass `render` to make the whole row
|
|
@@ -23,4 +31,5 @@ export type ListItemProps = Omit<useRender.ComponentProps<'div'>, 'children'> &
|
|
|
23
31
|
/** After the text: a `Switch`, `Badge`, short text, an `Icon`, ... */
|
|
24
32
|
end?: ReactNode;
|
|
25
33
|
};
|
|
34
|
+
/** One row: `label`, optional `description`, and `start` / `end` slots. Takes no children. */
|
|
26
35
|
export declare function ListItem({ label, description, start, end, render, className, ...props }: ListItemProps): import("react").JSX.Element;
|
|
@@ -2,21 +2,53 @@ import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
|
2
2
|
import type { MaterialSymbol } from 'material-symbols';
|
|
3
3
|
import './menu.css';
|
|
4
4
|
export type MenuProps = BaseMenu.Root.Props;
|
|
5
|
+
/**
|
|
6
|
+
* A dropdown menu of actions. Holds the open state (`open` / `defaultOpen` /
|
|
7
|
+
* `onOpenChange`). Parts: `MenuTrigger`, `MenuPopup` (includes portal and
|
|
8
|
+
* positioner), `MenuItem`, `MenuGroup` (there is no MenuSeparator: groups
|
|
9
|
+
* are split visually), `MenuSubmenu` + `MenuSubmenuTrigger`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <Menu>
|
|
13
|
+
* <MenuTrigger render={<IconButton icon="more_vert" aria-label="More" fillType="text" color="container" />} />
|
|
14
|
+
* <MenuPopup align="end">
|
|
15
|
+
* <MenuItem startIcon="edit" onClick={rename}>Rename</MenuItem>
|
|
16
|
+
* <MenuItem startIcon="delete" onClick={remove}>Delete</MenuItem>
|
|
17
|
+
* </MenuPopup>
|
|
18
|
+
* </Menu>
|
|
19
|
+
*/
|
|
5
20
|
export declare function Menu(props: MenuProps): import("react").JSX.Element;
|
|
6
21
|
export type MenuTriggerProps = BaseMenu.Trigger.Props;
|
|
22
|
+
/** Opens the menu. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
7
23
|
export declare function MenuTrigger({ className, ...props }: MenuTriggerProps): import("react").JSX.Element;
|
|
24
|
+
/** The menu panel. Also renders the portal and positioner, so it takes their placement props. */
|
|
8
25
|
export type MenuPopupProps = BaseMenu.Popup.Props & Pick<BaseMenu.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset'>;
|
|
26
|
+
/** The menu panel, holding the items. Takes `side`, `align`, `sideOffset`, `alignOffset`. */
|
|
9
27
|
export declare function MenuPopup({ side, align, sideOffset, alignOffset, className, ...props }: MenuPopupProps): import("react").JSX.Element;
|
|
10
28
|
export type MenuSubmenuProps = BaseMenu.SubmenuRoot.Props;
|
|
29
|
+
/**
|
|
30
|
+
* A menu nested in another one: put a `MenuSubmenuTrigger` and a
|
|
31
|
+
* `MenuPopup` in it, and place the whole thing among the parent's items.
|
|
32
|
+
*/
|
|
11
33
|
export declare function MenuSubmenu(props: MenuSubmenuProps): import("react").JSX.Element;
|
|
12
34
|
export type MenuSubmenuTriggerProps = BaseMenu.SubmenuTrigger.Props & {
|
|
35
|
+
/** Material Symbol before the label. */
|
|
13
36
|
startIcon?: MaterialSymbol;
|
|
14
37
|
};
|
|
38
|
+
/** Looks like a `MenuItem`, with an arrow at the end. Opens its submenu on hover or click. */
|
|
15
39
|
export declare function MenuSubmenuTrigger({ startIcon, className, children, ...props }: MenuSubmenuTriggerProps): import("react").JSX.Element;
|
|
16
40
|
export type MenuGroupProps = BaseMenu.Group.Props;
|
|
41
|
+
/**
|
|
42
|
+
* Splits the menu: each group is its own container, with a gap between
|
|
43
|
+
* them. Use it where other libraries use a separator. Items placed straight
|
|
44
|
+
* in the popup, outside any group, share a single container.
|
|
45
|
+
*/
|
|
17
46
|
export declare function MenuGroup({ className, ...props }: MenuGroupProps): import("react").JSX.Element;
|
|
18
47
|
export type MenuItemProps = BaseMenu.Item.Props & {
|
|
48
|
+
/** Material Symbol before the label. */
|
|
19
49
|
startIcon?: MaterialSymbol;
|
|
50
|
+
/** Material Symbol after the label. */
|
|
20
51
|
endIcon?: MaterialSymbol;
|
|
21
52
|
};
|
|
53
|
+
/** One action. Use `onClick` (there is no onSelect); the menu closes after it. */
|
|
22
54
|
export declare function MenuItem({ startIcon, endIcon, className, children, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Menubar as BaseMenubar } from '@base-ui/react/menubar';
|
|
2
|
+
import './menubar.css';
|
|
3
|
+
export type MenubarProps = BaseMenubar.Props;
|
|
4
|
+
/**
|
|
5
|
+
* A row of menus, like File / Edit / View in a desktop app. Put a `Menu` per
|
|
6
|
+
* entry inside, each with a `MenuTrigger` and a `MenuPopup`. Arrow keys move
|
|
7
|
+
* between menus, and once one is open, hovering another opens it instead.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Menubar>
|
|
11
|
+
* <Menu>
|
|
12
|
+
* <MenuTrigger>File</MenuTrigger>
|
|
13
|
+
* <MenuPopup><MenuItem onClick={save}>Save</MenuItem></MenuPopup>
|
|
14
|
+
* </Menu>
|
|
15
|
+
* </Menubar>
|
|
16
|
+
*/
|
|
17
|
+
export declare function Menubar({ className, ...props }: MenubarProps): import("react").JSX.Element;
|
|
@@ -8,6 +8,15 @@ import './navigation-bar.css';
|
|
|
8
8
|
* "Main"). Place it yourself, e.g. `position: sticky; bottom: 0`.
|
|
9
9
|
*/
|
|
10
10
|
export type NavigationBarProps = ComponentProps<'nav'>;
|
|
11
|
+
/**
|
|
12
|
+
* Bottom navigation for small screens.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <NavigationBar aria-label="Main">
|
|
16
|
+
* <NavigationBarItem icon="home" label="Home" href="/" active />
|
|
17
|
+
* <NavigationBarItem icon="search" label="Search" render={<Link to="/search" />} />
|
|
18
|
+
* </NavigationBar>
|
|
19
|
+
*/
|
|
11
20
|
export declare function NavigationBar({ className, ...props }: NavigationBarProps): import("react").JSX.Element;
|
|
12
21
|
export type NavigationBarItemProps = useRender.ComponentProps<'a'> & {
|
|
13
22
|
/** Material Symbol to show. */
|
|
@@ -17,4 +26,5 @@ export type NavigationBarItemProps = useRender.ComponentProps<'a'> & {
|
|
|
17
26
|
/** The current page. Sets aria-current="page". */
|
|
18
27
|
active?: boolean;
|
|
19
28
|
};
|
|
29
|
+
/** One destination: an `<a>` by default (give it `href`), or a router link via `render`. */
|
|
20
30
|
export declare function NavigationBarItem({ icon, label, active, render, className, ...props }: NavigationBarItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -8,12 +8,30 @@ import './navigation-drawer.css';
|
|
|
8
8
|
* `defaultOpen` / `onOpenChange`).
|
|
9
9
|
*/
|
|
10
10
|
export type NavigationDrawerProps = Omit<Drawer.Root.Props, 'swipeDirection'>;
|
|
11
|
+
/**
|
|
12
|
+
* Side navigation that slides in over the page, for small screens.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <NavigationDrawer>
|
|
16
|
+
* <NavigationDrawerTrigger render={<IconButton icon="menu" aria-label="Open navigation" />} />
|
|
17
|
+
* <NavigationDrawerPopup>
|
|
18
|
+
* <NavigationDrawerTitle>Mail</NavigationDrawerTitle>
|
|
19
|
+
* <NavigationDrawerItem icon="inbox" label="Inbox" href="/inbox" active />
|
|
20
|
+
* </NavigationDrawerPopup>
|
|
21
|
+
* </NavigationDrawer>
|
|
22
|
+
*/
|
|
11
23
|
export declare function NavigationDrawer(props: NavigationDrawerProps): import("react").JSX.Element;
|
|
12
24
|
export type NavigationDrawerTriggerProps = Drawer.Trigger.Props;
|
|
25
|
+
/** Opens the drawer. Renders a bare `<button>`; usually `render={<IconButton icon="menu" aria-label="..." />}`. */
|
|
13
26
|
export declare function NavigationDrawerTrigger({ className, ...props }: NavigationDrawerTriggerProps): import("react").JSX.Element;
|
|
14
27
|
export type NavigationDrawerPopupProps = Drawer.Popup.Props;
|
|
28
|
+
/**
|
|
29
|
+
* The drawer panel. Also renders the portal and the dimmed backdrop. Put a
|
|
30
|
+
* `NavigationDrawerTitle` first (it names the drawer), then the items.
|
|
31
|
+
*/
|
|
15
32
|
export declare function NavigationDrawerPopup({ className, ...props }: NavigationDrawerPopupProps): import("react").JSX.Element;
|
|
16
33
|
export type NavigationDrawerTitleProps = Drawer.Title.Props;
|
|
34
|
+
/** The heading at the top, e.g. the app's name. Renders an `<h2>`. */
|
|
17
35
|
export declare function NavigationDrawerTitle({ className, ...props }: NavigationDrawerTitleProps): import("react").JSX.Element;
|
|
18
36
|
export type NavigationDrawerItemProps = Omit<Drawer.Close.Props, 'children'> & {
|
|
19
37
|
/** Material Symbol to show. */
|
|
@@ -27,4 +45,8 @@ export type NavigationDrawerItemProps = Omit<Drawer.Close.Props, 'children'> & {
|
|
|
27
45
|
/** Where the default link goes. Not needed with a router `render`. */
|
|
28
46
|
href?: string;
|
|
29
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* A link that also closes the drawer. Give it `href`, or pass `render` for a
|
|
50
|
+
* router link, e.g. `render={<Link to="/photos" />}`.
|
|
51
|
+
*/
|
|
30
52
|
export declare function NavigationDrawerItem({ icon, label, active, end, href, render, className, ...props }: NavigationDrawerItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import './navigation-list.css';
|
|
4
|
+
/**
|
|
5
|
+
* A column of text-only navigation links, like a docs sidebar. Looks like an
|
|
6
|
+
* expanded `NavigationRail` without icons. Fill it with
|
|
7
|
+
* `NavigationListItem`s and give it an `aria-label` (e.g. "Components").
|
|
8
|
+
*/
|
|
9
|
+
export type NavigationListProps = ComponentProps<'nav'>;
|
|
10
|
+
/**
|
|
11
|
+
* A column of text-only navigation links.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <NavigationList aria-label="Settings">
|
|
15
|
+
* <NavigationListItem label="Profile" href="/settings/profile" active />
|
|
16
|
+
* <NavigationListItem label="Billing" href="/settings/billing" />
|
|
17
|
+
* </NavigationList>
|
|
18
|
+
*/
|
|
19
|
+
export declare function NavigationList({ className, ...props }: NavigationListProps): import("react").JSX.Element;
|
|
20
|
+
export type NavigationListItemProps = useRender.ComponentProps<'a'> & {
|
|
21
|
+
/** Visible text, also the link's accessible name. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** The current page. Sets aria-current="page". */
|
|
24
|
+
active?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** One link: an `<a>` by default (give it `href`), or a router link via `render`. The text is `label`. */
|
|
27
|
+
export declare function NavigationListItem({ label, active, render, className, ...props }: NavigationListItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -1,21 +1,36 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
2
|
import type { MaterialSymbol } from 'material-symbols';
|
|
3
3
|
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { type IconButtonProps } from '../IconButton/IconButton';
|
|
4
5
|
import './navigation-rail.css';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Side navigation between an app's top-level pages, for medium and large
|
|
8
|
+
* screens. Collapsed, it shows icons with small labels under them; expanded,
|
|
9
|
+
* labels sit next to the icons. Put a `NavigationRailToggle` first, then
|
|
10
|
+
* `NavigationRailItem`s, and give it an `aria-label` (e.g. "Main").
|
|
11
|
+
*/
|
|
12
|
+
export type NavigationRailProps = ComponentProps<'nav'> & {
|
|
13
|
+
/** Whether labels sit next to the icons. Pair with `onExpandedChange`. */
|
|
9
14
|
expanded?: boolean;
|
|
10
|
-
/** Starting state when `expanded` isn't controlled. */
|
|
15
|
+
/** Starting state when `expanded` isn't controlled. @default false */
|
|
11
16
|
defaultExpanded?: boolean;
|
|
17
|
+
/** Called when a `NavigationRailToggle` is pressed. */
|
|
12
18
|
onExpandedChange?: (expanded: boolean) => void;
|
|
13
19
|
};
|
|
14
20
|
/**
|
|
15
|
-
* Side navigation
|
|
16
|
-
*
|
|
21
|
+
* Side navigation for medium and large screens.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <NavigationRail aria-label="Main">
|
|
25
|
+
* <NavigationRailToggle aria-label="Toggle navigation" />
|
|
26
|
+
* <NavigationRailItem icon="inbox" label="Inbox" href="/inbox" active end="3" />
|
|
27
|
+
* <NavigationRailItem icon="send" label="Sent" href="/sent" />
|
|
28
|
+
* </NavigationRail>
|
|
17
29
|
*/
|
|
18
|
-
export declare function NavigationRail({
|
|
30
|
+
export declare function NavigationRail({ expanded: expandedProp, defaultExpanded, onExpandedChange, className, ...props }: NavigationRailProps): import("react").JSX.Element;
|
|
31
|
+
export type NavigationRailToggleProps = Omit<IconButtonProps, 'icon'>;
|
|
32
|
+
/** The menu button at the top that expands and collapses the rail. Needs an `aria-label`. */
|
|
33
|
+
export declare function NavigationRailToggle({ className, onClick, ...props }: NavigationRailToggleProps): import("react").JSX.Element;
|
|
19
34
|
export type NavigationRailItemProps = useRender.ComponentProps<'a'> & {
|
|
20
35
|
/** Material Symbol to show. */
|
|
21
36
|
icon: MaterialSymbol;
|
|
@@ -29,4 +44,5 @@ export type NavigationRailItemProps = useRender.ComponentProps<'a'> & {
|
|
|
29
44
|
*/
|
|
30
45
|
end?: ReactNode;
|
|
31
46
|
};
|
|
47
|
+
/** One destination: an `<a>` by default (give it `href`), or a router link via `render`. */
|
|
32
48
|
export declare function NavigationRailItem({ icon, label, active, end, render, className, ...props }: NavigationRailItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|