anvilui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +128 -2
- package/bin/anvilui.mjs +83 -0
- package/dist/colors/colors.d.ts +24 -0
- 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 +34 -0
- package/dist/components/AnvilRoot/AnvilRoot.d.ts +56 -0
- package/dist/components/AppBar/AppBar.d.ts +45 -0
- package/dist/components/Avatar/Avatar.d.ts +27 -0
- 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 +23 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +41 -0
- package/dist/components/Button/Button.d.ts +35 -0
- package/dist/components/Calendar/Calendar.d.ts +19 -0
- package/dist/components/Card/Card.d.ts +57 -0
- package/dist/components/Carousel/Carousel.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Chip/Chip.d.ts +46 -0
- package/dist/components/Combobox/Combobox.d.ts +42 -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 +37 -0
- package/dist/components/Dialog/Dialog.d.ts +56 -0
- package/dist/components/Divider/Divider.d.ts +24 -0
- package/dist/components/FAB/FAB.d.ts +28 -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 +36 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +37 -0
- package/dist/components/HoldButton/HoldButton.d.ts +18 -0
- package/dist/components/Icon/Icon.d.ts +21 -0
- package/dist/components/IconButton/IconButton.d.ts +22 -0
- package/dist/components/Input/Input.d.ts +24 -0
- package/dist/components/Kbd/Kbd.d.ts +21 -0
- package/dist/components/List/List.d.ts +35 -0
- package/dist/components/Menu/Menu.d.ts +54 -0
- package/dist/components/Menubar/Menubar.d.ts +17 -0
- package/dist/components/NavigationBar/NavigationBar.d.ts +30 -0
- package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +52 -0
- package/dist/components/NavigationList/NavigationList.d.ts +27 -0
- package/dist/components/NavigationRail/NavigationRail.d.ts +48 -0
- package/dist/components/PinInput/PinInput.d.ts +31 -0
- package/dist/components/Popover/Popover.d.ts +49 -0
- package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
- package/dist/components/Progress/Progress.d.ts +29 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +19 -0
- package/dist/components/Search/Search.d.ts +39 -0
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Slider/Slider.d.ts +31 -0
- package/dist/components/Snackbar/Snackbar.d.ts +35 -0
- package/dist/components/SplitButton/SplitButton.d.ts +16 -0
- package/dist/components/SquigglyWave/SquigglyWave.d.ts +36 -0
- package/dist/components/Sticker/Sticker.d.ts +21 -0
- package/dist/components/Switch/Switch.d.ts +15 -0
- package/dist/components/Table/Table.d.ts +36 -0
- package/dist/components/Tabs/Tabs.d.ts +32 -0
- package/dist/components/Textarea/Textarea.d.ts +24 -0
- package/dist/components/TimePicker/TimePicker.d.ts +45 -0
- package/dist/components/Toggle/Toggle.d.ts +41 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +50 -0
- package/dist/components/Tooltip/Tooltip.d.ts +23 -0
- package/dist/components/Typography/Typography.d.ts +22 -0
- package/dist/datetime.d.ts +12 -0
- package/dist/dev.d.ts +15 -0
- package/dist/index.cjs +5419 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +3724 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.js +5299 -0
- package/dist/index.js.map +1 -0
- package/dist/morph.d.ts +64 -0
- package/dist/themes/baseTheme.d.ts +5 -0
- package/dist/themes/createTheme.d.ts +22 -0
- package/dist/themes/monochromeTheme.d.ts +5 -0
- package/dist/themes/toCssVariables.d.ts +2 -0
- package/dist/themes/types.d.ts +60 -0
- package/dist/tokens/baseTokens.d.ts +6 -0
- package/dist/tokens/toCssVariables.d.ts +2 -0
- package/dist/tokens/types.d.ts +80 -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 +72 -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 +41 -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 +54 -0
- package/docs/icons.md +38 -0
- package/docs/input.md +50 -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 +51 -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 +47 -0
- package/docs/search.md +77 -0
- package/docs/select.md +64 -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 +182 -0
- package/docs/time-picker.md +38 -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 +65 -5
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import '../Select/select.css';
|
|
6
|
+
import './combobox.css';
|
|
7
|
+
export type ComboboxProps<Item> = Omit<BaseCombobox.Root.Props<Item>, 'children' | 'items'> & {
|
|
8
|
+
/** The options. Filtered against what's typed. */
|
|
9
|
+
items?: readonly Item[];
|
|
10
|
+
/** Renders each option, e.g. `(item) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>`. */
|
|
11
|
+
children: (item: Item, index: number) => ReactNode;
|
|
12
|
+
/** Floating label. Sits inside the field and moves onto the border once it has focus or a value. */
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
/** Hint text inside the field. With a `label`, only once the label has moved up. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Shown in the popup when nothing matches. Without it, the popup hides. */
|
|
17
|
+
empty?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
20
|
+
* once there's text instead of moving onto the border. @default 'normal'
|
|
21
|
+
*/
|
|
22
|
+
size?: 'small' | 'normal';
|
|
23
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A text field that filters a list of options as you type, and picks one.
|
|
28
|
+
* The picked option is `value` / `defaultValue` / `onValueChange`. For
|
|
29
|
+
* object items, pass `itemToStringLabel` so the field shows a readable label.
|
|
30
|
+
* Children must be a function that renders one item.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Combobox label="Country" items={countries} empty="No matches">
|
|
34
|
+
* {(country: string) => (
|
|
35
|
+
* <ComboboxItem key={country} value={country}>{country}</ComboboxItem>
|
|
36
|
+
* )}
|
|
37
|
+
* </Combobox>
|
|
38
|
+
*/
|
|
39
|
+
export declare function Combobox<Item>({ children, label, placeholder, empty, size, className, ...props }: ComboboxProps<Item>): import("react").JSX.Element;
|
|
40
|
+
export type ComboboxItemProps = BaseCombobox.Item.Props;
|
|
41
|
+
/** One option in a `Combobox`. Needs a `value` (the item); children are its label. */
|
|
42
|
+
export declare function ComboboxItem({ className, children, ...props }: ComboboxItemProps): import("react").JSX.Element;
|
|
@@ -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,37 @@
|
|
|
1
|
+
import { 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' | 'placeholder'> & {
|
|
6
|
+
/** The date as `"YYYY-MM-DD"` (like `<input type="date">`), or `null` for none. */
|
|
7
|
+
value?: string | null;
|
|
8
|
+
/** Starting date when `value` isn't controlled. @default null */
|
|
9
|
+
defaultValue?: string | null;
|
|
10
|
+
/** Called with the new `"YYYY-MM-DD"`, or `null` once the field is cleared. */
|
|
11
|
+
onValueChange?: (value: string | null) => void;
|
|
12
|
+
/**
|
|
13
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
14
|
+
* once there's text. @default 'normal'
|
|
15
|
+
*/
|
|
16
|
+
size?: 'small' | 'normal';
|
|
17
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
18
|
+
className?: string;
|
|
19
|
+
} & ({
|
|
20
|
+
/** Floating label, like Input's. */
|
|
21
|
+
label: ReactNode;
|
|
22
|
+
'aria-label'?: never;
|
|
23
|
+
} | {
|
|
24
|
+
label?: undefined;
|
|
25
|
+
/** Without a visible `label`, the field needs a name for screen readers. */
|
|
26
|
+
'aria-label': string;
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* A text field for a date, typed in the locale's format (10/29/2026,
|
|
30
|
+
* 29.10.2026, ...) or picked from a calendar. The value is `"YYYY-MM-DD"`,
|
|
31
|
+
* the same format as `<input type="date">`, not a `Date`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const [date, setDate] = useState<string | null>(null)
|
|
35
|
+
* <DateInput label="Start date" value={date} onValueChange={setDate} />
|
|
36
|
+
*/
|
|
37
|
+
export declare function DateInput({ value: valueProp, defaultValue, onValueChange, label, size, disabled, id, onBlur, className, ...props }: DateInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import './dialog.css';
|
|
4
|
+
export type DialogProps = BaseDialog.Root.Props & {
|
|
5
|
+
/**
|
|
6
|
+
* Grow the dialog out of its trigger, and shrink it back into it on
|
|
7
|
+
* close (Material's container transform). Works best when the trigger
|
|
8
|
+
* is a surface, like a clickable `Card`. @default false
|
|
9
|
+
*/
|
|
10
|
+
morph?: boolean;
|
|
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
|
+
*/
|
|
32
|
+
export declare function Dialog({ morph, defaultOpen, ...props }: DialogProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
38
|
+
export declare function DialogTrigger({ className, ref, ...props }: DialogTriggerProps): import("react").JSX.Element;
|
|
39
|
+
export type DialogPopupProps = BaseDialog.Popup.Props;
|
|
40
|
+
/** The dialog box. Also renders the portal and the dimmed backdrop behind it. */
|
|
41
|
+
export declare function DialogPopup({ className, ref, ...props }: DialogPopupProps): import("react").JSX.Element;
|
|
42
|
+
export type DialogTitleProps = BaseDialog.Title.Props;
|
|
43
|
+
/** Names the dialog for screen readers. Renders an `<h2>`. */
|
|
44
|
+
export declare function DialogTitle({ className, ...props }: DialogTitleProps): import("react").JSX.Element;
|
|
45
|
+
export type DialogDescriptionProps = BaseDialog.Description.Props;
|
|
46
|
+
/** Supporting text under the title; screen readers read it as the description. */
|
|
47
|
+
export declare function DialogDescription({ className, ...props }: DialogDescriptionProps): import("react").JSX.Element;
|
|
48
|
+
export type DialogActionsProps = ComponentProps<'div'>;
|
|
49
|
+
/** The row of buttons at the bottom, aligned to the end (the "footer"). */
|
|
50
|
+
export declare function DialogActions({ className, ...props }: DialogActionsProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
56
|
+
export declare function DialogClose({ className, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Separator } from '@base-ui/react/separator';
|
|
3
|
+
import './divider.css';
|
|
4
|
+
/**
|
|
5
|
+
* A thin line between groups of content. `orientation="vertical"` stretches
|
|
6
|
+
* to the height of its row, so put it in a flex row.
|
|
7
|
+
*/
|
|
8
|
+
export type DividerProps = Separator.Props & {
|
|
9
|
+
/** Text in the middle of the line, with the line on both sides. */
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Draw the line as a wave, like squiggly Progress. @default false
|
|
13
|
+
*/
|
|
14
|
+
squiggly?: boolean;
|
|
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
|
+
*/
|
|
24
|
+
export declare function Divider({ label, squiggly, className, ...props }: DividerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ButtonProps as BaseButtonProps } from '@base-ui/react/button';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { type ColorProps } from '../../colors/colors';
|
|
4
|
+
import './fab.css';
|
|
5
|
+
export type FABProps = Omit<BaseButtonProps, 'children'> & ColorProps & {
|
|
6
|
+
/** Material Symbol to show. */
|
|
7
|
+
icon: MaterialSymbol;
|
|
8
|
+
/** 40px, 56px or 96px tall. @default 'normal' */
|
|
9
|
+
size?: 'small' | 'normal' | 'big';
|
|
10
|
+
/** Stick to a mouse cursor that comes close. @default true */
|
|
11
|
+
sticky?: boolean;
|
|
12
|
+
} & ({
|
|
13
|
+
/** Visible text next to the icon: makes it an extended FAB. */
|
|
14
|
+
label: string;
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
} | {
|
|
17
|
+
label?: never;
|
|
18
|
+
'aria-label': string;
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The floating action button: the screen's main action. Place it yourself,
|
|
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" />
|
|
27
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Field as BaseField } from '@base-ui/react/field';
|
|
2
|
+
import './field.css';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps one control (`Input`, `Textarea`, `Select`, ...) to add helper text,
|
|
5
|
+
* an error message and validation. Takes `name`, `validate`, `invalid`,
|
|
6
|
+
* `disabled` and `validationMode`.
|
|
7
|
+
*
|
|
8
|
+
* Validation runs on form submit by default. Outside a `<form>`, or to check
|
|
9
|
+
* earlier, set `validationMode="onBlur"` or `"onChange"`.
|
|
10
|
+
*/
|
|
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
|
+
*/
|
|
23
|
+
export declare function Field({ className, ...props }: FieldProps): import("react").JSX.Element;
|
|
24
|
+
export type FieldDescriptionProps = BaseField.Description.Props;
|
|
25
|
+
/** Helper text under the control. Hidden while a FieldError is showing. */
|
|
26
|
+
export declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
36
|
+
export declare function FieldError({ className, ...props }: FieldErrorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';
|
|
2
|
+
import { type IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
import '../Divider/divider.css';
|
|
4
|
+
import './floating-toolbar.css';
|
|
5
|
+
/**
|
|
6
|
+
* A floating pill of icon buttons. Arrow keys move between them; Tab enters
|
|
7
|
+
* and leaves as one stop. Give it an `aria-label`, and place it yourself,
|
|
8
|
+
* e.g. `position: fixed` at the bottom center.
|
|
9
|
+
*/
|
|
10
|
+
export type FloatingToolbarProps = BaseToolbar.Root.Props & {
|
|
11
|
+
/** Use the theme's inverse colors, so it stands out over busy content. @default false */
|
|
12
|
+
inverseColor?: boolean;
|
|
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
|
+
*/
|
|
24
|
+
export declare function FloatingToolbar({ inverseColor, className, ...props }: FloatingToolbarProps): import("react").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* An `IconButton` that joins the toolbar's arrow-key navigation. Text style
|
|
27
|
+
* by default; `fillType="filled"` makes it the wider, highlighted one.
|
|
28
|
+
*/
|
|
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
|
+
*/
|
|
34
|
+
export declare function FloatingToolbarButton({ fillType, color, disabled, ...props }: FloatingToolbarButtonProps): import("react").JSX.Element;
|
|
35
|
+
export type FloatingToolbarSeparatorProps = BaseToolbar.Separator.Props;
|
|
36
|
+
/** A thin line between groups of buttons. */
|
|
37
|
+
export declare function FloatingToolbarSeparator({ className, ...props }: FloatingToolbarSeparatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ButtonProps } from '../Button/Button';
|
|
2
|
+
import './hold-button.css';
|
|
3
|
+
export type HoldButtonProps = Omit<ButtonProps, 'loading'> & {
|
|
4
|
+
/** Called once the button has been held down for `holdDuration`. */
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
/** How long to hold, in milliseconds. @default 1500 */
|
|
7
|
+
holdDuration?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A button for destructive actions: press and hold until the fill sweeps
|
|
11
|
+
* across, instead of a confirm dialog. Letting go early cancels. Works with
|
|
12
|
+
* Space and Enter too; a screen reader's click, which can't be held,
|
|
13
|
+
* confirms straight away. Use `onConfirm`, not `onClick`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <HoldButton color="error" startIcon="delete" onConfirm={deleteAll}>Hold to delete</HoldButton>
|
|
17
|
+
*/
|
|
18
|
+
export declare function HoldButton({ onConfirm, holdDuration, className, style, disabled, onPointerDown, onPointerUp, onPointerLeave, onPointerCancel, onKeyDown, onKeyUp, onClick, onContextMenu, ...props }: HoldButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
2
|
+
import 'material-symbols/rounded.css';
|
|
3
|
+
import './icon.css';
|
|
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
|
+
*/
|
|
9
|
+
name: MaterialSymbol;
|
|
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
|
+
*/
|
|
21
|
+
export declare function Icon({ name, ...props }: IconProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ButtonProps as BaseButtonProps } from '@base-ui/react/button';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { ComponentColor, ComponentFillType } from '../../colors/colors';
|
|
4
|
+
import './icon-button.css';
|
|
5
|
+
export type IconButtonProps = Omit<BaseButtonProps, 'children'> & {
|
|
6
|
+
/** Material Symbol name to show, e.g. `'delete'`. Takes no children. */
|
|
7
|
+
icon: MaterialSymbol;
|
|
8
|
+
/** How the color is applied. @default 'filled' */
|
|
9
|
+
fillType?: ComponentFillType;
|
|
10
|
+
/** Color role from the theme. @default 'primary' */
|
|
11
|
+
color?: ComponentColor;
|
|
12
|
+
/** Required: there is no visible text, so screen readers read this. */
|
|
13
|
+
'aria-label': string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A round, 40px button that shows only an icon. Always 40px: it has no
|
|
17
|
+
* `size` prop.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <IconButton icon="delete" aria-label="Delete" fillType="text" color="container" />
|
|
21
|
+
*/
|
|
22
|
+
export declare function IconButton({ icon, color, fillType, className, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
|
+
import './input.css';
|
|
4
|
+
export type InputProps = Omit<BaseInput.Props, 'className' | 'size'> & {
|
|
5
|
+
/** Floating label. Sits inside the field and moves onto the border once it has focus or a value. */
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
9
|
+
* once there's text instead of moving onto the border. @default 'normal'
|
|
10
|
+
*/
|
|
11
|
+
size?: 'small' | 'normal';
|
|
12
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A text field with a floating label. `value` / `defaultValue` with either
|
|
17
|
+
* `onChange` (event) or `onValueChange` (string). `className` goes on the
|
|
18
|
+
* wrapper; `ref` and other props go on the `<input>`. Wrap it in a `Field`
|
|
19
|
+
* for helper text and validation.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <Input label="Email" type="email" value={email} onValueChange={setEmail} />
|
|
23
|
+
*/
|
|
24
|
+
export declare function Input({ label, size, className, 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;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import './list.css';
|
|
4
|
+
export type ListProps = ComponentProps<'ul'> & {
|
|
5
|
+
/** Thin lines between the items. @default false */
|
|
6
|
+
divided?: boolean;
|
|
7
|
+
};
|
|
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
|
+
*/
|
|
17
|
+
export declare function List({ divided, className, ...props }: ListProps): import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* One row. Static by default; pass `render` to make the whole row
|
|
20
|
+
* interactive: `render={<a href="/settings" />}` for a link, or
|
|
21
|
+
* `render={<label />}` so clicking anywhere toggles a Switch or Checkbox
|
|
22
|
+
* in `start` or `end`.
|
|
23
|
+
*/
|
|
24
|
+
export type ListItemProps = Omit<useRender.ComponentProps<'div'>, 'children'> & {
|
|
25
|
+
/** The main text. */
|
|
26
|
+
label: ReactNode;
|
|
27
|
+
/** Supporting text under the label, up to two lines. */
|
|
28
|
+
description?: ReactNode;
|
|
29
|
+
/** Before the text: an `Icon`, `Avatar`, `Checkbox`, ... */
|
|
30
|
+
start?: ReactNode;
|
|
31
|
+
/** After the text: a `Switch`, `Badge`, short text, an `Icon`, ... */
|
|
32
|
+
end?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/** One row: `label`, optional `description`, and `start` / `end` slots. Takes no children. */
|
|
35
|
+
export declare function ListItem({ label, description, start, end, render, className, ...props }: ListItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import './menu.css';
|
|
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
|
+
*/
|
|
20
|
+
export declare function Menu(props: MenuProps): import("react").JSX.Element;
|
|
21
|
+
export type MenuTriggerProps = BaseMenu.Trigger.Props;
|
|
22
|
+
/** Opens the menu. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
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. */
|
|
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`. */
|
|
27
|
+
export declare function MenuPopup({ side, align, sideOffset, alignOffset, className, ...props }: MenuPopupProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
33
|
+
export declare function MenuSubmenu(props: MenuSubmenuProps): import("react").JSX.Element;
|
|
34
|
+
export type MenuSubmenuTriggerProps = BaseMenu.SubmenuTrigger.Props & {
|
|
35
|
+
/** Material Symbol before the label. */
|
|
36
|
+
startIcon?: MaterialSymbol;
|
|
37
|
+
};
|
|
38
|
+
/** Looks like a `MenuItem`, with an arrow at the end. Opens its submenu on hover or click. */
|
|
39
|
+
export declare function MenuSubmenuTrigger({ startIcon, className, children, ...props }: MenuSubmenuTriggerProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
46
|
+
export declare function MenuGroup({ className, ...props }: MenuGroupProps): import("react").JSX.Element;
|
|
47
|
+
export type MenuItemProps = BaseMenu.Item.Props & {
|
|
48
|
+
/** Material Symbol before the label. */
|
|
49
|
+
startIcon?: MaterialSymbol;
|
|
50
|
+
/** Material Symbol after the label. */
|
|
51
|
+
endIcon?: MaterialSymbol;
|
|
52
|
+
};
|
|
53
|
+
/** One action. Use `onClick` (there is no onSelect); the menu closes after it. */
|
|
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;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import './navigation-bar.css';
|
|
5
|
+
/**
|
|
6
|
+
* Bottom navigation between an app's top-level pages, for small screens.
|
|
7
|
+
* Fill it with 3–5 `NavigationBarItem`s and give it an `aria-label` (e.g.
|
|
8
|
+
* "Main"). Place it yourself, e.g. `position: sticky; bottom: 0`.
|
|
9
|
+
*/
|
|
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
|
+
*/
|
|
20
|
+
export declare function NavigationBar({ className, ...props }: NavigationBarProps): import("react").JSX.Element;
|
|
21
|
+
export type NavigationBarItemProps = useRender.ComponentProps<'a'> & {
|
|
22
|
+
/** Material Symbol to show. */
|
|
23
|
+
icon: MaterialSymbol;
|
|
24
|
+
/** Visible text, also the link's accessible name. */
|
|
25
|
+
label: string;
|
|
26
|
+
/** The current page. Sets aria-current="page". */
|
|
27
|
+
active?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** One destination: an `<a>` by default (give it `href`), or a router link via `render`. */
|
|
30
|
+
export declare function NavigationBarItem({ icon, label, active, render, className, ...props }: NavigationBarItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|