anvilui 0.1.0 → 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.
Files changed (142) hide show
  1. package/AGENTS.md +483 -0
  2. package/README.md +70 -3
  3. package/bin/anvilui.mjs +83 -0
  4. package/dist/colors/colors.d.ts +10 -2
  5. package/dist/components/Accordion/Accordion.d.ts +36 -0
  6. package/dist/components/AnimatedNumber/AnimatedNumber.d.ts +17 -0
  7. package/dist/components/AnvilRoot/AnvilContext.d.ts +22 -2
  8. package/dist/components/AnvilRoot/AnvilRoot.d.ts +44 -6
  9. package/dist/components/AppBar/AppBar.d.ts +13 -2
  10. package/dist/components/Avatar/Avatar.d.ts +6 -2
  11. package/dist/components/Avatar/AvatarGroupContext.d.ts +1 -0
  12. package/dist/components/AvatarGroup/AvatarGroup.d.ts +25 -0
  13. package/dist/components/Badge/Badge.d.ts +4 -0
  14. package/dist/components/BottomSheet/BottomSheet.d.ts +22 -0
  15. package/dist/components/Button/Button.d.ts +17 -0
  16. package/dist/components/Calendar/Calendar.d.ts +19 -0
  17. package/dist/components/Card/Card.d.ts +36 -0
  18. package/dist/components/Carousel/Carousel.d.ts +21 -0
  19. package/dist/components/Checkbox/Checkbox.d.ts +10 -0
  20. package/dist/components/Chip/Chip.d.ts +25 -2
  21. package/dist/components/Combobox/Combobox.d.ts +42 -0
  22. package/dist/components/Confetti/Confetti.d.ts +31 -0
  23. package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
  24. package/dist/components/DateInput/DateInput.d.ts +37 -0
  25. package/dist/components/Dialog/Dialog.d.ts +32 -0
  26. package/dist/components/Divider/Divider.d.ts +8 -0
  27. package/dist/components/FAB/FAB.d.ts +4 -0
  28. package/dist/components/FAB/magnet.d.ts +2 -0
  29. package/dist/components/FABMenu/FABMenu.d.ts +55 -0
  30. package/dist/components/Field/Field.d.ts +20 -0
  31. package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +15 -0
  32. package/dist/components/HoldButton/HoldButton.d.ts +4 -1
  33. package/dist/components/Icon/Icon.d.ts +14 -0
  34. package/dist/components/IconButton/IconButton.d.ts +11 -0
  35. package/dist/components/Input/Input.d.ts +9 -0
  36. package/dist/components/Kbd/Kbd.d.ts +21 -0
  37. package/dist/components/List/List.d.ts +10 -1
  38. package/dist/components/Menu/Menu.d.ts +32 -0
  39. package/dist/components/Menubar/Menubar.d.ts +17 -0
  40. package/dist/components/NavigationBar/NavigationBar.d.ts +10 -0
  41. package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +22 -0
  42. package/dist/components/NavigationList/NavigationList.d.ts +27 -0
  43. package/dist/components/NavigationRail/NavigationRail.d.ts +25 -9
  44. package/dist/components/PinInput/PinInput.d.ts +31 -0
  45. package/dist/components/Popover/Popover.d.ts +30 -2
  46. package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
  47. package/dist/components/Progress/Progress.d.ts +8 -1
  48. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
  49. package/dist/components/Search/Search.d.ts +39 -0
  50. package/dist/components/Select/Select.d.ts +15 -2
  51. package/dist/components/Skeleton/Skeleton.d.ts +20 -0
  52. package/dist/components/Slider/Slider.d.ts +5 -0
  53. package/dist/components/Snackbar/Snackbar.d.ts +7 -2
  54. package/dist/components/SplitButton/SplitButton.d.ts +13 -0
  55. package/dist/components/Sticker/Sticker.d.ts +21 -0
  56. package/dist/components/Switch/Switch.d.ts +11 -0
  57. package/dist/components/Table/Table.d.ts +36 -0
  58. package/dist/components/Tabs/Tabs.d.ts +17 -0
  59. package/dist/components/Textarea/Textarea.d.ts +8 -0
  60. package/dist/components/TimePicker/TimePicker.d.ts +45 -0
  61. package/dist/components/Toggle/Toggle.d.ts +41 -0
  62. package/dist/components/ToggleGroup/ToggleGroup.d.ts +14 -2
  63. package/dist/components/Tooltip/Tooltip.d.ts +10 -1
  64. package/dist/components/Typography/Typography.d.ts +13 -1
  65. package/dist/datetime.d.ts +12 -0
  66. package/dist/dev.d.ts +15 -0
  67. package/dist/index.cjs +3105 -634
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.css +1417 -364
  70. package/dist/index.css.map +1 -1
  71. package/dist/index.d.ts +50 -4
  72. package/dist/index.js +3038 -591
  73. package/dist/index.js.map +1 -1
  74. package/dist/themes/baseTheme.d.ts +2 -0
  75. package/dist/themes/createTheme.d.ts +22 -0
  76. package/dist/themes/monochromeTheme.d.ts +2 -0
  77. package/dist/themes/types.d.ts +15 -6
  78. package/dist/tokens/baseTokens.d.ts +4 -0
  79. package/dist/tokens/types.d.ts +34 -0
  80. package/docs/accordion.md +47 -0
  81. package/docs/animated-number.md +31 -0
  82. package/docs/app-bar.md +53 -0
  83. package/docs/avatar-group.md +35 -0
  84. package/docs/avatar.md +34 -0
  85. package/docs/badge.md +41 -0
  86. package/docs/bottom-sheet.md +65 -0
  87. package/docs/button.md +63 -0
  88. package/docs/calendar.md +26 -0
  89. package/docs/card.md +71 -0
  90. package/docs/carousel.md +43 -0
  91. package/docs/checkbox.md +37 -0
  92. package/docs/chip.md +48 -0
  93. package/docs/combobox.md +72 -0
  94. package/docs/composition.md +80 -0
  95. package/docs/confetti.md +30 -0
  96. package/docs/context-menu.md +42 -0
  97. package/docs/date-input.md +41 -0
  98. package/docs/dialog.md +106 -0
  99. package/docs/divider.md +31 -0
  100. package/docs/fab-menu.md +55 -0
  101. package/docs/fab.md +43 -0
  102. package/docs/field.md +59 -0
  103. package/docs/floating-toolbar.md +48 -0
  104. package/docs/forms.md +81 -0
  105. package/docs/hold-button.md +32 -0
  106. package/docs/icon-button.md +54 -0
  107. package/docs/icons.md +38 -0
  108. package/docs/input.md +50 -0
  109. package/docs/kbd.md +25 -0
  110. package/docs/list.md +65 -0
  111. package/docs/llms-index.md +82 -0
  112. package/docs/menu.md +88 -0
  113. package/docs/menubar.md +34 -0
  114. package/docs/morph.md +51 -0
  115. package/docs/navigation-bar.md +48 -0
  116. package/docs/navigation-drawer.md +72 -0
  117. package/docs/navigation-list.md +40 -0
  118. package/docs/navigation-rail.md +53 -0
  119. package/docs/pin-input.md +38 -0
  120. package/docs/popover.md +78 -0
  121. package/docs/preview-card.md +40 -0
  122. package/docs/progress.md +37 -0
  123. package/docs/radio-group.md +47 -0
  124. package/docs/search.md +77 -0
  125. package/docs/select.md +64 -0
  126. package/docs/setup.md +106 -0
  127. package/docs/skeleton.md +33 -0
  128. package/docs/slider.md +49 -0
  129. package/docs/snackbar.md +50 -0
  130. package/docs/split-button.md +44 -0
  131. package/docs/sticker.md +27 -0
  132. package/docs/switch.md +44 -0
  133. package/docs/table.md +66 -0
  134. package/docs/tabs.md +51 -0
  135. package/docs/textarea.md +23 -0
  136. package/docs/theming.md +182 -0
  137. package/docs/time-picker.md +38 -0
  138. package/docs/toggle-group.md +70 -0
  139. package/docs/toggle.md +49 -0
  140. package/docs/tooltip.md +42 -0
  141. package/docs/typography.md +41 -0
  142. package/package.json +25 -5
