@kb.ui/react 0.10.4 → 0.12.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/README.md +142 -707
- package/dist/components/Accordion/Accordion.d.ts +33 -0
- package/dist/components/Avatar/Avatar.d.ts +19 -0
- package/dist/components/Code/Code.d.ts +26 -3
- package/dist/components/Code/tokenize.d.ts +5 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +10 -0
- package/dist/components/Collection/Collection.d.ts +99 -0
- package/dist/components/Collection/useCollection.d.ts +66 -0
- package/dist/components/CollectionList/CollectionList.d.ts +12 -0
- package/dist/components/CollectionRow/CollectionRow.d.ts +17 -0
- package/dist/components/Combobox/Combobox.d.ts +14 -2
- package/dist/components/ConfirmAction/ConfirmAction.d.ts +42 -0
- package/dist/components/CopyableText/CopyableText.d.ts +38 -0
- package/dist/components/CopyableText/content.d.ts +14 -0
- package/dist/components/Dashboard/Dashboard.d.ts +17 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +20 -0
- package/dist/components/Dialog/Dialog.d.ts +3 -1
- package/dist/components/Disclosure/Disclosure.d.ts +21 -0
- package/dist/components/EmptyState/EmptyState.d.ts +30 -0
- package/dist/components/Form/Form.d.ts +19 -0
- package/dist/components/FormSection/FormSection.d.ts +26 -0
- package/dist/components/Gallery/Gallery.d.ts +26 -0
- package/dist/components/Grid/Grid.d.ts +17 -6
- package/dist/components/Image/Image.d.ts +20 -0
- package/dist/components/Link/Link.d.ts +15 -2
- package/dist/components/PageHeader/PageHeader.d.ts +27 -0
- package/dist/components/Panel/Panel.d.ts +3 -1
- package/dist/components/Popover/Popover.d.ts +55 -0
- package/dist/components/Settings/Settings.d.ts +11 -0
- package/dist/components/Skeleton/Skeleton.d.ts +34 -0
- package/dist/components/Spinner/Spinner.d.ts +26 -0
- package/dist/components/Stack/Stack.d.ts +15 -0
- package/dist/components/StatsRow/StatsRow.d.ts +33 -0
- package/dist/components/SupportingPane/SupportingPane.d.ts +15 -0
- package/dist/components/Table/Table.d.ts +65 -0
- package/dist/components/Tabs/Tabs.d.ts +69 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Thumbnail/Thumbnail.d.ts +14 -0
- package/dist/components/Toast/Toast.d.ts +72 -0
- package/dist/index.d.ts +39 -4
- package/dist/index.js +3901 -1238
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/CollapsiblePanel.d.ts +10 -0
- package/dist/utils/useClipboard.d.ts +28 -0
- package/docs/components/Accordion.md +66 -0
- package/docs/components/Avatar.md +80 -0
- package/docs/components/Badge.md +37 -0
- package/docs/components/Button.md +46 -0
- package/docs/components/Callout.md +41 -0
- package/docs/components/Card.md +41 -0
- package/docs/components/Checkbox.md +60 -0
- package/docs/components/Code.md +77 -0
- package/docs/components/CodeBlock.md +77 -0
- package/docs/components/Collection.md +183 -0
- package/docs/components/CollectionList.md +44 -0
- package/docs/components/CollectionRow.md +62 -0
- package/docs/components/Combobox.md +88 -0
- package/docs/components/ConfirmAction.md +100 -0
- package/docs/components/Container.md +41 -0
- package/docs/components/CopyableText.md +93 -0
- package/docs/components/Dashboard.md +81 -0
- package/docs/components/DescriptionList.md +61 -0
- package/docs/components/Dialog.md +84 -0
- package/docs/components/Disclosure.md +53 -0
- package/docs/components/EmptyState.md +50 -0
- package/docs/components/ErrorSummary.md +48 -0
- package/docs/components/Fieldset.md +42 -0
- package/docs/components/FileInput.md +74 -0
- package/docs/components/Form.md +67 -0
- package/docs/components/FormActions.md +45 -0
- package/docs/components/FormSection.md +57 -0
- package/docs/components/Gallery.md +84 -0
- package/docs/components/Grid.md +66 -0
- package/docs/components/Heading.md +40 -0
- package/docs/components/Image.md +62 -0
- package/docs/components/Inline.md +42 -0
- package/docs/components/Input.md +82 -0
- package/docs/components/Link.md +52 -0
- package/docs/components/Menu.md +44 -0
- package/docs/components/MultiSelect.md +59 -0
- package/docs/components/NumberField.md +65 -0
- package/docs/components/PageHeader.md +68 -0
- package/docs/components/Panel.md +153 -0
- package/docs/components/Popover.md +89 -0
- package/docs/components/Progress.md +37 -0
- package/docs/components/RadioGroup.md +69 -0
- package/docs/components/ScrollArea.md +40 -0
- package/docs/components/Select.md +71 -0
- package/docs/components/Separator.md +40 -0
- package/docs/components/Settings.md +57 -0
- package/docs/components/Skeleton.md +86 -0
- package/docs/components/Spinner.md +45 -0
- package/docs/components/Split.md +47 -0
- package/docs/components/Stack.md +54 -0
- package/docs/components/Stat.md +34 -0
- package/docs/components/StatsRow.md +80 -0
- package/docs/components/Status.md +48 -0
- package/docs/components/SupportingPane.md +59 -0
- package/docs/components/Switch.md +73 -0
- package/docs/components/Table.md +105 -0
- package/docs/components/Tabs.md +89 -0
- package/docs/components/Text.md +36 -0
- package/docs/components/Textarea.md +47 -0
- package/docs/components/Thumbnail.md +66 -0
- package/docs/components/Toast.md +130 -0
- package/docs/components/Toolbar.md +39 -0
- package/docs/components/Tooltip.md +42 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
React components for forms, navigation, feedback, layout and typography. This adapter bundles the complete kbui stylesheet and CSS tokens. [Base UI](https://base-ui.com) 1.9 and `clsx` install automatically as runtime dependencies.
|
|
4
4
|
|
|
5
|
-
Default themes use monochrome light/dark surfaces, a persimmon accent, and shared tactile materials.
|
|
5
|
+
Default themes use monochrome light/dark surfaces, a persimmon accent, and shared tactile materials. These references follow the current source; check the [release notes](https://github.com/KhallilB/kbui/releases) for the exports available in an installed version.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -23,309 +23,188 @@ export function Save() {
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
The React adapter provides the components, styles and CSS variables together. Install the optional `@kb.ui/tokens` package only for typed variable names or token-only assets. Keep all installed kbui packages on one version. [Get Started](https://kbui.kcb.pro/setup/) generates versioned commands for npm, Bun, pnpm and Yarn; the [usage guide](
|
|
26
|
+
The React adapter provides the components, styles and CSS variables together. Install the optional `@kb.ui/tokens` package only for typed variable names or token-only assets. Keep all installed kbui packages on one version. [Get Started](https://kbui.kcb.pro/setup/) generates versioned commands for npm, Bun, pnpm and Yarn; the [usage guide](https://github.com/KhallilB/kbui/blob/main/docs/guides/using-kbui.md) covers prerequisites, upgrading, local development and troubleshooting.
|
|
27
27
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
Every component takes `className` and `style`. Components with inner parts, such as Input, Select and Checkbox, also take `classNames` keyed by part; the props type lists each part. kbui's CSS sits in the `kbui` cascade layer, so your classes win. See [Restyling kbui](../../docs/guides/restyling.md).
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
<Input label="Email" className="w-full" classNames={{ control: "rounded-none" }} />
|
|
34
|
-
```
|
|
28
|
+
## Start here
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Components follow the current light or dark theme through shared semantic tokens. Use `Button` for actions and its `render` prop for links styled as actions. Custom classes and token overrides are supported; preserve readable color pairs, visible focus and clear disabled states in both themes.
|
|
30
|
+
- [Components and recipes](https://github.com/KhallilB/kbui/blob/main/docs/guides/components-and-recipes.md): importing package APIs and copying application-owned source.
|
|
31
|
+
- [Browse recipes](https://kbui.kcb.pro/recipes/): live compositions and complete source files.
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
- [Install and configure kbui](https://github.com/KhallilB/kbui/blob/main/docs/guides/using-kbui.md): package setup, themes, and troubleshooting.
|
|
34
|
+
- [Browse live components](https://kbui.kcb.pro/components/): interactive states, code, and API tables.
|
|
35
|
+
- [Accessibility implementation and verification](https://github.com/KhallilB/kbui/blob/main/docs/guides/accessibility.md): requirements, caller responsibilities, manual checks, and evidence limits.
|
|
36
|
+
- [Component references](#components): usage, props, defaults, and behavior for every component.
|
|
37
|
+
- [Restyle components](https://github.com/KhallilB/kbui/blob/main/docs/guides/restyling.md): classes, inner parts, and tokens.
|
|
41
38
|
|
|
42
|
-
##
|
|
39
|
+
## Choose by task
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
| Task | Start here |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Run an action or navigate | [`Button`](docs/components/Button.md) for actions; [`ConfirmAction`](docs/components/ConfirmAction.md) for destructive actions; [`Link`](docs/components/Link.md) for destinations |
|
|
44
|
+
| Collect choices | [`Checkbox`](docs/components/Checkbox.md) for independent choices; [`RadioGroup`](docs/components/RadioGroup.md) for one visible choice; [`Select`](docs/components/Select.md) for a dropdown; [`Switch`](docs/components/Switch.md) for an immediate setting |
|
|
45
|
+
| Collect text, quantities, or files | [`Input`](docs/components/Input.md), [`Textarea`](docs/components/Textarea.md), [`NumberField`](docs/components/NumberField.md), or [`FileInput`](docs/components/FileInput.md) |
|
|
46
|
+
| Reveal details or supporting controls | [`Disclosure`](docs/components/Disclosure.md), [`Accordion`](docs/components/Accordion.md), or [`Popover`](docs/components/Popover.md); [drawer and confirmation patterns](https://github.com/KhallilB/kbui/blob/main/docs/guides/forms-and-overlays.md#drawer-pattern) compose `Dialog` |
|
|
47
|
+
| Arrange a responsive page | [`Container`](docs/components/Container.md) for the page boundary; [`PageHeader`](docs/components/PageHeader.md) for the title and page actions; [`StatsRow`](docs/components/StatsRow.md) for a row of key metrics; [`Dashboard`](docs/components/Dashboard.md) for an overview page with metrics and panels; [`Inline`](docs/components/Inline.md) for rows; [`Stack`](docs/components/Stack.md) for vertical flow; [`Grid`](docs/components/Grid.md) for collections; [`Split`](docs/components/Split.md) for two columns; [`SupportingPane`](docs/components/SupportingPane.md) for a main task with an aside such as an order summary |
|
|
48
|
+
| Explain state, waiting, or completion | [`Spinner`](docs/components/Spinner.md) for indeterminate waits; [`Skeleton`](docs/components/Skeleton.md) for loading placeholders; [`Progress`](docs/components/Progress.md) for completion; [`EmptyState`](docs/components/EmptyState.md) for missing content; [`Status`](docs/components/Status.md) for changing state; [`Toast`](docs/components/Toast.md) for transient notifications; [`Badge`](docs/components/Badge.md) for metadata; [`Callout`](docs/components/Callout.md) for a fuller message |
|
|
49
|
+
| Compare records or scan details | [`Table`](docs/components/Table.md), [`DescriptionList`](docs/components/DescriptionList.md), [`CollectionList`](docs/components/CollectionList.md) and [`CollectionRow`](docs/components/CollectionRow.md) |
|
|
50
|
+
| Build readable content | [`Heading`](docs/components/Heading.md) and [`Text`](docs/components/Text.md) |
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|---|---|---|---|
|
|
48
|
-
| `children` | `ReactNode` | unset | Visible action label, or an icon paired with aria-label |
|
|
49
|
-
| `variant` | `"primary" \| "secondary" \| "ghost" \| "danger"` | `"primary"` | Main, supporting, quiet, or destructive action emphasis |
|
|
50
|
-
| `size` | `sm` / `md` / `lg` / `icon` | `md` | Height and padding; icon is square and requires aria-label |
|
|
51
|
-
| `type` | native button type | `button` | Set submit for form submission; use button for other form actions |
|
|
52
|
-
| `disabled` | `boolean` | `false` | Blocks interaction; explain unavailable actions in nearby text when needed |
|
|
53
|
-
| `render` | element | unset | Use an anchor with nativeButton=false and role=link for navigation |
|
|
54
|
-
| `className` | `string` | unset | Extra classes on the rendered control; function values are not supported |
|
|
52
|
+
Start with the complete Usage example on a component page. Its More examples section links to focused, working Storybook states; Related components explains nearby alternatives. Use the live Docs page for component-specific keyboard, focus, and labeling guidance. Check those contracts with your app’s actual content and flows.
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
For searchable choices, compare [`Combobox`](docs/components/Combobox.md) and [`MultiSelect`](docs/components/MultiSelect.md). For complete forms, start with [`Form`](docs/components/Form.md) or [`Settings`](docs/components/Settings.md), group fields with [`FormSection`](docs/components/FormSection.md), and recover with [`ErrorSummary`](docs/components/ErrorSummary.md).
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
<Button render={<a href="/docs" />} nativeButton={false} role="link">Docs</Button>
|
|
60
|
-
```
|
|
56
|
+
## Components
|
|
61
57
|
|
|
62
|
-
|
|
58
|
+
Choose by task. Each page contains a complete usage example, canonical API details, focused working stories, and related-component guidance.
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
### Media and identity
|
|
65
61
|
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
|
|
|
71
|
-
| `description` | `string` | | Help text below the field |
|
|
72
|
-
| `error` | `string` | | Shows an error message and marks the field invalid |
|
|
73
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Field height. Replaces the native `size` attribute |
|
|
74
|
-
| `className` | `string` | | Applied to the wrapper, not the input element |
|
|
75
|
-
|
|
76
|
-
Other native input props, including `value` and `defaultValue`, pass through to the input. Base UI's `onValueChange` is also supported.
|
|
77
|
-
|
|
78
|
-
### Search composition
|
|
62
|
+
| Component | Use for |
|
|
63
|
+
|---|---|
|
|
64
|
+
| <a id="avatar"></a>[`Avatar`](docs/components/Avatar.md) | Recognizable people and organizations with photo/initials fallback. |
|
|
65
|
+
| <a id="image"></a>[`Image`](docs/components/Image.md) | Stable image sizing, crops, containment and failure states. |
|
|
66
|
+
| <a id="thumbnail"></a>[`Thumbnail`](docs/components/Thumbnail.md) | Captioned products, attachments and gallery previews. |
|
|
79
67
|
|
|
80
|
-
|
|
68
|
+
See [Media and identity](../../docs/guides/media-and-identity.md) for responsive sources and retry, and [`Gallery`](docs/components/Gallery.md) for catalog pages.
|
|
69
|
+
### Collections
|
|
81
70
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export function SearchExample() {
|
|
87
|
-
const [query, setQuery] = useState("");
|
|
88
|
-
const control = useRef<HTMLInputElement>(null);
|
|
89
|
-
return (
|
|
90
|
-
<Input
|
|
91
|
-
ref={control}
|
|
92
|
-
label="Search components"
|
|
93
|
-
type="search"
|
|
94
|
-
name="q"
|
|
95
|
-
value={query}
|
|
96
|
-
onValueChange={setQuery}
|
|
97
|
-
endContent={query ? (
|
|
98
|
-
<Button type="button" size="sm" variant="ghost" aria-label="Clear search"
|
|
99
|
-
onClick={() => { setQuery(""); control.current?.focus(); }}>
|
|
100
|
-
<span aria-hidden="true">×</span>
|
|
101
|
-
</Button>
|
|
102
|
-
) : undefined}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
```
|
|
71
|
+
| Component | Use for |
|
|
72
|
+
|---|---|
|
|
73
|
+
| [`Collection`](docs/components/Collection.md) | Sort, filter, select and paginate records; includes `useCollection`, `Collection.Pagination` and `Collection.BulkActions`. |
|
|
107
74
|
|
|
108
|
-
|
|
75
|
+
### Navigation
|
|
109
76
|
|
|
110
|
-
|
|
77
|
+
| Component | Use it to |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| <a id="tabs"></a>[`Tabs`](docs/components/Tabs.md) | Switch between peer panels with keyboard navigation. |
|
|
111
80
|
|
|
112
|
-
|
|
81
|
+
### Actions
|
|
113
82
|
|
|
114
|
-
|
|
|
83
|
+
| Component | Use for |
|
|
115
84
|
|---|---|
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `Dialog
|
|
120
|
-
|
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
|
|
124
|
-
| Prop on root or Content | Type | Default | Notes |
|
|
125
|
-
|---|---|---|---|
|
|
126
|
-
| `open` on Dialog | `boolean` | uncontrolled | Current visibility when your app controls the dialog |
|
|
127
|
-
| `defaultOpen` on Dialog | `boolean` | `false` | Initial visibility; avoid starting open in a reading surface |
|
|
128
|
-
| `onOpenChange` on Dialog | Base UI callback | unset | Receives the next visibility and change details |
|
|
129
|
-
| `title` on Content | `ReactNode` | unset | Visible title and accessible name; use Dialog.Title for custom markup instead |
|
|
130
|
-
| `description` on Content | `ReactNode` | unset | Supporting description; use Dialog.Description for custom markup instead |
|
|
131
|
-
| `container` on Content | portal container | document body | Themed host for a nested dialog |
|
|
85
|
+
| <a id="copyabletext"></a>[`CopyableText`](docs/components/CopyableText.md) | Copy identifiers and references with feedback and recovery. |
|
|
86
|
+
| <a id="button"></a>[`Button`](docs/components/Button.md) | Trigger an action or link to another page. |
|
|
87
|
+
| <a id="popover"></a>[`Popover`](docs/components/Popover.md) | Reveal supporting controls in an anchored popup. |
|
|
88
|
+
| <a id="dialog"></a>[`Dialog`](docs/components/Dialog.md) | Keep a focused task in a dialog while the page waits behind it. |
|
|
89
|
+
| <a id="confirmaction"></a>[`ConfirmAction`](docs/components/ConfirmAction.md) | Put a destructive action behind one confirmation that closes only after success. |
|
|
90
|
+
| <a id="menu"></a>[`Menu`](docs/components/Menu.md) | Keep related actions in a compact popup menu. |
|
|
91
|
+
| <a id="toolbar"></a>[`Toolbar`](docs/components/Toolbar.md) | Group related actions with arrow-key navigation. |
|
|
132
92
|
|
|
133
|
-
|
|
134
|
-
<Dialog>
|
|
135
|
-
<Dialog.Trigger render={<Button />}>Open</Dialog.Trigger>
|
|
136
|
-
<Dialog.Content title="Rename file">
|
|
137
|
-
<Input label="Name" />
|
|
138
|
-
<Dialog.Actions>
|
|
139
|
-
<Dialog.Close render={<Button variant="ghost" />}>Cancel</Dialog.Close>
|
|
140
|
-
<Button>Save</Button>
|
|
141
|
-
</Dialog.Actions>
|
|
142
|
-
</Dialog.Content>
|
|
143
|
-
</Dialog>
|
|
144
|
-
```
|
|
93
|
+
### Forms
|
|
145
94
|
|
|
146
|
-
|
|
95
|
+
| Component | Use for |
|
|
96
|
+
|---|---|
|
|
97
|
+
| <a id="checkbox"></a>[`Checkbox`](docs/components/Checkbox.md) | Let people select options independently, including a mixed selection. |
|
|
98
|
+
| <a id="combobox"></a>[`Combobox`](docs/components/Combobox.md) | Search and choose one or multiple options from a longer list. |
|
|
99
|
+
| <a id="errorsummary"></a>[`ErrorSummary`](docs/components/ErrorSummary.md) | Summarize form validation errors with links that focus each field. |
|
|
100
|
+
| <a id="fieldset"></a>[`Fieldset`](docs/components/Fieldset.md) | Group related fields with a native `fieldset`, legend, and section help. |
|
|
101
|
+
| <a id="fileinput"></a>[`FileInput`](docs/components/FileInput.md) | Choose files, review the list, and remove individual items. |
|
|
102
|
+
| <a id="formactions"></a>[`FormActions`](docs/components/FormActions.md) | Align submit, reset, and secondary actions at the end of a form. |
|
|
103
|
+
| <a id="formsection"></a>[`FormSection`](docs/components/FormSection.md) | A headed group of related fields with its error and actions. |
|
|
104
|
+
| <a id="input"></a>[`Input`](docs/components/Input.md) | Collect text with a clear label, help text, and error feedback. |
|
|
105
|
+
| <a id="multiselect"></a>[`MultiSelect`](docs/components/MultiSelect.md) | Search a list and keep multiple selections visible as removable chips. |
|
|
106
|
+
| <a id="numberfield"></a>[`NumberField`](docs/components/NumberField.md) | Enter a number by typing or using step buttons. |
|
|
107
|
+
| <a id="radiogroup"></a>[`RadioGroup`](docs/components/RadioGroup.md) | Choose one option from a visible group. |
|
|
108
|
+
| <a id="select"></a>[`Select`](docs/components/Select.md) | Choose one option from a dropdown list. |
|
|
109
|
+
| <a id="switch"></a>[`Switch`](docs/components/Switch.md) | Turn an immediate preference on or off. |
|
|
110
|
+
| <a id="textarea"></a>[`Textarea`](docs/components/Textarea.md) | Collect multiline text with a label, help text, and error feedback. |
|
|
111
|
+
|
|
112
|
+
### Feedback
|
|
113
|
+
|
|
114
|
+
| Component | Use for |
|
|
115
|
+
|---|---|
|
|
116
|
+
| <a id="badge"></a>[`Badge`](docs/components/Badge.md) | Add a short label, category, or piece of metadata. |
|
|
117
|
+
| <a id="toast"></a>[`Toast`](docs/components/Toast.md) | Queue temporary messages with announcements, actions and timed dismissal. |
|
|
118
|
+
| <a id="callout"></a>[`Callout`](docs/components/Callout.md) | Highlight a message and offer a useful next step. |
|
|
119
|
+
| <a id="emptystate"></a>[`EmptyState`](docs/components/EmptyState.md) | Explain why a collection or section is empty and offer the next action. |
|
|
120
|
+
| <a id="progress"></a>[`Progress`](docs/components/Progress.md) | Show how much of a task is complete. |
|
|
121
|
+
| <a id="skeleton"></a>[`Skeleton`](docs/components/Skeleton.md) | Reserve incoming content geometry while a section loads. |
|
|
122
|
+
| <a id="spinner"></a>[`Spinner`](docs/components/Spinner.md) | Indicate an indeterminate wait or busy control. |
|
|
123
|
+
| <a id="stat"></a>[`Stat`](docs/components/Stat.md) | Show a number alongside the label that explains it. |
|
|
124
|
+
| <a id="status"></a>[`Status`](docs/components/Status.md) | Describe a current state with text and an optional icon. |
|
|
125
|
+
| <a id="tooltip"></a>[`Tooltip`](docs/components/Tooltip.md) | Add brief context on hover or keyboard focus. |
|
|
126
|
+
|
|
127
|
+
### Layout
|
|
128
|
+
|
|
129
|
+
| Component | Use for |
|
|
130
|
+
|---|---|
|
|
131
|
+
| <a id="accordion"></a>[`Accordion`](docs/components/Accordion.md) | Group related disclosures under headings. |
|
|
132
|
+
| <a id="dashboard"></a>[`Dashboard`](docs/components/Dashboard.md) | An overview page: header, metrics, then primary and secondary panels. |
|
|
133
|
+
| <a id="disclosure"></a>[`Disclosure`](docs/components/Disclosure.md) | Reveal optional details and controls inline. |
|
|
134
|
+
| <a id="card"></a>[`Card`](docs/components/Card.md) | Group related content, with room for links and actions. |
|
|
135
|
+
| <a id="container"></a>[`Container`](docs/components/Container.md) | Shared page widths and responsive gutters. |
|
|
136
|
+
| <a id="form"></a>[`Form`](docs/components/Form.md) | One task with grouped fields, then its one submit action. |
|
|
137
|
+
| <a id="gallery"></a>[`Gallery`](docs/components/Gallery.md) | A page of image-led items, such as a product catalog, in one to four columns. |
|
|
138
|
+
| <a id="grid"></a>[`Grid`](docs/components/Grid.md) | Arrange content in responsive columns or a single stack. |
|
|
139
|
+
| <a id="inline"></a>[`Inline`](docs/components/Inline.md) | Wrapping rows with shared spacing and alignment. |
|
|
140
|
+
| <a id="pageheader"></a>[`PageHeader`](docs/components/PageHeader.md) | Open a screen with its title, context, state badges and page-level actions. |
|
|
141
|
+
| <a id="panel"></a>[`Panel`](docs/components/Panel.md) | Organize a section with a header, content, and actions. |
|
|
142
|
+
| <a id="scrollarea"></a>[`ScrollArea`](docs/components/ScrollArea.md) | Keep longer content in a scrollable, keyboard-accessible region. |
|
|
143
|
+
| <a id="separator"></a>[`Separator`](docs/components/Separator.md) | Semantic or decorative horizontal and vertical rules. |
|
|
144
|
+
| <a id="settings"></a>[`Settings`](docs/components/Settings.md) | Sections of fields and managed lists, each saved on its own. |
|
|
145
|
+
| <a id="split"></a>[`Split`](docs/components/Split.md) | Two columns that stack when their parent narrows. |
|
|
146
|
+
| <a id="stack"></a>[`Stack`](docs/components/Stack.md) | Vertical flow with shared spacing and alignment. |
|
|
147
|
+
| <a id="statsrow"></a>[`StatsRow`](docs/components/StatsRow.md) | Show comparable metrics in a row that fills its region and wraps when narrow. |
|
|
148
|
+
| <a id="supportingpane"></a>[`SupportingPane`](docs/components/SupportingPane.md) | A main column with a named aside that moves below it when narrow. |
|
|
149
|
+
|
|
150
|
+
### Structured data
|
|
151
|
+
|
|
152
|
+
| Component | Use for |
|
|
153
|
+
|---|---|
|
|
154
|
+
| <a id="table"></a>[`Table`](docs/components/Table.md) | Compare fields across records with sorting, selection, actions and sticky layouts. |
|
|
155
|
+
| <a id="descriptionlist"></a>[`DescriptionList`](docs/components/DescriptionList.md) | Scan labeled facts with aligned, responsive key/value presentation. |
|
|
156
|
+
| <a id="collectionlist"></a>[`CollectionList`](docs/components/CollectionList.md) | Group unordered or ordered records with shared alignment and spacing. |
|
|
157
|
+
| <a id="collectionrow"></a>[`CollectionRow`](docs/components/CollectionRow.md) | Summarize a record with details, metadata, selection and independent actions. |
|
|
147
158
|
|
|
148
|
-
|
|
159
|
+
### Typography
|
|
149
160
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<Panel.Well>…</Panel.Well>
|
|
158
|
-
</Panel.Body>
|
|
159
|
-
<Panel.Footer>…</Panel.Footer>
|
|
160
|
-
</Panel>
|
|
161
|
-
```
|
|
161
|
+
| Component | Use for |
|
|
162
|
+
|---|---|
|
|
163
|
+
| <a id="codeblock"></a>[`CodeBlock`](docs/components/CodeBlock.md) | Explicit source listings with highlighting, line numbers and copy feedback. |
|
|
164
|
+
| <a id="code"></a>[`Code`](docs/components/Code.md) | Literal inline code and syntax-highlighted multiline code blocks. |
|
|
165
|
+
| <a id="heading"></a>[`Heading`](docs/components/Heading.md) | Native heading hierarchy with independent visual sizing. |
|
|
166
|
+
| <a id="link"></a>[`Link`](docs/components/Link.md) | Recognizable navigation with visible keyboard focus. |
|
|
167
|
+
| <a id="text"></a>[`Text`](docs/components/Text.md) | Readable paragraphs, inline text and supporting content. |
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|---|---|---|---|
|
|
165
|
-
| `tone` | `quiet` / `default` / `sunken` / `active` / `critical` | `default` | Changes the surface emphasis; pair state colors with explanatory text |
|
|
166
|
-
| `rail` | `none` / `accent` / `status` | `none` | Accent stays the accent color; status follows the current tone |
|
|
167
|
-
| `density` | `compact` / `standard` | `standard` | Changes padding without changing semantics |
|
|
168
|
-
| `collapsible` | `boolean` | `false` | Enables Panel.Toggle and collapsible body behavior |
|
|
169
|
-
| `open` | `boolean` | uncontrolled | Current body visibility when collapsible is enabled |
|
|
170
|
-
| `defaultOpen` | `boolean` | `false` | Initial visibility for an uncontrolled collapsible panel |
|
|
171
|
-
| `onOpenChange` | `(open: boolean) => void` | unset | Update open here when your app controls visibility |
|
|
169
|
+
## Composition guides
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
Use these when a task spans several components:
|
|
174
172
|
|
|
175
|
-
|
|
173
|
+
- [Structured data](https://github.com/KhallilB/kbui/blob/main/docs/guides/structured-data.md): comparison tables, record details and collection rows.
|
|
174
|
+
- [Copyable content](https://github.com/KhallilB/kbui/blob/main/docs/guides/copyable-content.md): identifiers, commands, exact source and clipboard recovery.
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
- [Layout composition](https://github.com/KhallilB/kbui/blob/main/docs/guides/layout.md): page boundaries, wrapping rows, responsive columns, and separators.
|
|
177
|
+
- [Typography](https://github.com/KhallilB/kbui/blob/main/docs/guides/typography.md): heading hierarchy, readable copy, links, and inline code.
|
|
178
|
+
- [Forms and overlays](https://github.com/KhallilB/kbui/blob/main/docs/guides/forms-and-overlays.md): theme hosts, dialog structure, and focus behavior.
|
|
179
|
+
- [Loading and feedback](https://github.com/KhallilB/kbui/blob/main/docs/guides/loading-and-feedback.md): waiting states, missing content, asynchronous submission, and retry recipes.
|
|
180
|
+
- [Number fields](https://github.com/KhallilB/kbui/blob/main/docs/guides/number-fields.md): controlled values, validation, and locale-aware editing.
|
|
181
|
+
- [File inputs](https://github.com/KhallilB/kbui/blob/main/docs/guides/file-inputs.md): retained items, acceptance policy, and removal feedback.
|
|
178
182
|
|
|
179
|
-
|
|
183
|
+
## Search composition
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
<Panel.Group direction="row">
|
|
183
|
-
<Panel aria-labelledby="code-title">…</Panel>
|
|
184
|
-
<Panel.Handle aria-label="Resize code" defaultSize={50} min={25} max={75} />
|
|
185
|
-
<Panel aria-labelledby="view-title">…</Panel>
|
|
186
|
-
</Panel.Group>
|
|
187
|
-
```
|
|
185
|
+
Use the [`Input` search recipe](docs/components/Input.md#search-composition) for a labeled search field with a clear action and focus recovery.
|
|
188
186
|
|
|
189
|
-
|
|
187
|
+
## Resizable panels
|
|
190
188
|
|
|
191
|
-
|
|
189
|
+
Use the [`Panel.Handle` reference](docs/components/Panel.md#resizable-panels) for resizable panel groups and their pointer and keyboard behavior.
|
|
192
190
|
|
|
193
|
-
##
|
|
191
|
+
## Styling
|
|
194
192
|
|
|
195
|
-
|
|
193
|
+
Every component takes `className` and `style`. Components with inner parts, such as `Input`, `Select` and `Checkbox`, also take `classNames` keyed by part; the props type lists each part. kbui's CSS sits in the `kbui` cascade layer, so your classes win. See [Restyling kbui](https://github.com/KhallilB/kbui/blob/main/docs/guides/restyling.md).
|
|
196
194
|
|
|
197
195
|
```tsx
|
|
198
|
-
<
|
|
196
|
+
<Input label="Email" className="w-full" classNames={{ control: "rounded-none" }} />
|
|
199
197
|
```
|
|
200
198
|
|
|
201
|
-
|
|
202
|
-
|---|---|---|---|
|
|
203
|
-
| `children` | `ReactNode` | unset | State text such as Running or Blocked; keep it meaningful without color |
|
|
204
|
-
| `tone` | `neutral` / `info` / `running` / `success` / `warning` / `blocked` | `neutral` | Reinforces the written state |
|
|
205
|
-
| `appearance` | `plain` / `chip` | `plain` | Plain stays inline; chip adds separation with a tinted surface |
|
|
206
|
-
| `icon` | `ReactNode` | unset | Optional decorative icon; the text still names the state |
|
|
207
|
-
| `live` | `boolean` | `false` | Adds role=status for changing text; does not move focus |
|
|
208
|
-
| `compact` | `boolean` | `false` | Tighter spacing and smaller text for dense layouts |
|
|
209
|
-
|
|
210
|
-
## Display and layout helpers
|
|
211
|
-
|
|
212
|
-
Use [Badge](#badge) for metadata, [Status](#status) for changing states, [Stat](#stat) for a headline value, [Progress](#progress) for completion, and [Callout](#callout) for a message. [ScrollArea](#scrollarea) keeps long content in a named region.
|
|
213
|
-
|
|
214
|
-
## Badge
|
|
215
|
-
|
|
216
|
-
Add a short label to a person, record, or resource. Keep the text meaningful without its color. Use Status when the information changes over time.
|
|
217
|
-
|
|
218
|
-
| Prop | Type | Default | Notes |
|
|
219
|
-
|---|---|---|---|
|
|
220
|
-
| `children` | `ReactNode` | unset | Short metadata such as Reviewer, Draft, or a branch name |
|
|
221
|
-
| `tone` | `neutral` / `info` / `success` / `warning` / `danger` | `neutral` | Reinforces the text with ink and tint |
|
|
222
|
-
| `appearance` | `chip` / `plain` | `chip` | Chip adds a tinted surface; plain stays inline |
|
|
223
|
-
| `mono` | `boolean` | `false` | Small uppercase monospace for short identifiers |
|
|
224
|
-
| `preserveCase` | `boolean` | `false` | Preserve case and spacing for branch names, paths, and other literal values |
|
|
225
|
-
|
|
226
|
-
Native span props pass through. Badge adds no focus stop or live announcement.
|
|
227
|
-
|
|
228
|
-
## Stat
|
|
229
|
-
|
|
230
|
-
Show a value with the label that explains it. Include units and a time period in the label or value when they affect the meaning.
|
|
231
|
-
|
|
232
|
-
| Prop | Type | Default | Notes |
|
|
233
|
-
|---|---|---|---|
|
|
234
|
-
| `label` | `ReactNode` | required | What the value measures; read before the value |
|
|
235
|
-
| `value` | `ReactNode` | required | Number or short text; include units where needed |
|
|
236
|
-
| `size` | `md` / `display` | `md` | Use display for one headline number, md for groups |
|
|
237
|
-
| `classNames` | keyed classes | unset | Style the label and value separately |
|
|
238
|
-
|
|
239
|
-
## Progress
|
|
240
|
-
|
|
241
|
-
Show how much of a known task is complete. Use a task label rather than a percentage as the accessible name.
|
|
242
|
-
|
|
243
|
-
| Prop | Type | Default | Notes |
|
|
244
|
-
|---|---|---|---|
|
|
245
|
-
| `label` | `ReactNode` | required | Visible task name and accessible progressbar label |
|
|
246
|
-
| `value` | `number` | required | Completed amount, from zero to max |
|
|
247
|
-
| `max` | `number` | `100` | Total amount; set it for counts such as three of five steps |
|
|
248
|
-
| `valueText` | `string` | formatted percentage | Visible and announced value, such as 3 of 5 files |
|
|
249
|
-
| `classNames` | keyed classes | unset | Style head, label, value, track, or indicator |
|
|
250
|
-
|
|
251
|
-
The current value stays available to assistive technology. Your app owns task completion and any separate completion announcement.
|
|
252
|
-
|
|
253
|
-
## Callout
|
|
254
|
-
|
|
255
|
-
Keep a useful message close to the content it explains. Give people a concrete next step when they can resolve the issue.
|
|
256
|
-
|
|
257
|
-
| Prop | Type | Default | Notes |
|
|
258
|
-
|---|---|---|---|
|
|
259
|
-
| `children` | `ReactNode` | unset | Message body; explain what happened and what to do next |
|
|
260
|
-
| `title` | `ReactNode` | unset | Short summary above the message |
|
|
261
|
-
| `tone` | `neutral` / `info` / `success` / `warning` / `danger` | `neutral` | Reinforces the message without replacing its wording |
|
|
262
|
-
| `icon` | `ReactNode` | unset | Decorative icon; hidden from assistive technology |
|
|
263
|
-
| `actions` | `ReactNode` | unset | Named buttons or links that help resolve the message |
|
|
264
|
-
| `live` | `boolean` | `false` | Adds role=status for changing message text; does not move focus |
|
|
265
|
-
| `classNames` | keyed classes | unset | Style icon, content, title, body, or actions |
|
|
266
|
-
|
|
267
|
-
## ScrollArea
|
|
268
|
-
|
|
269
|
-
Keep logs, activity, or other long content inside a height cap. Let ordinary page content scroll with the page when a separate region is unnecessary.
|
|
270
|
-
|
|
271
|
-
| Prop | Type | Default | Notes |
|
|
272
|
-
|---|---|---|---|
|
|
273
|
-
| `label` | `string` | required | Accessible name of the focusable scrolling region |
|
|
274
|
-
| `children` | `ReactNode` | required | Content inside the viewport |
|
|
275
|
-
| `maxHeight` | CSS length string | unset | Height cap, such as 12rem; longer content scrolls |
|
|
276
|
-
| `classNames` | keyed classes | unset | Style viewport, scrollbar, or thumb |
|
|
277
|
-
|
|
278
|
-
Tab reaches the viewport so keyboard users can scroll it. Keep the focus indicator visible and give the region a specific name such as Build output.
|
|
279
|
-
|
|
280
|
-
## Overlays and actions
|
|
281
|
-
|
|
282
|
-
Use [Menu](#menu) for a short list of actions, [Tooltip](#tooltip) for optional hints, and [Toolbar](#toolbar) for related actions that belong in a row. Use Dialog for a focused task with fields or a confirmation.
|
|
283
|
-
|
|
284
|
-
## Tooltip
|
|
285
|
-
|
|
286
|
-
Add a brief, optional hint to an already named control. Put essential instructions in visible text or a field description instead.
|
|
287
|
-
|
|
288
|
-
| Prop | Type | Default | Notes |
|
|
289
|
-
|---|---|---|---|
|
|
290
|
-
| `children` | `ReactElement` | required | Focusable trigger that accepts Base UI props and a ref |
|
|
291
|
-
| `content` | `ReactNode` | required | Short, non-interactive hint shown on hover or focus |
|
|
292
|
-
| `side` | positioner side | `top` | Preferred side; placement can adjust near viewport edges |
|
|
293
|
-
| `delay` | `number` | `400` | Hover delay in milliseconds |
|
|
294
|
-
| `container` | portal container | document body | Use a themed host when the popup belongs to a nested theme |
|
|
295
|
-
| `className` | `string` | unset | Class on the popup |
|
|
296
|
-
|
|
297
|
-
Give icon-only triggers their own aria-label. The tooltip is a description, not a replacement for the control's name. Do not put links, buttons, or required instructions in the popup.
|
|
298
|
-
|
|
299
|
-
## Menu
|
|
300
|
-
|
|
301
|
-
Offer a short list of actions without leaving the current context. Use a Select when people are choosing a saved field value.
|
|
302
|
-
|
|
303
|
-
| Part | Props and responsibility |
|
|
304
|
-
|---|---|
|
|
305
|
-
| `Menu` | Root; use open/defaultOpen and onOpenChange when your app controls visibility |
|
|
306
|
-
| `Menu.Trigger` | Named trigger; render a Button for shared styling |
|
|
307
|
-
| `Menu.Content` | Popup; side defaults to bottom, align to start; container chooses the themed portal host |
|
|
308
|
-
| `Menu.Item` | Action text and click handler; disabled prevents selection |
|
|
309
|
-
| `Menu.Separator` | Divides related groups without adding a focus stop |
|
|
310
|
-
|
|
311
|
-
Name the trigger, keep action labels specific, and retain the default arrow-key and Escape behavior. A menu item should perform an action rather than contain another button.
|
|
312
|
-
|
|
313
|
-
## Toolbar
|
|
314
|
-
|
|
315
|
-
Group related actions, such as editing or filtering controls. Give the row an accessible name so people know what its controls affect.
|
|
199
|
+
### Themes and customization
|
|
316
200
|
|
|
317
|
-
|
|
318
|
-
|---|---|
|
|
319
|
-
| `Toolbar` | Root; name with aria-label; Base UI orientation controls the keyboard direction |
|
|
320
|
-
| `Toolbar.Group` | Groups related controls inside the toolbar |
|
|
321
|
-
| `Toolbar.Button` | Action; variant accepts Button variants and defaults to ghost |
|
|
322
|
-
| `Toolbar.Separator` | Visual division between groups |
|
|
201
|
+
Components follow the current light or dark theme through shared semantic tokens. Use `Button` for actions and its `render` prop for links styled as actions. Custom classes and token overrides are supported; preserve readable color pairs, visible focus and clear disabled states in both themes.
|
|
323
202
|
|
|
324
|
-
|
|
203
|
+
See [Restyling kbui](https://github.com/KhallilB/kbui/blob/main/docs/guides/restyling.md#theme-every-component-with-tokens) for paired color overrides and nested themes. Contributors should follow [Theme and state support](https://github.com/KhallilB/kbui/blob/main/docs/guides/adding-a-component.md#theme-and-state-support).
|
|
325
204
|
|
|
326
205
|
## `kb()`
|
|
327
206
|
|
|
328
|
-
`kb(name, attrs, className)` builds the class and `data-*` props for a component's root element. It omits values that are `false` or `undefined` and renders `true` as an empty attribute. It is mainly used when writing a new component; see [Adding a component](
|
|
207
|
+
`kb(name, attrs, className)` builds the class and `data-*` props for a component's root element. It omits values that are `false` or `undefined` and renders `true` as an empty attribute. It is mainly used when writing a new component; see [Adding a component](https://github.com/KhallilB/kbui/blob/main/docs/guides/adding-a-component.md).
|
|
329
208
|
|
|
330
209
|
## Build and test
|
|
331
210
|
|
|
@@ -336,447 +215,3 @@ bun run --cwd packages/react typecheck
|
|
|
336
215
|
```
|
|
337
216
|
|
|
338
217
|
Tests use Vitest and Testing Library in jsdom.
|
|
339
|
-
|
|
340
|
-
## Card and Grid
|
|
341
|
-
|
|
342
|
-
Combine [Card](#card) for related content and [Grid](#grid) for responsive arrangements.
|
|
343
|
-
|
|
344
|
-
## Card
|
|
345
|
-
|
|
346
|
-
Group related content with an optional title, summary, links, and actions. Card renders an article by default and adds no interaction of its own.
|
|
347
|
-
|
|
348
|
-
| Prop | Type | Default | Notes |
|
|
349
|
-
|---|---|---|---|
|
|
350
|
-
| `as` | `article` / `div` / `li` | `article` | Choose the container for the document structure; use li inside a list |
|
|
351
|
-
| `appearance` | `outlined` / `plain` | `outlined` | Outlined adds a raised surface; plain stays flat with a dividing line |
|
|
352
|
-
| `children` | `ReactNode` | unset | Related content; your app provides headings, links, and actions |
|
|
353
|
-
| `className`, `style`, `ref` | native element props | unset | Style and reference the chosen container |
|
|
354
|
-
|
|
355
|
-
Card adds no link, button, keyboard handler, or tab stop. If a link covers the whole card, keep other controls outside that link and style its focus state. Restyle with the card background, face, shadow, color, border, radius, and padding tokens; they share the theme's tactile materials.
|
|
356
|
-
|
|
357
|
-
## Grid
|
|
358
|
-
|
|
359
|
-
Arrange cards or other content in equal columns that fit the available width. Grid uses ordinary CSS layout, without an ARIA grid role or special keyboard navigation.
|
|
360
|
-
|
|
361
|
-
| Prop | Type | Default | Notes |
|
|
362
|
-
|---|---|---|---|
|
|
363
|
-
| `as` | `div` / `ul` / `ol` | `div` | Use ul or ol for a collection; children must then be list items |
|
|
364
|
-
| `layout` | `auto` / `stack` | `auto` | Auto fits equal columns to available width; stack uses one column |
|
|
365
|
-
| `children` | `ReactNode` | unset | Content in document and keyboard order |
|
|
366
|
-
| `className`, `style`, `ref` | native element props | unset | Style and reference the chosen container |
|
|
367
|
-
|
|
368
|
-
```tsx
|
|
369
|
-
<Grid as="ul" aria-label="Projects">
|
|
370
|
-
<Card as="li"><h2><a href="/project">Project</a></h2><p>Summary</p></Card>
|
|
371
|
-
</Grid>
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
Use --kb-grid-gap and --kb-grid-min-item-width to adjust spacing and column fit. Keep the visual order the same as the reading order.
|
|
375
|
-
|
|
376
|
-
## Checkbox
|
|
377
|
-
|
|
378
|
-
Use Checkbox when people can select options independently. It includes a label, help text, and error message. Pass `checked` and update it in `onCheckedChange`. Activating a mixed checkbox requests the checked state.
|
|
379
|
-
|
|
380
|
-
| Prop | Type | Default | Notes |
|
|
381
|
-
|---|---|---|---|
|
|
382
|
-
| `label` | `string` | required | Visible accessible label |
|
|
383
|
-
| `checked` | `boolean` | required | Controlled native checked state |
|
|
384
|
-
| `onCheckedChange` | `(checked: boolean) => void` | required | Next checked-state request |
|
|
385
|
-
| `indeterminate` | `boolean` | `false` | Announces mixed state; activation requests checked |
|
|
386
|
-
| `disabled` / `readOnly` | `boolean` | `false` | Block changes; disabled also leaves keyboard order |
|
|
387
|
-
| `description` / `error` | `string` | | Associated helper and invalid-state text |
|
|
388
|
-
| `visuallyHidden` | `boolean` | `false` | Hide label visually |
|
|
389
|
-
| `controlClassName` | `string` | | Added to the native checkbox |
|
|
390
|
-
| `ref` | `Ref<HTMLInputElement>` | | Native checkbox, including form and indeterminate state |
|
|
391
|
-
| `name` / `value` / `required` | native input props | | Form serialization and validation |
|
|
392
|
-
| `className` | `string` | | Root class |
|
|
393
|
-
|
|
394
|
-
```tsx
|
|
395
|
-
<Checkbox label="Receive release updates" name="updates" checked={updates} onCheckedChange={setUpdates} />
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
Clicking the label or pressing Space calls `onCheckedChange`. The checkbox changes only when your app updates `checked`; otherwise its checked or mixed state stays as it was. Native input props are supported. `style` applies to the input, and CSS custom properties also reach the visible mark. Use `--kb-checkbox-size` to change its size. In forced colors, the native checkbox and its focus outline remain visible.
|
|
399
|
-
## RadioGroup
|
|
400
|
-
|
|
401
|
-
Use RadioGroup when people need to choose one option and see all the choices at once. Give the group a label and each item a unique string value. Arrow keys change the selection and skip disabled options.
|
|
402
|
-
|
|
403
|
-
| Prop | Type | Default | Notes |
|
|
404
|
-
|---|---|---|---|
|
|
405
|
-
| `label` | `string` | required | Visible accessible group label |
|
|
406
|
-
| `value` | `string \| null` | required | Controlled choice; null means no choice |
|
|
407
|
-
| `onValueChange` | `(value: string) => void` | required | Next choice request |
|
|
408
|
-
| `appearance` | `"standard" \| "segmented"` | `"standard"` | Segmented tray for compact single-choice controls |
|
|
409
|
-
| `selectionMotion` | `"slide" \| "none"` | `"slide"` | Segmented selection background glides or moves instantly |
|
|
410
|
-
| `selectionTone` | `"primary" \| "neutral"` | `"primary"` | Accent pill by default; neutral uses the raised surface |
|
|
411
|
-
| `disabled` | `boolean` | `false` | Disable every item |
|
|
412
|
-
| `name` | `string` | | Native form field name |
|
|
413
|
-
| `description` / `error` | `string` | | Associated help and invalid-state text |
|
|
414
|
-
| `visuallyHidden` | `boolean` | `false` | Hide group label visually |
|
|
415
|
-
| `ref` | `Ref<HTMLDivElement>` | | Group root |
|
|
416
|
-
|
|
417
|
-
```tsx
|
|
418
|
-
<RadioGroup label="Density" name="density" value={density} onValueChange={setDensity}>
|
|
419
|
-
<RadioGroup.Item value="compact">Compact</RadioGroup.Item>
|
|
420
|
-
<RadioGroup.Item value="comfortable">Comfortable</RadioGroup.Item>
|
|
421
|
-
</RadioGroup>
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
`RadioGroup.Item` forwards Base UI Radio props, including `value`, `disabled` and the native control ref. `className` styles the item label; `controlClassName` styles its radio slot. The group uses the shared theme colors and shadows. Adjust the control size with `--kb-radiogroup-size` and the spacing with `--kb-radiogroup-gap`.
|
|
425
|
-
|
|
426
|
-
Set `appearance="segmented"` for compact choices such as view, density, or a filter. The control still behaves as a radio group, rather than tabs with associated panels. Your app manages the value and resets it when the form resets. An item’s `required` prop participates in native form validation. Changing the appearance keeps the same controls and focus.
|
|
427
|
-
|
|
428
|
-
The segmented selection uses a pill shape with the primary accent color by default. Set `selectionTone="neutral"` for a raised surface with neutral text and borders. Both tones follow the current light or dark theme. The background slides along the padded track and follows option widths, wrapped rows and layout changes. Set `selectionMotion="none"` for instant changes. Reduced-motion preferences disable movement regardless of this setting; forced-colors mode uses the selected option’s system highlight.
|
|
429
|
-
|
|
430
|
-
In dark mode, the primary pill uses a darker orange with white text for contrast. Override `--kb-radiogroup-primary-background` and `--kb-radiogroup-primary-color` together to customize this pair without changing other primary controls.
|
|
431
|
-
|
|
432
|
-
## Select
|
|
433
|
-
|
|
434
|
-
Use Select to choose one option from a dropdown. Each option has a string value, a visible label, and an optional disabled flag. Pass `null` to show the placeholder. Your app stores the selected value and decides whether it is valid.
|
|
435
|
-
|
|
436
|
-
| Prop | Type | Default | Notes |
|
|
437
|
-
|---|---|---|---|
|
|
438
|
-
| `label` | `string` | required | Visible field label and accessible popup name |
|
|
439
|
-
| `value` | `string \| null` | required | Controlled selection; null means unset |
|
|
440
|
-
| `onValueChange` | `(value: string \| null) => void` | required | Next valid choice request |
|
|
441
|
-
| `options` | `readonly SelectOption[]` | required | Ordered unique values, labels and optional disabled flags |
|
|
442
|
-
| `placeholder` | `string` | `"Choose an option"` | Text for unset values |
|
|
443
|
-
| `description` / `error` | `string` | | Associated help and invalid-state text |
|
|
444
|
-
| `disabled` / `readOnly` | `boolean` | `false` | Prevent edits; disabled also blocks form submission |
|
|
445
|
-
| `name` | `string` | | Native hidden form field name |
|
|
446
|
-
| `container` | `Select.Portal.Props["container"]` | field root | Portal host; default retains nested theme |
|
|
447
|
-
| `controlClassName` / `popupClassName` | `string` | | Trigger and popup slot classes |
|
|
448
|
-
| `className` / `ref` | root div props | | Wrapper class and native root ref |
|
|
449
|
-
|
|
450
|
-
```tsx
|
|
451
|
-
<Select label="View" name="view" value={view} onValueChange={setView} options={[{ value: "recent", label: "Recent" }, { value: "all", label: "All records" }]} />
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
Use the arrow keys or type to find an option, Enter to select it, and Escape to close the popup and return focus. Disabled options cannot be selected. When there are no options, the trigger is disabled and “No options available” appears below it. Opening the popup leaves the page scrollable. Pointer selection returns focus without a keyboard ring; keyboard dismissal keeps a visible focus indicator.
|
|
455
|
-
|
|
456
|
-
By default, the popup mounts inside the field root and inherits its theme. If you provide a custom `container`, apply the theme there too. Use `--kb-select-popup-min-width`, `--kb-select-max-height`, and `--kb-select-layer` to adjust the popup’s size and stacking order.
|
|
457
|
-
|
|
458
|
-
## Combobox
|
|
459
|
-
|
|
460
|
-
Use Combobox when people need to filter a longer option list by typing before choosing one value. Each option has a string `value`, a visible `label`, and an optional `disabled` flag. Pass `null` when nothing is selected.
|
|
461
|
-
|
|
462
|
-
| Prop | Type | Default | Notes |
|
|
463
|
-
|---|---|---|---|
|
|
464
|
-
| `label` | `string` | required | Visible field label and accessible combobox name |
|
|
465
|
-
| `options` | `readonly ComboboxOption[]` | required | Selectable options filtered by label |
|
|
466
|
-
| `value` | `string \| null` | required | Controlled selection; `null` means unset |
|
|
467
|
-
| `onValueChange` | `(value: string \| null) => void` | required | Called when an option is selected or cleared |
|
|
468
|
-
| `placeholder` | `string` | unset | Input placeholder shown when empty |
|
|
469
|
-
| `emptyMessage` | `ReactNode` | `"No matching options"` | Polite status text when no options match |
|
|
470
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Control height and text scale |
|
|
471
|
-
| `description` / `error` | `ReactNode` | unset | Associated help and invalid-state text |
|
|
472
|
-
| `disabled` / `readOnly` | `boolean` | `false` | Prevent edits; disabled also blocks form submission |
|
|
473
|
-
| `clearLabel` / `toggleLabel` | `string` | derived from `label` | Accessible names for the clear and toggle buttons |
|
|
474
|
-
| `container` | `Combobox.Portal.Props["container"]` | field root | Portal host; default retains nested theme |
|
|
475
|
-
| `classNames` | `ClassNames<ComboboxSlot>` | unset | Extra classes for inner parts |
|
|
476
|
-
|
|
477
|
-
```tsx
|
|
478
|
-
import { useState } from "react";
|
|
479
|
-
import { Combobox } from "@kb.ui/react";
|
|
480
|
-
|
|
481
|
-
const regions = [
|
|
482
|
-
{ value: "us-east-1", label: "US East (N. Virginia)" },
|
|
483
|
-
{ value: "eu-central-1", label: "EU Central (Frankfurt)" },
|
|
484
|
-
];
|
|
485
|
-
|
|
486
|
-
export function RegionCombobox() {
|
|
487
|
-
const [region, setRegion] = useState<string | null>("us-east-1");
|
|
488
|
-
return (
|
|
489
|
-
<Combobox
|
|
490
|
-
label="Deployment region"
|
|
491
|
-
options={regions}
|
|
492
|
-
value={region}
|
|
493
|
-
onValueChange={setRegion}
|
|
494
|
-
placeholder="Search regions..."
|
|
495
|
-
/>
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
## MultiSelect
|
|
501
|
-
|
|
502
|
-
Use MultiSelect when people need to search a longer list and keep multiple selections visible as removable chips. Selected values render inside a named chip toolbar with keyboard arrow/Backspace/Delete support and per-chip remove buttons.
|
|
503
|
-
|
|
504
|
-
| Prop | Type | Default | Notes |
|
|
505
|
-
|---|---|---|---|
|
|
506
|
-
| `label` | `string` | required | Visible field label and accessible combobox name |
|
|
507
|
-
| `options` | `readonly MultiSelectOption[]` | required | Selectable options filtered by label |
|
|
508
|
-
| `value` | `readonly string[]` | required | Controlled array of selected option values |
|
|
509
|
-
| `onValueChange` | `(value: string[]) => void` | required | Called when selections are added, removed, or cleared |
|
|
510
|
-
| `placeholder` | `string` | unset | Input placeholder |
|
|
511
|
-
| `emptyMessage` | `ReactNode` | `"No matching options"` | Polite status text when no options match |
|
|
512
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Control height and text scale |
|
|
513
|
-
| `description` / `error` | `ReactNode` | unset | Associated help and invalid-state text |
|
|
514
|
-
| `disabled` / `readOnly` | `boolean` | `false` | Prevent edits and chip removal |
|
|
515
|
-
| `removeLabel` | `(option: MultiSelectOption) => string` | `"Remove {option.label}"` | Accessible name for each chip remove button |
|
|
516
|
-
| `container` | `Combobox.Portal.Props["container"]` | field root | Portal host; default retains nested theme |
|
|
517
|
-
| `classNames` | `ClassNames<MultiSelectSlot>` | unset | Extra classes for inner parts |
|
|
518
|
-
|
|
519
|
-
```tsx
|
|
520
|
-
import { useState } from "react";
|
|
521
|
-
import { MultiSelect } from "@kb.ui/react";
|
|
522
|
-
|
|
523
|
-
const scopes = [
|
|
524
|
-
{ value: "payments:read", label: "Payments read" },
|
|
525
|
-
{ value: "webhooks:manage", label: "Webhooks" },
|
|
526
|
-
{ value: "reporting:export", label: "Reporting export" },
|
|
527
|
-
];
|
|
528
|
-
|
|
529
|
-
export function ScopeMultiSelect() {
|
|
530
|
-
const [selected, setSelected] = useState<string[]>(["payments:read"]);
|
|
531
|
-
return (
|
|
532
|
-
<MultiSelect
|
|
533
|
-
label="API scopes"
|
|
534
|
-
options={scopes}
|
|
535
|
-
value={selected}
|
|
536
|
-
onValueChange={setSelected}
|
|
537
|
-
placeholder="Filter scopes..."
|
|
538
|
-
/>
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
## Switch
|
|
544
|
-
|
|
545
|
-
Use Switch for a preference that takes effect as soon as it changes. Pass `checked` and update it in `onCheckedChange`; your app handles saving and form reset. Switch uses a labelled native checkbox with `role="switch"`. Use Checkbox when people are selecting items instead.
|
|
546
|
-
|
|
547
|
-
| Prop | Type | Default | Notes |
|
|
548
|
-
|---|---|---|---|
|
|
549
|
-
| `label` | `string` | required | Associated visible label and accessible name |
|
|
550
|
-
| `checked` | `boolean` | required | Current controlled state |
|
|
551
|
-
| `onCheckedChange` | `(checked: boolean) => void` | required | Requests next state; owner updates checked |
|
|
552
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Visual track size (`36×20px`, `44×24px`, `56×32px`); `Fieldset` defaults nested switches to `"sm"` while keeping a 44px touch target |
|
|
553
|
-
| `tone` | `"accent" \| "neutral" \| "info" \| "success" \| "warning" \| "danger"` | `"accent"` | Checked-state track tone when `onTone` is unset |
|
|
554
|
-
| `offTone` / `onTone` | `SwitchTone` | `"neutral"` / `tone` | Independent track tone for unchecked and checked sides |
|
|
555
|
-
| `offColor` / `onColor` | `string` | | Custom CSS color for the unchecked or checked track |
|
|
556
|
-
| `description` / `error` | `string` | | Associated helper/error text; error sets aria-invalid |
|
|
557
|
-
| `disabled` / `readOnly` | `boolean` | `false` | Disabled blocks focus/changes; read-only keeps focus and form value while blocking edits |
|
|
558
|
-
| `visuallyHidden` | `boolean` | `false` | Hide label visually, keep its accessible name |
|
|
559
|
-
| `offIcon` / `onIcon` | `ReactNode` | | Decorative slots; do not place interactive content inside |
|
|
560
|
-
| `name` / `value` / `form` / `required` | native input props | | Native form ownership, successful value and validation |
|
|
561
|
-
| `ref` | `Ref<HTMLInputElement>` | | Native checkbox, never an extra hidden control |
|
|
562
|
-
| `className` / `controlClassName` | `string` | | Root/native input class |
|
|
563
|
-
| `style` | `CSSProperties` | | Native input styles; CSS custom properties also reach visible track and thumb |
|
|
564
|
-
|
|
565
|
-
```tsx
|
|
566
|
-
import { useState } from "react";
|
|
567
|
-
import { Switch } from "@kb.ui/react";
|
|
568
|
-
|
|
569
|
-
export function Preference() {
|
|
570
|
-
const [checked, setChecked] = useState(false);
|
|
571
|
-
return <Switch label="Email updates" checked={checked} onCheckedChange={setChecked} name="updates" />;
|
|
572
|
-
}
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
Import `useState` from React and `Switch` from `@kb.ui/react`. Clicking or pressing Space calls `onCheckedChange`. Unchecked or disabled controls submit no value; a checked control submits its native value (`"on"` unless you supply one). Reset `checked` in the form’s `onReset` handler when needed. Use `offTone`/`onTone` or `offColor`/`onColor` when both sides of a toggle carry distinct state colors. The `switch` token group controls its appearance in both themes, and reduced motion removes the thumb’s travel animation.
|
|
576
|
-
|
|
577
|
-
## NumberField
|
|
578
|
-
|
|
579
|
-
Use NumberField for quantities people can type or adjust with step buttons. Your app sets the range and validates the value. See [Numeric fields](../../docs/guides/number-fields.md) for examples, keyboard behavior, and styling. Available since v0.6.0.
|
|
580
|
-
|
|
581
|
-
| Prop | Type | Default | Notes |
|
|
582
|
-
|---|---|---|---|
|
|
583
|
-
| `label` | `string` | required | Visible field name; include the quantity or unit |
|
|
584
|
-
| `value` | `number` or `null` | required | Controlled number; null means no answer |
|
|
585
|
-
| `onValueChange` | `(value: number \| null) => void` | required | Update your stored value after an edit |
|
|
586
|
-
| `min`, `max` | `number` | unbounded | Bounds for stepping; your app validates direct drafts |
|
|
587
|
-
| `step` | `number` | `1` | Positive increment and alignment |
|
|
588
|
-
| `locale` | `Intl.LocalesArgument` | runtime locale | Number formatting and editing locale |
|
|
589
|
-
| `size` | `sm` / `md` / `lg` | `md` | Control size; lg suits touch-heavy tasks |
|
|
590
|
-
| `description`, `error` | `string` | unset | Associated help or a specific correction; error marks the field invalid |
|
|
591
|
-
| `disabled`, `readOnly` | `boolean` | `false` | Prevent changes; disabled also prevents submission |
|
|
592
|
-
| `name`, `form`, `required` | native form props | unset / false | Form ownership and validation |
|
|
593
|
-
| `visuallyHidden` | `boolean` | `false` | Hide the visual label while keeping its accessible name |
|
|
594
|
-
| `decrementLabel`, `incrementLabel` | `string` | Decrease/Increase + label | Localized names for the step actions |
|
|
595
|
-
| `inputRef`, `inputProps` | input ref / native props | unset | Visible input access and supported native event or ARIA extensions |
|
|
596
|
-
| `className`, `groupClassName`, `inputClassName` | `string` | unset | Classes for root, step group, and input |
|
|
597
|
-
|
|
598
|
-
Native div props and the root ref pass through to the wrapper. Any `aria-describedby` values from the root and `inputProps` are added after the help and error IDs. Use the explicit NumberField props for the input’s value, type, disabled/read-only state, name, required state, and ref; `inputProps` cannot override those. Custom event handlers can prevent defaults, so take care to preserve keyboard behavior.
|
|
599
|
-
|
|
600
|
-
## FileInput
|
|
601
|
-
|
|
602
|
-
Use FileInput to choose files, review the selected list, and remove items. Your app decides which files to accept, keeps the File objects, and handles uploads. See [Retained file selection](../../docs/guides/file-inputs.md) for examples, keyboard behavior, and styling. Available since v0.6.0.
|
|
603
|
-
|
|
604
|
-
| Prop | Type | Default | Notes |
|
|
605
|
-
|---|---|---|---|
|
|
606
|
-
| `label` | `string` | required | Visible field name and accessible picker context |
|
|
607
|
-
| `items` | `readonly FileInputItem[]` | required | Retained files with stable ids, names, and optional descriptions |
|
|
608
|
-
| `onFiles` | `(files: File[]) => void` | required | Check the selection and update retained files in your app |
|
|
609
|
-
| `onRemove` | `(id: string) => void` | required | Request removal; update items to confirm it |
|
|
610
|
-
| `accept` | `string` | unset | Native picker hint, such as image/*; does not validate files |
|
|
611
|
-
| `multiple` | `boolean` | `true` | Allow multiple selection; use a singular chooseLabel for single mode |
|
|
612
|
-
| `disabled`, `readOnly` | `boolean` | `false` | Prevent edits while keeping the retained list visible |
|
|
613
|
-
| `description`, `error` | `string` | unset | Help or actionable rejection text associated with the field |
|
|
614
|
-
| `visuallyHidden` | `boolean` | `false` | Hide the visual label while preserving its accessible name |
|
|
615
|
-
| `chooseLabel` | `string` | Choose files | Localized visible picker action |
|
|
616
|
-
| `emptyMessage` | `string` | No files added. | Localized empty-state text |
|
|
617
|
-
| `removeLabel` | `(item: FileInputItem) => string` | Remove + filename | Accessible remove action; keep the filename in the name |
|
|
618
|
-
| `removedMessage` | `(item: FileInputItem) => string` | filename + removed. | Announcement after removal is confirmed |
|
|
619
|
-
| `selectionMessage` | `(count: number) => string` | count + files selected. | Announcement after native selection |
|
|
620
|
-
| `renderItem` | `(item: FileInputItem) => ReactNode` | name + description | Custom item content; keep visible file identity |
|
|
621
|
-
| `inputRef`, `triggerRef` | element refs | unset | Hidden native input and visible picker access |
|
|
622
|
-
| `triggerClassName`, `listClassName`, `itemClassName` | `string` | unset | Classes for picker, retained list, and items |
|
|
623
|
-
|
|
624
|
-
Root native div props/ref and className pass through. Root aria-describedby merges after helper/error. Item button refs remain internal to preserve focus; use public item/content classes and renderItem for presentation. Use these props and classes rather than reaching into individual item buttons. The `×` mark is decorative; removal has a full accessible filename label.
|
|
625
|
-
|
|
626
|
-
## Heading
|
|
627
|
-
|
|
628
|
-
Native `h1`–`h6` headings with visual size independent of rank.
|
|
629
|
-
|
|
630
|
-
| Prop | Type | Default | Notes |
|
|
631
|
-
|---|---|---|---|
|
|
632
|
-
| `level` | `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `2` | Document rank; choose from page structure |
|
|
633
|
-
| `size` | `sm` \| `md` \| `lg` \| `xl` \| `display` | From level | Levels 1–6 map to xl, lg, md, sm, sm, sm; display is an explicit hero size |
|
|
634
|
-
| `className`, `ref` | Native heading props | unset | Classes merge; ref targets native heading |
|
|
635
|
-
|
|
636
|
-
Use one page title and nest section ranks without skipping levels. Adjust `size` for context without changing the outline. Headings have no margin; use Grid or parent layout for spacing. See [Typography](../../docs/guides/typography.md) for composition, CSS recipes and accessibility guidance.
|
|
637
|
-
|
|
638
|
-
## Text
|
|
639
|
-
|
|
640
|
-
Body paragraphs, inline text and block grouping.
|
|
641
|
-
|
|
642
|
-
| Prop | Type | Default | Notes |
|
|
643
|
-
|---|---|---|---|
|
|
644
|
-
| `as` | `p` \| `span` \| `div` | `p` | Use span inside paragraphs; div for block children |
|
|
645
|
-
| `size` | `sm` \| `md` \| `lg` | `md` | Existing small/body roles (13px, 15px), then 1.125rem |
|
|
646
|
-
| `tone` | `default` \| `muted` | `default` | Primary ink or readable secondary ink |
|
|
647
|
-
| `className`, `ref` | Native element props | unset | Ref type follows chosen element |
|
|
648
|
-
|
|
649
|
-
Body line height is 1.6; block content is bounded to 65ch by `--kb-text-measure`. Text has no margin. Inline spans keep natural flow. Use native `strong` and `em` for meaningful emphasis. Do not nest paragraphs or place block children inside the default paragraph.
|
|
650
|
-
|
|
651
|
-
## Link
|
|
652
|
-
|
|
653
|
-
Native anchor for navigation, with persistent underline and visible keyboard focus.
|
|
654
|
-
|
|
655
|
-
| Prop | Type | Default | Notes |
|
|
656
|
-
|---|---|---|---|
|
|
657
|
-
| `href` | `string` | required | Navigation destination |
|
|
658
|
-
| `target`, `rel`, `download`, `aria-current` | Native anchor props | unset | Passed through without rewriting |
|
|
659
|
-
| `className`, `ref` | Native anchor props | unset | Ref targets anchor |
|
|
660
|
-
|
|
661
|
-
Use descriptive link text. Use Button for an action. Links inherit surrounding type size; Tab focuses, Enter follows, and Space retains native behavior. Callers own new-tab wording and target/rel policy. No disabled link or router adapter is provided; apply `kb-link` to a router component that renders an anchor with href. Color, underline and focus must remain visible.
|
|
662
|
-
|
|
663
|
-
## Code
|
|
664
|
-
|
|
665
|
-
Literal inline code, commands and paths in native `code`.
|
|
666
|
-
|
|
667
|
-
| Prop | Type | Default | Notes |
|
|
668
|
-
|---|---|---|---|
|
|
669
|
-
| `children` | `ReactNode` | unset | Pass markup as a string to display it literally |
|
|
670
|
-
| `className`, `ref` | Native code props | unset | Ref targets code element |
|
|
671
|
-
|
|
672
|
-
Monospace text inherits surrounding ink and line height, uses a relative size and wraps long tokens. Case and whitespace remain intact; no HTML parsing occurs. This component styles inline fragments; multiline listings need a separate `pre`/`code` recipe without inline padding. Syntax highlighting and copy controls are outside this component.
|
|
673
|
-
|
|
674
|
-
## Container
|
|
675
|
-
|
|
676
|
-
Centered page boundary with responsive inline gutters. Native props and matching ref pass through. See [Layout composition](../../docs/guides/layout.md) for rules, CSS recipes and token overrides.
|
|
677
|
-
|
|
678
|
-
| Prop | Values | Default |
|
|
679
|
-
|---|---|---|
|
|
680
|
-
| `as` | `div` `main` `section` `article` `aside` `header` `footer` | `div` |
|
|
681
|
-
| `size` | `sm` (40rem) `md` (64rem) `lg` (80rem) `full` (unbounded) | `lg` |
|
|
682
|
-
| `gutter` | Shared 1–2rem inline padding; false removes it | `true` |
|
|
683
|
-
|
|
684
|
-
Non-default generic native elements require an explicit `as`; native props and refs follow that element. Explicit `gutter` owns its data attribute even when caller attributes conflict. Widths include gutters. Use one page boundary; nested containers should disable gutters when the parent owns padding.
|
|
685
|
-
|
|
686
|
-
## Inline
|
|
687
|
-
|
|
688
|
-
Wrapping row for independent content or controls. Adds no toolbar role or keyboard handling; controls retain native tab order. Native props and matching ref pass through.
|
|
689
|
-
|
|
690
|
-
| Prop | Values | Default |
|
|
691
|
-
|---|---|---|
|
|
692
|
-
| `as` | `div` `ul` `ol` `nav` | `div` |
|
|
693
|
-
| `gap` | `none` `sm` (0.5rem) `md` (1rem) `lg` (1.5rem) | `md` |
|
|
694
|
-
| `align` | `start` `center` `end` `baseline` `stretch` | `center` |
|
|
695
|
-
| `justify` | `start` `center` `end` `between` | `start` |
|
|
696
|
-
|
|
697
|
-
Non-default generic native elements require an explicit `as`. Lists retain markers and native list spacing. Use li children. Choose Toolbar when actions require its coordinated arrow-key model. See [Layout composition](../../docs/guides/layout.md).
|
|
698
|
-
|
|
699
|
-
## Split
|
|
700
|
-
|
|
701
|
-
Two children form equal or weighted columns through layout-owned `.kb-split-track` wrappers. Below the available-width threshold, columns stack in source order. Layout uses CSS alone, including inside nested panels. Native props and matching ref pass through.
|
|
702
|
-
|
|
703
|
-
| Prop | Values | Default |
|
|
704
|
-
|---|---|---|
|
|
705
|
-
| `as` | `div` `section` `article` | `div` |
|
|
706
|
-
| `ratio` | `equal` (1:1) `wide-start` (2:1) `wide-end` (1:2) | `equal` |
|
|
707
|
-
| `collapse` | `sm` (32rem) `md` (48rem) `lg` (64rem) | `md` |
|
|
708
|
-
| `gap` | `none` `sm` `md` `lg`, same scale as Inline | `md` |
|
|
709
|
-
| `align` | `start` `center` `end` `baseline` `stretch` | `stretch` |
|
|
710
|
-
| `classNames` | `{ track?: string }`, applied to each column track | unset |
|
|
711
|
-
|
|
712
|
-
Provide two children; empty conditional children add no track. Each track owns column sizing, so Text keeps its reading measure and nested token overrides stay local. Non-default generic native elements require an explicit `as`. Use Grid for variable child counts. See [Layout composition](../../docs/guides/layout.md).
|
|
713
|
-
|
|
714
|
-
## Separator
|
|
715
|
-
|
|
716
|
-
Native hr thematic break; decorative dividers are hidden from assistive technology. Native hr props and ref pass through; orientation and decorative own role, aria-hidden and aria-orientation.
|
|
717
|
-
|
|
718
|
-
| Prop | Values | Default |
|
|
719
|
-
|---|---|---|
|
|
720
|
-
| `orientation` | `horizontal` `vertical` | `horizontal` |
|
|
721
|
-
| `decorative` | Hide a visual-only divider from assistive technology | `false` |
|
|
722
|
-
|
|
723
|
-
Vertical rules stretch inside Inline and have a 1rem minimum height. No tab stop or resizing interaction is added. See [Layout composition](../../docs/guides/layout.md).
|
|
724
|
-
|
|
725
|
-
## Textarea
|
|
726
|
-
|
|
727
|
-
Use Textarea for multiline notes, summaries, or configuration payloads. It pairs a native textarea with a persistent label, optional help text, and validation feedback.
|
|
728
|
-
|
|
729
|
-
| Prop | Type | Default | Notes |
|
|
730
|
-
|---|---|---|---|
|
|
731
|
-
| `label` | `string` | required | Visible field label and accessible name |
|
|
732
|
-
| `visuallyHidden` | `boolean` | `false` | Hides the label visually while keeping its accessible name |
|
|
733
|
-
| `description` | `string` | unset | Supporting help text below the control |
|
|
734
|
-
| `error` | `string` | unset | Validation message; marks the control invalid |
|
|
735
|
-
| `rows` | `number` | `4` | Initial visible line count on the native textarea |
|
|
736
|
-
| `resize` | `"vertical" \| "none" \| "both"` | `"vertical"` | Controls user drag-resizing axis |
|
|
737
|
-
| `onValueChange` | `(value: string) => void` | unset | Called with the next string value on change |
|
|
738
|
-
| `classNames` | `ClassNames<"label" \| "control" \| "description" \| "error">` | unset | Classes for inner parts |
|
|
739
|
-
|
|
740
|
-
Other native textarea props (`value`, `defaultValue`, `onChange`, `placeholder`, `disabled`, `readOnly`, `required`, `name`, `form`, `ref`) pass through to the `<textarea>` element. Adjust minimum height and padding with `--kb-textarea-min-height`, `--kb-textarea-padding-block`, and `--kb-textarea-padding-inline`.
|
|
741
|
-
|
|
742
|
-
## Fieldset
|
|
743
|
-
|
|
744
|
-
Use Fieldset to group related controls into a named form section using native `fieldset` and `legend` semantics. Setting `disabled` disables descendant form controls natively.
|
|
745
|
-
|
|
746
|
-
| Prop | Type | Default | Notes |
|
|
747
|
-
|---|---|---|---|
|
|
748
|
-
| `legend` | `ReactNode` | required | Section heading rendered inside the native legend |
|
|
749
|
-
| `visuallyHidden` | `boolean` | `false` | Hides the legend visually while keeping the group name |
|
|
750
|
-
| `description` | `ReactNode` | unset | Section help text linked through aria-describedby |
|
|
751
|
-
| `error` | `ReactNode` | unset | Group-level error linked through aria-describedby |
|
|
752
|
-
| `disabled` | `boolean` | `false` | Disables all descendant controls in the fieldset |
|
|
753
|
-
| `classNames` | `ClassNames<"legend" \| "description" \| "fields" \| "error">` | unset | Classes for inner parts |
|
|
754
|
-
|
|
755
|
-
Other native fieldset props and `ref` pass through to the `<fieldset>` element. Use `--kb-fieldset-gap`, `--kb-fieldset-fields-gap`, and `--kb-fieldset-legend-size` to tune spacing and legend typography.
|
|
756
|
-
|
|
757
|
-
## FormActions
|
|
758
|
-
|
|
759
|
-
Use FormActions at the bottom of a form or section to align submit, reset, and secondary buttons with consistent wrapping and spacing. Buttons stay in natural Tab order without toolbar arrow-key navigation.
|
|
760
|
-
|
|
761
|
-
| Prop | Type | Default | Notes |
|
|
762
|
-
|---|---|---|---|
|
|
763
|
-
| `align` | `"end" \| "start" \| "between"` | `"end"` | Horizontal button alignment |
|
|
764
|
-
| `divider` | `boolean` | `false` | Adds a top border and spacing above the action row |
|
|
765
|
-
| `children` | `ReactNode` | unset | Form buttons in reading and Tab order |
|
|
766
|
-
|
|
767
|
-
Other native div props and `ref` pass through. Use `--kb-formactions-gap` and `--kb-formactions-padding-top` to adjust spacing.
|
|
768
|
-
|
|
769
|
-
## ErrorSummary
|
|
770
|
-
|
|
771
|
-
Place ErrorSummary at the top of a form when submission fails so people can see what went wrong and jump directly to each invalid field. When `items` is empty, nothing is rendered.
|
|
772
|
-
|
|
773
|
-
| Prop | Type | Default | Notes |
|
|
774
|
-
|---|---|---|---|
|
|
775
|
-
| `items` | `readonly ErrorSummaryItem[]` | required | Ordered `{ id?, href, label }` entries linking to invalid fields |
|
|
776
|
-
| `title` | `ReactNode` | `"There is a problem"` | Heading text naming the alert region |
|
|
777
|
-
| `description` | `ReactNode` | unset | Optional recovery guidance above the error list |
|
|
778
|
-
| `headingLevel` | `2 \| 3 \| 4` | `2` | Heading rank for the summary title |
|
|
779
|
-
| `onItemSelect` | `(href: string, event: MouseEvent<HTMLAnchorElement>) => void` | unset | Called when a recovery link is clicked |
|
|
780
|
-
| `classNames` | `ClassNames<"title" \| "description" \| "list" \| "item" \| "link">` | unset | Classes for inner parts |
|
|
781
|
-
|
|
782
|
-
ErrorSummary renders an alert region with `tabIndex={-1}` so your submit handler can focus it when validation fails. Clicking an `#id` link focuses the matching control or the first enabled control inside a referenced group. Pair ErrorSummary with inline `error` props on each invalid field.
|