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,52 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Drawer } from '@base-ui/react/drawer';
|
|
3
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
4
|
+
import './navigation-drawer.css';
|
|
5
|
+
/**
|
|
6
|
+
* Side navigation that slides in over the page, for small screens. Swipe it
|
|
7
|
+
* back or tap outside to close. Holds the open state (`open` /
|
|
8
|
+
* `defaultOpen` / `onOpenChange`).
|
|
9
|
+
*/
|
|
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
|
+
*/
|
|
23
|
+
export declare function NavigationDrawer(props: NavigationDrawerProps): import("react").JSX.Element;
|
|
24
|
+
export type NavigationDrawerTriggerProps = Drawer.Trigger.Props;
|
|
25
|
+
/** Opens the drawer. Renders a bare `<button>`; usually `render={<IconButton icon="menu" aria-label="..." />}`. */
|
|
26
|
+
export declare function NavigationDrawerTrigger({ className, ...props }: NavigationDrawerTriggerProps): import("react").JSX.Element;
|
|
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
|
+
*/
|
|
32
|
+
export declare function NavigationDrawerPopup({ className, ...props }: NavigationDrawerPopupProps): import("react").JSX.Element;
|
|
33
|
+
export type NavigationDrawerTitleProps = Drawer.Title.Props;
|
|
34
|
+
/** The heading at the top, e.g. the app's name. Renders an `<h2>`. */
|
|
35
|
+
export declare function NavigationDrawerTitle({ className, ...props }: NavigationDrawerTitleProps): import("react").JSX.Element;
|
|
36
|
+
export type NavigationDrawerItemProps = Omit<Drawer.Close.Props, 'children'> & {
|
|
37
|
+
/** Material Symbol to show. */
|
|
38
|
+
icon: MaterialSymbol;
|
|
39
|
+
/** Visible text, also the link's accessible name. */
|
|
40
|
+
label: string;
|
|
41
|
+
/** The current page. Sets aria-current="page". */
|
|
42
|
+
active?: boolean;
|
|
43
|
+
/** After the label, e.g. an unread count. */
|
|
44
|
+
end?: ReactNode;
|
|
45
|
+
/** Where the default link goes. Not needed with a router `render`. */
|
|
46
|
+
href?: string;
|
|
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
|
+
*/
|
|
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>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { type IconButtonProps } from '../IconButton/IconButton';
|
|
5
|
+
import './navigation-rail.css';
|
|
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`. */
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
/** Starting state when `expanded` isn't controlled. @default false */
|
|
16
|
+
defaultExpanded?: boolean;
|
|
17
|
+
/** Called when a `NavigationRailToggle` is pressed. */
|
|
18
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
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>
|
|
29
|
+
*/
|
|
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;
|
|
34
|
+
export type NavigationRailItemProps = useRender.ComponentProps<'a'> & {
|
|
35
|
+
/** Material Symbol to show. */
|
|
36
|
+
icon: MaterialSymbol;
|
|
37
|
+
/** Visible text, also the link's accessible name. */
|
|
38
|
+
label: string;
|
|
39
|
+
/** The current page. Sets aria-current="page". */
|
|
40
|
+
active?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Short content after the label, like an unread count. Shown as a badge
|
|
43
|
+
* on the icon while the rail is collapsed, so keep it to a few characters.
|
|
44
|
+
*/
|
|
45
|
+
end?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
/** One destination: an `<a>` by default (give it `href`), or a router link via `render`. */
|
|
48
|
+
export declare function NavigationRailItem({ icon, label, active, end, render, className, ...props }: NavigationRailItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { OTPField as BaseOTPField } from '@base-ui/react/otp-field';
|
|
3
|
+
import './pin-input.css';
|
|
4
|
+
export type PinInputProps = Omit<BaseOTPField.Root.Props, 'className' | 'children' | 'size'> & {
|
|
5
|
+
/** `filled` gives each box a tinted background and a bottom line instead of a full border. @default 'outlined' */
|
|
6
|
+
fillType?: 'filled' | 'outlined';
|
|
7
|
+
/** Boxes are 40px tall instead of 56px. @default 'normal' */
|
|
8
|
+
size?: 'small' | 'normal';
|
|
9
|
+
/** Screen reader name of each box after the first. @default (index, length) => `Character ${index + 1} of ${length}` */
|
|
10
|
+
slotLabel?: (index: number, length: number) => string;
|
|
11
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
12
|
+
className?: string;
|
|
13
|
+
} & ({
|
|
14
|
+
/** Visible label above the boxes. */
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
'aria-label'?: never;
|
|
17
|
+
} | {
|
|
18
|
+
label?: undefined;
|
|
19
|
+
/** Without a visible `label`, the field needs a name for screen readers. */
|
|
20
|
+
'aria-label': string;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* One box per character, for verification codes and PINs. Typing, paste,
|
|
24
|
+
* backspace and arrow keys move between boxes. Digits only by default; set
|
|
25
|
+
* `validationType` for letters. `mask` hides what's typed. `length` is
|
|
26
|
+
* required.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <PinInput label="Verification code" length={6} onValueChange={setCode} />
|
|
30
|
+
*/
|
|
31
|
+
export declare function PinInput({ label, 'aria-label': ariaLabel, fillType, size, slotLabel, className, id, length, ...props }: PinInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
2
|
+
import '../Menu/menu.css';
|
|
3
|
+
import './popover.css';
|
|
4
|
+
export type PopoverProps = BasePopover.Root.Props & {
|
|
5
|
+
/**
|
|
6
|
+
* Grow the popover out of its trigger, and shrink it back into it on
|
|
7
|
+
* close, like an avatar opening into a profile card. @default false
|
|
8
|
+
*/
|
|
9
|
+
morph?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A floating panel anchored to its trigger, for content users interact with
|
|
13
|
+
* (forms, details). Holds the open state: `open` / `defaultOpen` /
|
|
14
|
+
* `onOpenChange`. Parts: `PopoverTrigger`, `PopoverPopup` (includes portal
|
|
15
|
+
* and positioner; takes `side` / `align`), `PopoverTitle`,
|
|
16
|
+
* `PopoverDescription`, `PopoverClose`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Popover>
|
|
20
|
+
* <PopoverTrigger render={<IconButton icon="info" aria-label="Details" />} />
|
|
21
|
+
* <PopoverPopup side="bottom" align="start">
|
|
22
|
+
* <PopoverTitle>Details</PopoverTitle>
|
|
23
|
+
* <PopoverDescription>Last edited today.</PopoverDescription>
|
|
24
|
+
* </PopoverPopup>
|
|
25
|
+
* </Popover>
|
|
26
|
+
*/
|
|
27
|
+
export declare function Popover({ morph, defaultOpen, ...props }: PopoverProps): import("react").JSX.Element;
|
|
28
|
+
export type PopoverTriggerProps = BasePopover.Trigger.Props;
|
|
29
|
+
/** Opens the popover. Renders a bare `<button>`; pass `render={<Button />}` to use the library's. */
|
|
30
|
+
export declare function PopoverTrigger({ className, ref, ...props }: PopoverTriggerProps): import("react").JSX.Element;
|
|
31
|
+
/** The panel. Also renders the portal and positioner, so it takes their placement props. */
|
|
32
|
+
export type PopoverPopupProps = BasePopover.Popup.Props & Pick<BasePopover.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>;
|
|
33
|
+
/** The panel. Takes `side`, `align`, `sideOffset`, `alignOffset` and `anchor`. */
|
|
34
|
+
export declare function PopoverPopup({ anchor, side, align, sideOffset, alignOffset, className, ref, ...props }: PopoverPopupProps): import("react").JSX.Element;
|
|
35
|
+
export type PopoverTitleProps = BasePopover.Title.Props;
|
|
36
|
+
/**
|
|
37
|
+
* Names the popup for screen readers. Renders an `<h2>`; pass
|
|
38
|
+
* `render={<h3 />}` (or another level) to fit the page's headings.
|
|
39
|
+
*/
|
|
40
|
+
export declare function PopoverTitle({ className, ...props }: PopoverTitleProps): import("react").JSX.Element;
|
|
41
|
+
export type PopoverDescriptionProps = BasePopover.Description.Props;
|
|
42
|
+
/** Supporting text in the popover. */
|
|
43
|
+
export declare function PopoverDescription({ className, ...props }: PopoverDescriptionProps): import("react").JSX.Element;
|
|
44
|
+
export type PopoverCloseProps = BasePopover.Close.Props;
|
|
45
|
+
/**
|
|
46
|
+
* Closes the popover. Renders a bare `<button>`; pass `render={<Button />}`
|
|
47
|
+
* or `render={<IconButton ... />}` to use the library's.
|
|
48
|
+
*/
|
|
49
|
+
export declare function PopoverClose({ className, ...props }: PopoverCloseProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
2
|
+
import '../Menu/menu.css';
|
|
3
|
+
import '../Popover/popover.css';
|
|
4
|
+
import './preview-card.css';
|
|
5
|
+
/**
|
|
6
|
+
* A card that appears while hovering or focusing a link, showing a preview of
|
|
7
|
+
* where it goes. Put a `PreviewCardTrigger` and a `PreviewCardPopup` inside.
|
|
8
|
+
* Hover-only, so the popup must not hold anything a user needs to reach;
|
|
9
|
+
* use `Popover` for that.
|
|
10
|
+
*/
|
|
11
|
+
export type PreviewCardProps = BasePreviewCard.Root.Props;
|
|
12
|
+
/**
|
|
13
|
+
* A card shown while hovering or focusing a link. Use `Popover` if the
|
|
14
|
+
* content has anything to click.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <PreviewCard>
|
|
18
|
+
* <PreviewCardTrigger href="/users/ada">@ada</PreviewCardTrigger>
|
|
19
|
+
* <PreviewCardPopup>Ada Lovelace, 12 posts</PreviewCardPopup>
|
|
20
|
+
* </PreviewCard>
|
|
21
|
+
*/
|
|
22
|
+
export declare function PreviewCard(props: PreviewCardProps): import("react").JSX.Element;
|
|
23
|
+
export type PreviewCardTriggerProps = BasePreviewCard.Trigger.Props;
|
|
24
|
+
/**
|
|
25
|
+
* The link. Renders an `<a>`, so give it `href`; pass `render={<Link />}`
|
|
26
|
+
* for a router link. `delay` / `closeDelay` set the hover timing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function PreviewCardTrigger({ className, ...props }: PreviewCardTriggerProps): import("react").JSX.Element;
|
|
29
|
+
export type PreviewCardPopupProps = BasePreviewCard.Popup.Props & Pick<BasePreviewCard.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset'>;
|
|
30
|
+
/** The card. Also renders the portal and positioner; takes `side` / `align`. */
|
|
31
|
+
export declare function PreviewCardPopup({ side, align, sideOffset, alignOffset, className, ...props }: PreviewCardPopupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Progress as BaseProgress } from '@base-ui/react/progress';
|
|
3
|
+
import './progress.css';
|
|
4
|
+
export type ProgressProps = BaseProgress.Root.Props & {
|
|
5
|
+
/**
|
|
6
|
+
* A bar, a ring, or a small ring the size of the surrounding text, to
|
|
7
|
+
* place inside a line of text. @default 'linear'
|
|
8
|
+
*/
|
|
9
|
+
type?: 'linear' | 'circular' | 'inline';
|
|
10
|
+
/** Draw the filled part of a linear bar as a moving wave. @default false */
|
|
11
|
+
squiggly?: boolean;
|
|
12
|
+
} & ({
|
|
13
|
+
/** Visible label above the indicator. */
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
'aria-label'?: never;
|
|
16
|
+
} | {
|
|
17
|
+
label?: never;
|
|
18
|
+
/** Accessible name, when there's no visible `label`. */
|
|
19
|
+
'aria-label': string;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Shows how far along a task is: `value` from 0 to 100 (or `min`/`max`).
|
|
23
|
+
* Pass `value={null}` while the amount of work is unknown.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <Progress label="Uploading" value={progress} />
|
|
27
|
+
* <Progress type="circular" aria-label="Loading" value={null} />
|
|
28
|
+
*/
|
|
29
|
+
export declare function Progress({ type, squiggly, label, className, style, children, ...props }: ProgressProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
|
|
3
|
+
import './radio-group.css';
|
|
4
|
+
export type RadioGroupProps<Value = any> = BaseRadioGroup.Props<Value>;
|
|
5
|
+
/**
|
|
6
|
+
* A group of `Radio`s where exactly one is picked. State: `value` /
|
|
7
|
+
* `defaultValue` / `onValueChange` on the group; each `Radio` has a `value`.
|
|
8
|
+
* Give the group an `aria-label` or `aria-labelledby`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <RadioGroup aria-label="Plan" defaultValue="free">
|
|
12
|
+
* <label><Radio value="free" /> Free</label>
|
|
13
|
+
* <label><Radio value="pro" /> Pro</label>
|
|
14
|
+
* </RadioGroup>
|
|
15
|
+
*/
|
|
16
|
+
export declare function RadioGroup<Value>({ className, ...props }: RadioGroupProps<Value>): import("react").JSX.Element;
|
|
17
|
+
export type RadioProps<Value = any> = BaseRadio.Root.Props<Value>;
|
|
18
|
+
/** One option in a `RadioGroup`. Needs a `value`. Wrap it in a `<label>` with its text. */
|
|
19
|
+
export declare function Radio<Value>({ className, ...props }: RadioProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete';
|
|
3
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import './search.css';
|
|
6
|
+
export type SearchProps<Item> = Omit<BaseAutocomplete.Root.Props<Item>, 'children' | 'items'> & {
|
|
7
|
+
/** The suggestions. Filtered against what's typed. */
|
|
8
|
+
items?: readonly Item[];
|
|
9
|
+
/** Renders each suggestion, e.g. `(item) => <SearchItem key={item} value={item}>{item}</SearchItem>`. */
|
|
10
|
+
children: (item: Item, index: number) => ReactNode;
|
|
11
|
+
/** Hint text inside the bar, e.g. "Search mail". */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** There's no visible label, so the input needs a name for screen readers. */
|
|
14
|
+
'aria-label': string;
|
|
15
|
+
/** Shown in the popup when nothing matches. Without it, the popup hides. */
|
|
16
|
+
empty?: ReactNode;
|
|
17
|
+
/** Accessible name of the clear button. @default 'Clear' */
|
|
18
|
+
clearLabel?: string;
|
|
19
|
+
/** Applied to the bar, so width and margins work as expected. */
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Material 3 search bar with a list of suggestions under it. Pass `items`
|
|
24
|
+
* and it filters them as you type. The typed text is `value` /
|
|
25
|
+
* `defaultValue` / `onValueChange`. Children must be a function that renders
|
|
26
|
+
* one suggestion.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <Search aria-label="Search mail" placeholder="Search mail" items={recent} value={query} onValueChange={setQuery}>
|
|
30
|
+
* {(item: string) => <SearchItem key={item} value={item} startIcon="history">{item}</SearchItem>}
|
|
31
|
+
* </Search>
|
|
32
|
+
*/
|
|
33
|
+
export declare function Search<Item>({ children, placeholder, 'aria-label': ariaLabel, empty, clearLabel, className, ...props }: SearchProps<Item>): import("react").JSX.Element;
|
|
34
|
+
export type SearchItemProps = BaseAutocomplete.Item.Props & {
|
|
35
|
+
/** Material Symbol before the text, e.g. `history` for a recent search. */
|
|
36
|
+
startIcon?: MaterialSymbol;
|
|
37
|
+
};
|
|
38
|
+
/** One suggestion in a `Search`. Needs a `value`. Picking it fills the bar with its text. */
|
|
39
|
+
export declare function SearchItem({ startIcon, className, children, ...props }: SearchItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
|
+
import '../Input/input.css';
|
|
4
|
+
import '../Menu/menu.css';
|
|
5
|
+
import './select.css';
|
|
6
|
+
export type SelectProps<Value, Multiple extends boolean | undefined = false> = BaseSelect.Root.Props<Value, Multiple> & {
|
|
7
|
+
/** Floating label. Sits inside the field and moves onto the border once it's focused or has a value. */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** Shown when nothing is selected. With a `label`, only once the label has moved up. */
|
|
10
|
+
placeholder?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* `small` is shorter, and its label works like a placeholder: it hides
|
|
13
|
+
* once a value is selected instead of moving onto the border. @default 'normal'
|
|
14
|
+
*/
|
|
15
|
+
size?: 'small' | 'normal';
|
|
16
|
+
/** Applied to the outer wrapper, so width and margins work as expected. */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A dropdown to pick one option (or several, with `multiple`). Put
|
|
21
|
+
* `SelectItem`s inside. Pass `items` (value → label) so the field shows the
|
|
22
|
+
* selected item's label rather than its raw value. `onValueChange` gets the
|
|
23
|
+
* value, not an event. Other props go to Base UI's `Select.Root`, which
|
|
24
|
+
* renders no element: use `className` for styling the field.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const fruits = { apple: 'Apple', banana: 'Banana' }
|
|
28
|
+
*
|
|
29
|
+
* <Select label="Fruit" items={fruits} value={fruit} onValueChange={setFruit}>
|
|
30
|
+
* {Object.entries(fruits).map(([value, label]) => (
|
|
31
|
+
* <SelectItem key={value} value={value}>{label}</SelectItem>
|
|
32
|
+
* ))}
|
|
33
|
+
* </Select>
|
|
34
|
+
*/
|
|
35
|
+
export declare function Select<Value, Multiple extends boolean | undefined = false>({ label, placeholder, size, className, children, ...props }: SelectProps<Value, Multiple>): import("react").JSX.Element;
|
|
36
|
+
export type SelectItemProps = BaseSelect.Item.Props;
|
|
37
|
+
/** One option in a `Select`. Needs a `value`; children are its label. */
|
|
38
|
+
export declare function SelectItem({ className, children, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './skeleton.css';
|
|
2
|
+
export type SkeletonProps = React.ComponentProps<'span'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Shape of the placeholder: a line of text, a circle (avatars, icons) or
|
|
5
|
+
* a rounded box (images, cards). Set the size with `style`.
|
|
6
|
+
* @default 'text'
|
|
7
|
+
*/
|
|
8
|
+
variant?: 'text' | 'circular' | 'rectangular';
|
|
9
|
+
/** Fades in and out while loading. @default 'pulse' */
|
|
10
|
+
animation?: 'pulse' | 'none';
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A placeholder shown while content loads. It's hidden from screen readers:
|
|
14
|
+
* put `aria-busy` on the region that's loading.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Skeleton variant="circular" style={{ width: 40, height: 40 }} />
|
|
18
|
+
* <Skeleton style={{ width: '60%' }} />
|
|
19
|
+
*/
|
|
20
|
+
export declare function Skeleton({ variant, animation, className, ...props }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
3
|
+
import '../Tooltip/tooltip.css';
|
|
4
|
+
import './slider.css';
|
|
5
|
+
export type SliderProps<Value extends number | readonly number[] = number | readonly number[]> = BaseSlider.Root.Props<Value> & {
|
|
6
|
+
/** Show the value in a bubble above the handle while it's dragged or focused. @default true */
|
|
7
|
+
showValue?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Thin track with the selected part drawn as a moving wave, like a
|
|
10
|
+
* squiggly `Progress`. Horizontal only. @default false
|
|
11
|
+
*/
|
|
12
|
+
squiggly?: boolean;
|
|
13
|
+
} & ({
|
|
14
|
+
/** Visible label above the slider. */
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
'aria-label'?: never;
|
|
17
|
+
} | {
|
|
18
|
+
label?: never;
|
|
19
|
+
/** Accessible name, when there's no visible `label`. */
|
|
20
|
+
'aria-label': string;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Pass an array as `value` / `defaultValue` for a range with several handles.
|
|
24
|
+
* `orientation="vertical"` is 160px tall by default; set a height via `className`.
|
|
25
|
+
* `onValueChange` gets a number (or an array for a range), not an event.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Slider label="Volume" defaultValue={50} />
|
|
29
|
+
* <Slider aria-label="Price" value={range} onValueChange={setRange} min={0} max={500} />
|
|
30
|
+
*/
|
|
31
|
+
export declare function Slider<Value extends number | readonly number[]>({ label, 'aria-label': ariaLabel, showValue, squiggly, className, ...props }: SliderProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './snackbar.css';
|
|
3
|
+
export type SnackbarOptions = {
|
|
4
|
+
/** The text shown. Keep it to a line or two. */
|
|
5
|
+
message: ReactNode;
|
|
6
|
+
/** One text button, like "Undo". Clicking it also closes the snackbar. */
|
|
7
|
+
action?: {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
/** Show a close (×) button. @default false */
|
|
12
|
+
closeButton?: boolean;
|
|
13
|
+
/** Milliseconds before it closes on its own; `0` keeps it open. @default 5000 */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** `high` makes screen readers announce it right away. @default 'low' */
|
|
16
|
+
priority?: 'low' | 'high';
|
|
17
|
+
/** Called once it has closed, however that happened. */
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Shows snackbars (toasts). There is no Snackbar or Toast component to
|
|
22
|
+
* render: AnvilRoot already renders the viewport. Works anywhere inside
|
|
23
|
+
* `AnvilRoot`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const snackbar = useSnackbar()
|
|
27
|
+
* snackbar.show({ message: 'Deleted', action: { label: 'Undo', onClick: undo } })
|
|
28
|
+
*/
|
|
29
|
+
export declare function useSnackbar(): {
|
|
30
|
+
/** Shows a snackbar at the bottom; open ones move up. Returns its id. */
|
|
31
|
+
show: ({ message, action, closeButton, ...options }: SnackbarOptions) => string;
|
|
32
|
+
/** Closes one snackbar by id, or all of them. */
|
|
33
|
+
close: (toastId?: string) => void;
|
|
34
|
+
};
|
|
35
|
+
export declare function SnackbarViewport(): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './split-button.css';
|
|
2
|
+
export type SplitButtonProps = React.ComponentProps<'div'>;
|
|
3
|
+
/**
|
|
4
|
+
* Joins `Button`s (and `IconButton`s) into one segmented group with shared
|
|
5
|
+
* rounded ends. Style each button yourself; the group only lays them out.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <SplitButton>
|
|
9
|
+
* <Button>Save</Button>
|
|
10
|
+
* <Menu>
|
|
11
|
+
* <MenuTrigger render={<IconButton icon="arrow_drop_down" aria-label="More save options" />} />
|
|
12
|
+
* <MenuPopup>...</MenuPopup>
|
|
13
|
+
* </Menu>
|
|
14
|
+
* </SplitButton>
|
|
15
|
+
*/
|
|
16
|
+
export declare function SplitButton({ className, ...props }: SplitButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './squiggly-wave.css';
|
|
2
|
+
/** What to draw this frame, in px from the start of the track. */
|
|
3
|
+
export type WaveSpan = {
|
|
4
|
+
/** Where the wave starts and ends (round caps included). */
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
/** Flat track pieces to draw alongside it, as [start, end] pairs. */
|
|
8
|
+
rest?: [number, number][];
|
|
9
|
+
/** Draw the `rest` pieces as waves in step with the main one, not flat. */
|
|
10
|
+
restWave?: boolean;
|
|
11
|
+
/** Draw the stop dot at the far end. */
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
/** Jump straight to `from`/`to` instead of easing toward them. */
|
|
14
|
+
snap?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type SquigglyWaveProps = {
|
|
17
|
+
/**
|
|
18
|
+
* Called every frame with the track width, `--avl-wave-gap` in px, the
|
|
19
|
+
* SVG and the frame time. Reads its inputs fresh each time, so it can
|
|
20
|
+
* follow things that move between renders, like a dragged handle.
|
|
21
|
+
*/
|
|
22
|
+
span: (width: number, gap: number, svg: SVGSVGElement, now: number) => WaveSpan;
|
|
23
|
+
/**
|
|
24
|
+
* Hold the wave still and only redraw when the size changes, for spans
|
|
25
|
+
* that never move. @default false
|
|
26
|
+
*/
|
|
27
|
+
still?: boolean;
|
|
28
|
+
/** Run top to bottom instead of left to right. @default false */
|
|
29
|
+
vertical?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One continuous wave drawn to an exact length, so it has no seams and gets
|
|
33
|
+
* round ends. Redrawn every frame to ripple and to ease toward its new span;
|
|
34
|
+
* with reduced motion it holds still and jumps.
|
|
35
|
+
*/
|
|
36
|
+
export declare function SquigglyWave(props: SquigglyWaveProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import { type ComponentColor } from '../../colors/colors';
|
|
4
|
+
import './sticker.css';
|
|
5
|
+
export type StickerProps = ComponentProps<'span'> & {
|
|
6
|
+
/** Color role from the theme. @default 'primary' */
|
|
7
|
+
color?: ComponentColor;
|
|
8
|
+
/** Material Symbol before the text. */
|
|
9
|
+
startIcon?: MaterialSymbol;
|
|
10
|
+
/** How far it's tilted, in degrees. Negative leans left. @default -4 */
|
|
11
|
+
tilt?: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A small tilted label that looks like a die-cut sticker ("NEW", "BETA",
|
|
15
|
+
* "50% off"). Straightens up on hover. Purely visual: its text is read
|
|
16
|
+
* like any other text.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <Sticker color="warning" startIcon="bolt">NEW</Sticker>
|
|
20
|
+
*/
|
|
21
|
+
export declare function Sticker({ color, startIcon, tilt, className, style, children, ...props }: StickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
2
|
+
import './switch.css';
|
|
3
|
+
export type SwitchProps = BaseSwitch.Root.Props;
|
|
4
|
+
/**
|
|
5
|
+
* An on/off switch. State: `checked` / `defaultChecked` / `onCheckedChange`.
|
|
6
|
+
* It has no `label` prop: wrap it in a `<label>`, or put it in a `ListItem`'s
|
|
7
|
+
* `end` with `render={<label />}`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
|
11
|
+
* <Switch checked={wifi} onCheckedChange={setWifi} />
|
|
12
|
+
* Wi-Fi
|
|
13
|
+
* </label>
|
|
14
|
+
*/
|
|
15
|
+
export declare function Switch({ className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './table.css';
|
|
2
|
+
export type TableProps = React.ComponentProps<'table'>;
|
|
3
|
+
/**
|
|
4
|
+
* A styled HTML table. Each part renders its native element (`TableHead` is
|
|
5
|
+
* `<thead>`, `TableHeaderCell` is `<th>`), so it has no sorting or paging.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Table>
|
|
9
|
+
* <TableCaption>Invoices</TableCaption>
|
|
10
|
+
* <TableHead>
|
|
11
|
+
* <TableRow><TableHeaderCell>Number</TableHeaderCell><TableHeaderCell>Total</TableHeaderCell></TableRow>
|
|
12
|
+
* </TableHead>
|
|
13
|
+
* <TableBody>
|
|
14
|
+
* <TableRow><TableCell>#1001</TableCell><TableCell>$40</TableCell></TableRow>
|
|
15
|
+
* </TableBody>
|
|
16
|
+
* </Table>
|
|
17
|
+
*/
|
|
18
|
+
export declare function Table({ className, ...props }: TableProps): import("react").JSX.Element;
|
|
19
|
+
export type TableCaptionProps = React.ComponentProps<'caption'>;
|
|
20
|
+
/** The table's accessible name. Without one, give `Table` an `aria-label`. */
|
|
21
|
+
export declare function TableCaption({ className, ...props }: TableCaptionProps): import("react").JSX.Element;
|
|
22
|
+
export type TableHeadProps = React.ComponentProps<'thead'>;
|
|
23
|
+
/** `<thead>`: the header rows. */
|
|
24
|
+
export declare function TableHead({ className, ...props }: TableHeadProps): import("react").JSX.Element;
|
|
25
|
+
export type TableBodyProps = React.ComponentProps<'tbody'>;
|
|
26
|
+
/** `<tbody>`: the data rows. */
|
|
27
|
+
export declare function TableBody({ className, ...props }: TableBodyProps): import("react").JSX.Element;
|
|
28
|
+
export type TableRowProps = React.ComponentProps<'tr'>;
|
|
29
|
+
/** `<tr>`. */
|
|
30
|
+
export declare function TableRow({ className, ...props }: TableRowProps): import("react").JSX.Element;
|
|
31
|
+
export type TableHeaderCellProps = React.ComponentProps<'th'>;
|
|
32
|
+
/** `<th>`, with `scope="col"` by default; pass `scope="row"` for a header at the start of a row. */
|
|
33
|
+
export declare function TableHeaderCell({ scope, className, ...props }: TableHeaderCellProps): import("react").JSX.Element;
|
|
34
|
+
export type TableCellProps = React.ComponentProps<'td'>;
|
|
35
|
+
/** `<td>`. */
|
|
36
|
+
export declare function TableCell({ className, ...props }: TableCellProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
2
|
+
import type { MaterialSymbol } from 'material-symbols';
|
|
3
|
+
import './tabs.css';
|
|
4
|
+
/** Holds the selected tab: `value` / `defaultValue` / `onValueChange`. Horizontal only. */
|
|
5
|
+
export type TabsProps = Omit<BaseTabs.Root.Props, 'orientation'>;
|
|
6
|
+
/**
|
|
7
|
+
* Tabs. Put a `TabsList` of `TabsTab`s, then one `TabsPanel` per tab with
|
|
8
|
+
* the same `value`. There is no TabsTrigger or TabsContent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Tabs defaultValue="account">
|
|
12
|
+
* <TabsList>
|
|
13
|
+
* <TabsTab value="account">Account</TabsTab>
|
|
14
|
+
* <TabsTab value="billing">Billing</TabsTab>
|
|
15
|
+
* </TabsList>
|
|
16
|
+
* <TabsPanel value="account">...</TabsPanel>
|
|
17
|
+
* <TabsPanel value="billing">...</TabsPanel>
|
|
18
|
+
* </Tabs>
|
|
19
|
+
*/
|
|
20
|
+
export declare function Tabs({ className, ...props }: TabsProps): import("react").JSX.Element;
|
|
21
|
+
export type TabsListProps = BaseTabs.List.Props;
|
|
22
|
+
/** The row of tabs. Draws the sliding underline under the selected one. */
|
|
23
|
+
export declare function TabsList({ className, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
24
|
+
export type TabsTabProps = BaseTabs.Tab.Props & {
|
|
25
|
+
/** Material Symbol shown above the label. */
|
|
26
|
+
icon?: MaterialSymbol;
|
|
27
|
+
};
|
|
28
|
+
/** One tab button. Give it a `value` matching its `TabsPanel`. */
|
|
29
|
+
export declare function TabsTab({ icon, className, children, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
30
|
+
export type TabsPanelProps = BaseTabs.Panel.Props;
|
|
31
|
+
/** Content for one tab: give it the same `value` as its `TabsTab`. */
|
|
32
|
+
export declare function TabsPanel({ className, ...props }: TabsPanelProps): import("react").JSX.Element;
|