@@ -0,0 +1,48 @@
1
+ # NavigationBar
2
+
3
+ Bottom navigation for small screens: 3–5 top-level destinations. You position it (e.g. `position: sticky; bottom: 0`).
4
+
5
+ ```ts
6
+ import { NavigationBar, NavigationBarItem } from 'anvilui'
7
+ ```
8
+
9
+ | Part | Renders | Props |
10
+ | --- | --- | --- |
11
+ | `NavigationBar` | `<nav>` | Give it `aria-label`. |
12
+ | `NavigationBarItem` | `<a>` | `icon: MaterialSymbol` (required), `label: string` (required), `active?: boolean` (sets `aria-current="page"`), `href`, `render` (router link) |
13
+
14
+ Items are links, not tabs: there's no `value` / `onValueChange`. Mark the current one with `active`.
15
+
16
+ ```tsx
17
+ import { NavigationBar, NavigationBarItem } from 'anvilui'
18
+
19
+ export function Example({ path }: { path: string }) {
20
+ return (
21
+ <NavigationBar
22
+ aria-label="Main"
23
+ style={{ position: 'sticky', bottom: 0 }}
24
+ >
25
+ <NavigationBarItem
26
+ icon="home"
27
+ label="Home"
28
+ href="/"
29
+ active={path === '/'}
30
+ />
31
+ <NavigationBarItem
32
+ icon="search"
33
+ label="Search"
34
+ href="/search"
35
+ active={path === '/search'}
36
+ />
37
+ <NavigationBarItem
38
+ icon="person"
39
+ label="Profile"
40
+ href="/profile"
41
+ active={path === '/profile'}
42
+ />
43
+ </NavigationBar>
44
+ )
45
+ }
46
+ ```
47
+
48
+ With React Router: `<NavigationBarItem icon="home" label="Home" render={<Link to="/" />} active={...} />`. For client-side state instead of URLs, use `render={<button type="button" onClick={...} />}`.
@@ -0,0 +1,72 @@
1
+ # NavigationDrawer
2
+
3
+ Side navigation that slides in over the page, for small screens.
4
+
5
+ ```ts
6
+ import {
7
+ NavigationDrawer,
8
+ NavigationDrawerTrigger,
9
+ NavigationDrawerPopup,
10
+ NavigationDrawerTitle,
11
+ NavigationDrawerItem,
12
+ } from 'anvilui'
13
+ ```
14
+
15
+ | Part | Renders | Props |
16
+ | --- | --- | --- |
17
+ | `NavigationDrawer` | nothing (state) | `open` / `defaultOpen` / `onOpenChange` |
18
+ | `NavigationDrawerTrigger` | bare `<button>` | `render={<IconButton icon="menu" aria-label="Open navigation" />}` |
19
+ | `NavigationDrawerPopup` | portal + backdrop + panel | Put the title first, then items. |
20
+ | `NavigationDrawerTitle` | `<h2>` | Names the drawer. |
21
+ | `NavigationDrawerItem` | `<a>` that closes the drawer | `icon` (required), `label: string` (required), `active`, `end: ReactNode` (e.g. a count), `href`, `render` |
22
+
23
+ For in-page switching: `render={<button type="button" onClick={() => setView('trash')} />}`; it still closes the drawer.
24
+
25
+ ```tsx
26
+ import {
27
+ AppBar,
28
+ IconButton,
29
+ NavigationDrawer,
30
+ NavigationDrawerItem,
31
+ NavigationDrawerPopup,
32
+ NavigationDrawerTitle,
33
+ NavigationDrawerTrigger,
34
+ } from 'anvilui'
35
+
36
+ export function Example() {
37
+ return (
38
+ <AppBar
39
+ label="Mail"
40
+ start={
41
+ <NavigationDrawer>
42
+ <NavigationDrawerTrigger
43
+ render={
44
+ <IconButton
45
+ icon="menu"
46
+ aria-label="Open navigation"
47
+ fillType="text"
48
+ color="container"
49
+ />
50
+ }
51
+ />
52
+ <NavigationDrawerPopup>
53
+ <NavigationDrawerTitle>Mail</NavigationDrawerTitle>
54
+ <NavigationDrawerItem
55
+ icon="inbox"
56
+ label="Inbox"
57
+ href="/inbox"
58
+ active
59
+ end="12"
60
+ />
61
+ <NavigationDrawerItem
62
+ icon="send"
63
+ label="Sent"
64
+ href="/sent"
65
+ />
66
+ </NavigationDrawerPopup>
67
+ </NavigationDrawer>
68
+ }
69
+ />
70
+ )
71
+ }
72
+ ```
@@ -0,0 +1,40 @@
1
+ # NavigationList
2
+
3
+ A column of text-only navigation links, like a docs or settings sidebar.
4
+
5
+ ```ts
6
+ import { NavigationList, NavigationListItem } from 'anvilui'
7
+ ```
8
+
9
+ | Part | Renders | Props |
10
+ | --- | --- | --- |
11
+ | `NavigationList` | `<nav>` | `aria-label` |
12
+ | `NavigationListItem` | `<a>` | `label: string` (required; not children), `active`, `href`, `render` |
13
+
14
+ ```tsx
15
+ import { NavigationList, NavigationListItem } from 'anvilui'
16
+
17
+ export function SettingsNav({ section }: { section: string }) {
18
+ return (
19
+ <NavigationList aria-label="Settings">
20
+ <NavigationListItem
21
+ label="Profile"
22
+ href="#profile"
23
+ active={section === 'profile'}
24
+ />
25
+ <NavigationListItem
26
+ label="Notifications"
27
+ href="#notifications"
28
+ active={section === 'notifications'}
29
+ />
30
+ <NavigationListItem
31
+ label="Billing"
32
+ href="#billing"
33
+ active={section === 'billing'}
34
+ />
35
+ </NavigationList>
36
+ )
37
+ }
38
+ ```
39
+
40
+ For in-page switching without URLs: `render={<button type="button" onClick={() => setSection('billing')} />}`.
@@ -0,0 +1,53 @@
1
+ # NavigationRail
2
+
3
+ Side navigation for medium and large screens. Collapsed: icons with small labels; expanded: labels beside icons.
4
+
5
+ ```ts
6
+ import {
7
+ NavigationRail,
8
+ NavigationRailToggle,
9
+ NavigationRailItem,
10
+ } from 'anvilui'
11
+ ```
12
+
13
+ | Part | Renders | Props |
14
+ | --- | --- | --- |
15
+ | `NavigationRail` | `<nav>` (96px wide, `height: 100%`) | `aria-label`; `expanded` / `defaultExpanded` (false) / `onExpandedChange(expanded)` |
16
+ | `NavigationRailToggle` | `IconButton` (menu icon) | `aria-label` required. Must be inside the rail. |
17
+ | `NavigationRailItem` | `<a>` | `icon` (required), `label: string` (required), `active`, `end` (short badge text, e.g. a count), `href`, `render` |
18
+
19
+ ```tsx
20
+ import {
21
+ NavigationRail,
22
+ NavigationRailItem,
23
+ NavigationRailToggle,
24
+ } from 'anvilui'
25
+
26
+ export function Layout({ children }: { children: React.ReactNode }) {
27
+ return (
28
+ <div style={{ display: 'flex', height: '100vh' }}>
29
+ <NavigationRail aria-label="Main">
30
+ <NavigationRailToggle aria-label="Toggle navigation" />
31
+ <NavigationRailItem
32
+ icon="inbox"
33
+ label="Inbox"
34
+ href="/inbox"
35
+ active
36
+ end="12"
37
+ />
38
+ <NavigationRailItem icon="send" label="Sent" href="/sent" />
39
+ <NavigationRailItem
40
+ icon="settings"
41
+ label="Settings"
42
+ href="/settings"
43
+ />
44
+ </NavigationRail>
45
+ <main style={{ flex: 1, overflow: 'auto' }}>{children}</main>
46
+ </div>
47
+ )
48
+ }
49
+ ```
50
+
51
+ In-page switching without URLs: `render={<button type="button" onClick={() => setView('inbox')} />}` with `active={view === 'inbox'}`. No `nativeButton` needed.
52
+
53
+ On small screens use [NavigationDrawer](navigation-drawer.md) or [NavigationBar](navigation-bar.md) instead.
@@ -0,0 +1,38 @@
1
+ # PinInput
2
+
3
+ One box per character, for verification codes and PINs. `length` is required.
4
+
5
+ ```ts
6
+ import { PinInput } from 'anvilui'
7
+ import type { PinInputProps } from 'anvilui'
8
+ ```
9
+
10
+ | Prop | Type | Default | Description |
11
+ | --- | --- | --- | --- |
12
+ | `length` | `number` | required | Number of boxes. |
13
+ | `label` | `ReactNode` | | Either this or `aria-label`. |
14
+ | `value` / `defaultValue` | `string` | | |
15
+ | `onValueChange` | `(value: string, details) => void` | | |
16
+ | `onValueComplete` | `(value: string, details) => void` | | When every box is filled. |
17
+ | `validationType` | `'numeric' \| 'alpha' \| 'alphanumeric' \| 'none'` | `'numeric'` | |
18
+ | `mask` | `boolean` | `false` | Hide characters. |
19
+ | `fillType` | `'filled' \| 'outlined'` | `'outlined'` | |
20
+ | `size` | `'small' \| 'normal'` | `'normal'` | |
21
+ | `name`, `disabled`, `required`, `autoSubmit` | | | |
22
+ | `className` | `string` | | On the wrapper. |
23
+
24
+ ```tsx
25
+ import { PinInput } from 'anvilui'
26
+
27
+ export function Example() {
28
+ return (
29
+ <PinInput
30
+ label="Verification code"
31
+ length={6}
32
+ onValueComplete={(code) => console.log(code)}
33
+ />
34
+ )
35
+ }
36
+ ```
37
+
38
+ Base UI docs: `node_modules/@base-ui/react/docs/react/components/otp-field.md`.
@@ -0,0 +1,78 @@
1
+ # Popover
2
+
3
+ A floating panel anchored to its trigger, for content users interact with.
4
+
5
+ ```ts
6
+ import {
7
+ Popover,
8
+ PopoverTrigger,
9
+ PopoverPopup,
10
+ PopoverTitle,
11
+ PopoverDescription,
12
+ PopoverClose,
13
+ } from 'anvilui'
14
+ ```
15
+
16
+ | Part | Renders | Props |
17
+ | --- | --- | --- |
18
+ | `Popover` | nothing (state) | `open` / `defaultOpen` / `onOpenChange`, `modal`, `morph` |
19
+ | `PopoverTrigger` | bare `<button>` | `render={<Button />}`; `openOnHover`, `delay` |
20
+ | `PopoverPopup` | portal + positioner + panel | `side` (`'top' \| 'bottom' \| 'left' \| 'right' \| 'inline-start' \| 'inline-end'`, default `'bottom'`), `align` (`'start' \| 'center' \| 'end'`), `sideOffset` (4), `alignOffset`, `anchor` |
21
+ | `PopoverTitle` | `<h2>` | `render={<h3 />}` to change level |
22
+ | `PopoverDescription` | `<p>` | |
23
+ | `PopoverClose` | bare `<button>` | `render={<IconButton icon="close" aria-label="Close" />}` |
24
+
25
+ There is no `PopoverContent`; `side` / `align` go on `PopoverPopup`.
26
+
27
+ ```tsx
28
+ import {
29
+ Button,
30
+ IconButton,
31
+ Input,
32
+ Popover,
33
+ PopoverClose,
34
+ PopoverPopup,
35
+ PopoverTitle,
36
+ PopoverTrigger,
37
+ } from 'anvilui'
38
+
39
+ export function Example() {
40
+ return (
41
+ <Popover>
42
+ <PopoverTrigger
43
+ render={<Button fillType="outlined" startIcon="filter_list" />}
44
+ >
45
+ Filters
46
+ </PopoverTrigger>
47
+ <PopoverPopup
48
+ side="bottom"
49
+ align="start"
50
+ style={{ display: 'grid', gap: 12, width: 280 }}
51
+ >
52
+ <div
53
+ style={{
54
+ display: 'flex',
55
+ justifyContent: 'space-between',
56
+ alignItems: 'center',
57
+ }}
58
+ >
59
+ <PopoverTitle>Filters</PopoverTitle>
60
+ <PopoverClose
61
+ render={
62
+ <IconButton
63
+ icon="close"
64
+ aria-label="Close"
65
+ fillType="text"
66
+ color="container"
67
+ />
68
+ }
69
+ />
70
+ </div>
71
+ <Input label="Min price" type="number" />
72
+ </PopoverPopup>
73
+ </Popover>
74
+ )
75
+ }
76
+ ```
77
+
78
+ For a hint on hover use [Tooltip](tooltip.md); for a hover preview of a link, [PreviewCard](preview-card.md).
@@ -0,0 +1,40 @@
1
+ # PreviewCard
2
+
3
+ A card shown while hovering or focusing a link. Hover-only: nothing inside should need clicking (use [Popover](popover.md) for that).
4
+
5
+ ```ts
6
+ import { PreviewCard, PreviewCardTrigger, PreviewCardPopup } from 'anvilui'
7
+ ```
8
+
9
+ | Part | Renders | Props |
10
+ | --- | --- | --- |
11
+ | `PreviewCard` | nothing (state) | `open` / `defaultOpen` / `onOpenChange` |
12
+ | `PreviewCardTrigger` | `<a>` | `href`, `delay`, `closeDelay`; `render={<Link to="..." />}` for routers |
13
+ | `PreviewCardPopup` | portal + positioner + card | `side`, `align`, `sideOffset` (8), `alignOffset` |
14
+
15
+ ```tsx
16
+ import {
17
+ Avatar,
18
+ PreviewCard,
19
+ PreviewCardPopup,
20
+ PreviewCardTrigger,
21
+ Typography,
22
+ } from 'anvilui'
23
+
24
+ export function Example() {
25
+ return (
26
+ <Typography>
27
+ Written by{' '}
28
+ <PreviewCard>
29
+ <PreviewCardTrigger href="/users/ada">@ada</PreviewCardTrigger>
30
+ <PreviewCardPopup
31
+ style={{ display: 'flex', gap: 12, alignItems: 'center' }}
32
+ >
33
+ <Avatar name="Ada Lovelace" />
34
+ <span>Ada Lovelace · 12 posts</span>
35
+ </PreviewCardPopup>
36
+ </PreviewCard>
37
+ </Typography>
38
+ )
39
+ }
40
+ ```
@@ -0,0 +1,37 @@
1
+ # Progress
2
+
3
+ A bar or ring showing progress. Needs `label` or `aria-label`.
4
+
5
+ ```ts
6
+ import { Progress } from 'anvilui'
7
+ import type { ProgressProps } from 'anvilui'
8
+ ```
9
+
10
+ | Prop | Type | Default | Description |
11
+ | --- | --- | --- | --- |
12
+ | `value` | `number \| null` | | `null` = indeterminate (spinning / sweeping). Required by Base UI: pass `null` explicitly for loading. |
13
+ | `min` / `max` | `number` | `0` / `100` | |
14
+ | `type` | `'linear' \| 'circular' \| 'inline'` | `'linear'` | `inline` is a ring the size of the text. |
15
+ | `squiggly` | `boolean` | `false` | Wavy bar (linear only). |
16
+ | `label` | `ReactNode` | | Visible label. Either this or `aria-label`. |
17
+ | `aria-label` | `string` | | |
18
+
19
+ There is no `Spinner` / `CircularProgress` / `LinearProgress`: use `<Progress type="circular" value={null} aria-label="Loading" />`. For a loading button, use `<Button loading>`.
20
+
21
+ ```tsx
22
+ import { Progress } from 'anvilui'
23
+
24
+ export function Example({ uploaded }: { uploaded: number }) {
25
+ return (
26
+ <div style={{ display: 'grid', gap: 16, width: 300 }}>
27
+ <Progress label="Uploading" value={uploaded} />
28
+ <Progress aria-label="Loading" value={null} squiggly />
29
+ <Progress type="circular" aria-label="Loading" value={null} />
30
+ <span>
31
+ Syncing{' '}
32
+ <Progress type="inline" aria-label="Syncing" value={null} />
33
+ </span>
34
+ </div>
35
+ )
36
+ }
37
+ ```
@@ -0,0 +1,47 @@
1
+ # RadioGroup, Radio
2
+
3
+ Pick exactly one option. State lives on the group; each `Radio` has a `value`. **`Radio` has no `label` prop**: wrap it in a `<label>`.
4
+
5
+ ```ts
6
+ import { RadioGroup, Radio } from 'anvilui'
7
+ import type { RadioGroupProps, RadioProps } from 'anvilui'
8
+ ```
9
+
10
+ ## RadioGroup props (Base UI RadioGroup)
11
+
12
+ | Prop | Type | Description |
13
+ | --- | --- | --- |
14
+ | `value` / `defaultValue` | `Value` | The picked radio's value. |
15
+ | `onValueChange` | `(value: Value, details) => void` | |
16
+ | `name`, `required`, `disabled`, `readOnly` | | |
17
+ | `aria-label` / `aria-labelledby` | `string` | Name the group. |
18
+
19
+ ## Radio props (Base UI Radio.Root)
20
+
21
+ `value: Value` (required), `disabled?: boolean`.
22
+
23
+ ```tsx
24
+ import { useState } from 'react'
25
+ import { Radio, RadioGroup } from 'anvilui'
26
+
27
+ export function Example() {
28
+ const [plan, setPlan] = useState('free')
29
+ return (
30
+ <RadioGroup
31
+ aria-label="Plan"
32
+ value={plan}
33
+ onValueChange={setPlan}
34
+ style={{ display: 'grid', gap: 8 }}
35
+ >
36
+ <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
37
+ <Radio value="free" /> Free
38
+ </label>
39
+ <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
40
+ <Radio value="pro" /> Pro
41
+ </label>
42
+ </RadioGroup>
43
+ )
44
+ }
45
+ ```
46
+
47
+ For a compact row of 2–5 options, [ToggleGroup](toggle-group.md) looks better.
package/docs/search.md ADDED
@@ -0,0 +1,77 @@
1
+ # Search, SearchItem
2
+
3
+ A Material 3 search bar with a suggestion list. `aria-label` is required. **Children are a render function** over `items`. The value is the typed text.
4
+
5
+ ```ts
6
+ import { Search, SearchItem } from 'anvilui'
7
+ import type { SearchProps, SearchItemProps } from 'anvilui'
8
+ ```
9
+
10
+ ## Search props
11
+
12
+ | Prop | Type | Default | Description |
13
+ | --- | --- | --- | --- |
14
+ | `aria-label` | `string` | required | |
15
+ | `children` | `(item: Item, index: number) => ReactNode` | required | Renders one `SearchItem`. |
16
+ | `items` | `readonly Item[]` | | Suggestions, filtered as you type. Pass `[]` for none. |
17
+ | `value` / `defaultValue` | `string` | | The typed text. |
18
+ | `onValueChange` | `(text: string, details) => void` | | |
19
+ | `placeholder` | `string` | | |
20
+ | `empty` | `ReactNode` | | Shown when nothing matches. |
21
+ | `clearLabel` | `string` | `'Clear'` | Name of the clear button. |
22
+ | `className` | `string` | | On the bar. |
23
+ | `itemToStringValue`, `filter`, `limit`, `openOnInputClick` | | | Base UI Autocomplete.Root props. |
24
+
25
+ ## SearchItem props
26
+
27
+ `value: Item` (required), `startIcon?: MaterialSymbol`, `children`.
28
+
29
+ ```tsx
30
+ import { useState } from 'react'
31
+ import { Search, SearchItem } from 'anvilui'
32
+
33
+ const recent = ['invoices', 'travel', 'receipts']
34
+
35
+ export function Example() {
36
+ const [query, setQuery] = useState('')
37
+ return (
38
+ <Search
39
+ aria-label="Search mail"
40
+ placeholder="Search mail"
41
+ items={recent}
42
+ value={query}
43
+ onValueChange={setQuery}
44
+ >
45
+ {(item: string) => (
46
+ <SearchItem key={item} value={item} startIcon="history">
47
+ {item}
48
+ </SearchItem>
49
+ )}
50
+ </Search>
51
+ )
52
+ }
53
+ ```
54
+
55
+ To filter a page's own content with no suggestion list, pass `items={[]}` and a render function that returns `null`, then filter your data with the typed text:
56
+
57
+ ```tsx
58
+ import { useState } from 'react'
59
+ import { List, ListItem, Search } from 'anvilui'
60
+
61
+ const people = ['Ada Lovelace', 'Alan Turing', 'Grace Hopper']
62
+
63
+ export function FilterExample() {
64
+ const [query, setQuery] = useState('')
65
+ const shown = people.filter((p) => p.toLowerCase().includes(query.toLowerCase()))
66
+ return (
67
+ <>
68
+ <Search aria-label="Filter people" placeholder="Filter people" items={[]} value={query} onValueChange={setQuery}>
69
+ {() => null}
70
+ </Search>
71
+ <List>
72
+ {shown.map((p) => <ListItem key={p} label={p} />)}
73
+ </List>
74
+ </>
75
+ )
76
+ }
77
+ ```
package/docs/select.md ADDED
@@ -0,0 +1,64 @@
1
+ # Select, SelectItem
2
+
3
+ A dropdown to pick one option (or several with `multiple`). Looks like `Input`.
4
+
5
+ ```ts
6
+ import { Select, SelectItem } from 'anvilui'
7
+ import type { SelectProps, SelectItemProps } from 'anvilui'
8
+ ```
9
+
10
+ ## Select props
11
+
12
+ | Prop | Type | Default | Description |
13
+ | --- | --- | --- | --- |
14
+ | `children` | `SelectItem`s | | |
15
+ | `items` | `Record<string, ReactNode>` or `{ value, label }[]` | | **Pass it** so the field shows the label, not the raw value. |
16
+ | `value` / `defaultValue` | `Value \| null` (array with `multiple`) | | |
17
+ | `onValueChange` | `(value: Value \| null, details) => void` | | The value, not an event. |
18
+ | `label` | `ReactNode` | | Floating label. |
19
+ | `placeholder` | `ReactNode` | | Shown when nothing is selected. |
20
+ | `size` | `'small' \| 'normal'` | `'normal'` | |
21
+ | `multiple` | `boolean` | `false` | |
22
+ | `name`, `required`, `disabled`, `readOnly` | | | |
23
+ | `open` / `defaultOpen` / `onOpenChange` | | | |
24
+ | `itemToStringLabel` | `(value) => string` | | For object values. |
25
+ | `className` | `string` | | On the field wrapper. |
26
+
27
+ Other props go to Base UI `Select.Root`, which renders no element: `id`, `style` and `ref` are not applied. Base UI docs: `node_modules/@base-ui/react/docs/react/components/select.md`.
28
+
29
+ ## SelectItem props
30
+
31
+ `value` (required), `children` (the label), `disabled`.
32
+
33
+ ```tsx
34
+ import { useState } from 'react'
35
+ import { Select, SelectItem } from 'anvilui'
36
+
37
+ const countries = [
38
+ { value: 'us', label: 'United States' },
39
+ { value: 'fr', label: 'France' },
40
+ { value: 'jp', label: 'Japan' },
41
+ ]
42
+
43
+ export function Example() {
44
+ const [country, setCountry] = useState<string | null>('fr')
45
+ return (
46
+ <Select
47
+ label="Country"
48
+ items={countries}
49
+ value={country}
50
+ onValueChange={setCountry}
51
+ className="country-field"
52
+ >
53
+ {countries.map((c) => (
54
+ <SelectItem key={c.value} value={c.value}>
55
+ {c.label}
56
+ </SelectItem>
57
+ ))}
58
+ </Select>
59
+ )
60
+ }
61
+ ```
62
+
63
+ - No `SelectTrigger`, `SelectContent` or `SelectValue` parts: `Select` renders the field and the popup. Only items go inside.
64
+ - For a searchable list use [Combobox](combobox.md).