@kb.ui/react 0.10.3 → 0.11.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 +130 -708
- 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/CopyableText/CopyableText.d.ts +38 -0
- package/dist/components/CopyableText/content.d.ts +14 -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/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/Popover/Popover.d.ts +55 -0
- package/dist/components/Skeleton/Skeleton.d.ts +32 -0
- package/dist/components/Spinner/Spinner.d.ts +26 -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 +29 -4
- package/dist/index.js +3510 -1232
- 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/Container.md +41 -0
- package/docs/components/CopyableText.md +93 -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 +46 -0
- package/docs/components/Fieldset.md +42 -0
- package/docs/components/FileInput.md +74 -0
- package/docs/components/FormActions.md +45 -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/Panel.md +145 -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/Skeleton.md +46 -0
- package/docs/components/Spinner.md +40 -0
- package/docs/components/Split.md +47 -0
- package/docs/components/Stat.md +34 -0
- package/docs/components/Status.md +47 -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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
`Dialog` is composed from parts. Base UI handles focus trapping, closing on Escape and scroll locking.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-dialog--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Button, Dialog } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Dialog>
|
|
16
|
+
<Dialog.Trigger render={<Button />}>View details</Dialog.Trigger>
|
|
17
|
+
<Dialog.Content
|
|
18
|
+
title="Project details"
|
|
19
|
+
description="Current project status."
|
|
20
|
+
>
|
|
21
|
+
<p>Three tasks remain.</p>
|
|
22
|
+
<Dialog.Actions>
|
|
23
|
+
<Dialog.Close render={<Button />}>Done</Dialog.Close>
|
|
24
|
+
</Dialog.Actions>
|
|
25
|
+
</Dialog.Content>
|
|
26
|
+
</Dialog>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## More examples
|
|
32
|
+
|
|
33
|
+
- [A confirmation task](https://kbui.kcb.pro/storybook/?path=/story/components-dialog--confirm): Open and close a modal from its trigger.
|
|
34
|
+
- [Structured content](https://kbui.kcb.pro/storybook/?path=/story/components-dialog--sections): Inspect header, body, footer, and actions; opens a modal.
|
|
35
|
+
- [A custom layout](https://kbui.kcb.pro/storybook/?path=/story/components-dialog--custom-layout): Inspect composed titles and descriptions; opens a modal.
|
|
36
|
+
|
|
37
|
+
## Reference
|
|
38
|
+
|
|
39
|
+
| Part | Purpose |
|
|
40
|
+
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `Dialog` | Root. Accepts `open`, `defaultOpen` and `onOpenChange` for controlled use. |
|
|
42
|
+
| `Dialog.Trigger` | Opens the dialog. Use `render={<Button />}` to style it as a button. |
|
|
43
|
+
| `Dialog.Content` | The dialog. `title` and `description` set its accessible name and description; `container` changes where it mounts. |
|
|
44
|
+
| `Content.layout` | `"center"` (default) or `"drawer"`; drawer slides from inline end, uses `--kb-dialog-width` and scrolls direct Body independently. |
|
|
45
|
+
| `Dialog.Title`, `Dialog.Description` | For custom layouts. Use these or the `Dialog.Content` props in a given dialog, not both, or it gets two titles. |
|
|
46
|
+
| `Dialog.Header`, `Dialog.Body`, `Dialog.Footer` | Optional structured sections; accept native `div` props and refs. Centered padding follows `--kb-dialog-{header,body,footer}-padding`; drawer sections use `--kb-dialog-padding`. |
|
|
47
|
+
| `Dialog.Actions` | Aligns buttons along the bottom right. |
|
|
48
|
+
| `Dialog.Close` | Closes the dialog. |
|
|
49
|
+
|
|
50
|
+
| Prop on root or Content | Type | Default | Notes |
|
|
51
|
+
| ------------------------ | ---------------- | ------------- | ----------------------------------------------------------------------------- |
|
|
52
|
+
| `open` on Dialog | `boolean` | uncontrolled | Current visibility when your app controls the dialog |
|
|
53
|
+
| `defaultOpen` on Dialog | `boolean` | `false` | Initial visibility; avoid starting open in a reading surface |
|
|
54
|
+
| `onOpenChange` on Dialog | Base UI callback | unset | Receives the next visibility and change details |
|
|
55
|
+
| `title` on Content | `ReactNode` | unset | Visible title and accessible name; use Dialog.Title for custom markup instead |
|
|
56
|
+
| `description` on Content | `ReactNode` | unset | Supporting description; use Dialog.Description for custom markup instead |
|
|
57
|
+
| `container` on Content | portal container | document body | Themed host for a nested dialog |
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Dialog>
|
|
61
|
+
<Dialog.Trigger render={<Button />}>Open</Dialog.Trigger>
|
|
62
|
+
<Dialog.Content title="Rename file">
|
|
63
|
+
<Input label="Name" />
|
|
64
|
+
<Dialog.Actions>
|
|
65
|
+
<Dialog.Close render={<Button variant="ghost" />}>Cancel</Dialog.Close>
|
|
66
|
+
<Button>Save</Button>
|
|
67
|
+
</Dialog.Actions>
|
|
68
|
+
</Dialog.Content>
|
|
69
|
+
</Dialog>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Related components
|
|
73
|
+
|
|
74
|
+
Use [Menu](Menu.md) for a short action list and [Callout](Callout.md) for a message that belongs in the page.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Drawer and confirmation patterns
|
|
78
|
+
|
|
79
|
+
The [overlay guide](../../../../docs/guides/forms-and-overlays.md#drawer-pattern) supplies complete drawer and asynchronous confirmation modules. Drawers use `Content layout="drawer"` with direct Header, Body and Footer sections. Header/actions remain visible while Body scrolls; the drawer follows logical direction and dynamic viewport height. Content title/description props automatically form a drawer Header. Focus a composed title initially for long content. Confirmations focus Cancel first, reject duplicate/pending dismissal, retain errors for retry and close only after success.
|
|
80
|
+
|
|
81
|
+
- [Drawer](https://kbui.kcb.pro/storybook/?path=/story/components-dialog--drawer)
|
|
82
|
+
- [Failure and retry](https://kbui.kcb.pro/storybook/?path=/story/components-dialog--confirmation-recovery)
|
|
83
|
+
|
|
84
|
+
Use [Popover](Popover.md) for non-modal anchored controls and [Disclosure](Disclosure.md) for supporting details inline.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Disclosure
|
|
2
|
+
|
|
3
|
+
Reveal optional details or advanced controls inline. Base UI Collapsible owns the open state, trigger relationship and hidden panel behavior.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-disclosure--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Disclosure, Input } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function AdvancedSettings() {
|
|
14
|
+
return (
|
|
15
|
+
<Disclosure>
|
|
16
|
+
<Disclosure.Trigger>Advanced settings</Disclosure.Trigger>
|
|
17
|
+
<Disclosure.Panel keepMounted>
|
|
18
|
+
<Input label="Reply-to address" defaultValue="team@example.com" />
|
|
19
|
+
</Disclosure.Panel>
|
|
20
|
+
</Disclosure>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## More examples
|
|
26
|
+
|
|
27
|
+
- [Retained draft](https://kbui.kcb.pro/storybook/?path=/story/components-disclosure--retained-draft): preserve an uncontrolled field through collapse.
|
|
28
|
+
- [Controlled](https://kbui.kcb.pro/storybook/?path=/story/components-disclosure--controlled): caller-owned open state.
|
|
29
|
+
- [Disabled](https://kbui.kcb.pro/storybook/?path=/story/components-disclosure--disabled): unavailable details.
|
|
30
|
+
|
|
31
|
+
## Reference
|
|
32
|
+
|
|
33
|
+
| Part / prop | Type | Default | Purpose |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| `Disclosure` | Base UI Collapsible root props | `div` | Groups trigger and panel; accepts native props and ref. |
|
|
36
|
+
| `open` / `defaultOpen` | `boolean` | `false` | Controlled or initial expansion. |
|
|
37
|
+
| `onOpenChange` | `(open, details) => void` | — | Requests a state change; `details.cancel()` rejects it. |
|
|
38
|
+
| `disabled` | `boolean` | `false` | Prevents user toggling. |
|
|
39
|
+
| `Disclosure.Trigger` | Base UI Collapsible trigger props | `button` | Native Enter/Space activation and expanded/controls relationships. |
|
|
40
|
+
| `Disclosure.Panel` | Base UI Collapsible panel props | `div` | Contains optional details and controls. |
|
|
41
|
+
| `Panel.keepMounted` | `boolean` | `false` | Retains DOM and uncontrolled draft state while closed. |
|
|
42
|
+
| `Panel.hiddenUntilFound` | `boolean` | `false` | Uses browser find-in-page reveal where supported; overrides keepMounted. |
|
|
43
|
+
| `className` / `render` / `ref` | Part-specific native props | — | Style, compose and reference each DOM part. Class names accept strings. |
|
|
44
|
+
|
|
45
|
+
Tab reaches the trigger; Enter and Space toggle it without moving focus into the panel. Collapsed controls leave the accessibility tree and Tab order. No arrow-key navigation or modal behavior is added. Put essential instructions and errors where they remain discoverable. Unmounted content loses uncontrolled state; use keepMounted or store values outside the panel. Browser find-in-page reveal depends on engine support and the caller accepting controlled state changes.
|
|
46
|
+
|
|
47
|
+
Style `--kb-disclosure-padding`, `-radius`, `-background`, `-color`, `-border` and `-trigger-height`. Preserve visible focus, hidden semantics and disabled state when overriding styles.
|
|
48
|
+
|
|
49
|
+
Panels expand and collapse through measured height transitions; reversing mid-transition follows the latest toggle. Content grows naturally once expanded. `--kb-disclosure-motion-duration` and `-motion-easing` control panel and caret motion; reduced motion disables transitions. `.kb-disclosure-panel-content` owns inner padding, keeping the outer Panel measurable without clipping collapsed padding. Panel props, className, render and ref still target the outer node.
|
|
50
|
+
|
|
51
|
+
## Related components
|
|
52
|
+
|
|
53
|
+
Use [Accordion](Accordion.md) for related sections with headings, [Panel](Panel.md) for a structured work surface, or [Popover](Popover.md) for anchored supporting controls. [Overlay guidance](../../../../docs/guides/forms-and-overlays.md) covers choosing disclosure, popovers and modal patterns.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# EmptyState
|
|
2
|
+
|
|
3
|
+
Explain why a collection, search result, or section has no content to show, and provide the direct action that populates or recovers it.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-emptystate--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Button, EmptyState } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<EmptyState
|
|
16
|
+
eyebrow="Pipelines"
|
|
17
|
+
title="No release pipelines configured"
|
|
18
|
+
description="Create a pipeline to validate builds and publish signed packages."
|
|
19
|
+
actions={<Button size="sm">Create pipeline</Button>}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## More examples
|
|
26
|
+
|
|
27
|
+
- [Filtered zero results](https://kbui.kcb.pro/storybook/?path=/story/components-emptystate--filtered-zero-results): Give people a one-click way to clear active filters or widen their query.
|
|
28
|
+
- [Recoverable section failure](https://kbui.kcb.pro/storybook/?path=/story/components-emptystate--recoverable-failure): Explain when a section failed to load and pair the explanation with a retry action.
|
|
29
|
+
- [Surface variants](https://kbui.kcb.pro/storybook/?path=/story/components-emptystate--variants-and-sizes): Choose `surface`, `subtle`, or `plain` containers to match surrounding hierarchy.
|
|
30
|
+
|
|
31
|
+
## Reference
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Default | Notes |
|
|
34
|
+
| -------------- | -------------------------------------------- | --------- | -------------------------------------------------------------------------------------- |
|
|
35
|
+
| `title` | `ReactNode` | required | Heading text naming what is missing or unavailable |
|
|
36
|
+
| `description` | `ReactNode` | unset | Supporting guidance explaining how to populate or recover the view |
|
|
37
|
+
| `eyebrow` | `ReactNode` | unset | Short uppercase label above the title |
|
|
38
|
+
| `icon` | `ReactNode` | unset | Decorative emblem above the header; hidden from assistive technology |
|
|
39
|
+
| `actions` | `ReactNode` | unset | Primary and secondary buttons or links that resolve the empty state |
|
|
40
|
+
| `footer` | `ReactNode` | unset | Quiet footnote, error code, or secondary hint below actions |
|
|
41
|
+
| `headingLevel` | `2` / `3` / `4` | `3` | Semantic heading tag (`h2`–`h4`) matching the surrounding document outline |
|
|
42
|
+
| `variant` | `surface` / `subtle` / `plain` | `surface` | Raised bordered card, dashed recessed well, or borderless inline block |
|
|
43
|
+
| `size` | `sm` / `md` / `lg` | `md` | Scales padding, icon badge, and heading typography |
|
|
44
|
+
| `tone` | `neutral` / `info` / `warning` / `danger` | `neutral` | Accentuates the icon badge and border for informational or failure states |
|
|
45
|
+
| `live` | `boolean` | `false` | Adds `role="status"` when revealed dynamically after filtering or an async load error |
|
|
46
|
+
| `classNames` | keyed classes | unset | Style `icon`, `header`, `eyebrow`, `title`, `description`, `body`, `actions`, `footer` |
|
|
47
|
+
|
|
48
|
+
## Related components
|
|
49
|
+
|
|
50
|
+
Use [Skeleton](Skeleton.md) while the collection is still loading, [Callout](Callout.md) for inline notices beside populated content, and [Toast](Toast.md) for transient action feedback.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ErrorSummary
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-errorsummary--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { ErrorSummary, Input } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<form noValidate>
|
|
16
|
+
<ErrorSummary
|
|
17
|
+
items={[{ href: "#email", label: "Enter an email address." }]}
|
|
18
|
+
/>
|
|
19
|
+
<Input id="email" label="Email" error="Enter an email address." />
|
|
20
|
+
</form>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This example shows a failed-submission state. The Form recovery story below demonstrates validation and moving focus to the summary after submission.
|
|
26
|
+
|
|
27
|
+
## More examples
|
|
28
|
+
|
|
29
|
+
- [Recover after submission](https://kbui.kcb.pro/storybook/?path=/story/components-errorsummary--form-recovery): Run validation, focus the summary, and jump to invalid fields.
|
|
30
|
+
|
|
31
|
+
## Reference
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Default | Notes |
|
|
34
|
+
| -------------- | -------------------------------------------------------------------- | ---------------------- | ---------------------------------------------------------------- |
|
|
35
|
+
| `items` | `readonly ErrorSummaryItem[]` | required | Ordered `{ id?, href, label }` entries linking to invalid fields |
|
|
36
|
+
| `title` | `ReactNode` | `"There is a problem"` | Heading text naming the alert region |
|
|
37
|
+
| `description` | `ReactNode` | unset | Optional recovery guidance above the error list |
|
|
38
|
+
| `headingLevel` | `2 \| 3 \| 4` | `2` | Heading rank for the summary title |
|
|
39
|
+
| `onItemSelect` | `(href: string, event: MouseEvent<HTMLAnchorElement>) => void` | unset | Called when a recovery link is clicked |
|
|
40
|
+
| `classNames` | `ClassNames<"title" \| "description" \| "list" \| "item" \| "link">` | unset | Classes for inner parts |
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Related components
|
|
45
|
+
|
|
46
|
+
Keep inline errors on [Input](Input.md), [Textarea](Textarea.md), and other fields. Use [FormActions](FormActions.md) for the submit controls.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Fieldset
|
|
2
|
+
|
|
3
|
+
Use Fieldset to group related controls into a named form section using native `fieldset` and `legend` semantics. Setting `disabled` disables descendant form controls natively.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-fieldset--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Fieldset, Input } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Fieldset legend="Contact details" description="How we can reach you.">
|
|
16
|
+
<Input label="Email" type="email" name="email" />
|
|
17
|
+
</Fieldset>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## More examples
|
|
23
|
+
|
|
24
|
+
- [A group-level error](https://kbui.kcb.pro/storybook/?path=/story/components-fieldset--with-error): Explain a correction for a named group.
|
|
25
|
+
- [An unavailable group](https://kbui.kcb.pro/storybook/?path=/story/components-fieldset--disabled): Inspect disabled descendant controls.
|
|
26
|
+
|
|
27
|
+
## Reference
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Default | Notes |
|
|
30
|
+
| ---------------- | -------------------------------------------------------------- | -------- | ------------------------------------------------------ |
|
|
31
|
+
| `legend` | `ReactNode` | required | Section heading rendered inside the native legend |
|
|
32
|
+
| `visuallyHidden` | `boolean` | `false` | Hides the legend visually while keeping the group name |
|
|
33
|
+
| `description` | `ReactNode` | unset | Section help text linked through aria-describedby |
|
|
34
|
+
| `error` | `ReactNode` | unset | Group-level error linked through aria-describedby |
|
|
35
|
+
| `disabled` | `boolean` | `false` | Disables all descendant controls in the fieldset |
|
|
36
|
+
| `classNames` | `ClassNames<"legend" \| "description" \| "fields" \| "error">` | unset | Classes for inner parts |
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
## Related components
|
|
41
|
+
|
|
42
|
+
Use [Textarea](Textarea.md) and [Input](Input.md) for answers, [ErrorSummary](ErrorSummary.md) for submission recovery, and [FormActions](FormActions.md) for the action row.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# FileInput
|
|
2
|
+
|
|
3
|
+
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](https://github.com/KhallilB/kbui/blob/main/docs/guides/file-inputs.md) for examples, keyboard behavior, and styling. Available since v0.6.0.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-fileinput--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { FileInput, type FileInputItem } from "@kb.ui/react";
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
|
|
14
|
+
type Attachment = FileInputItem & { file: File };
|
|
15
|
+
|
|
16
|
+
export function Example() {
|
|
17
|
+
const [items, setItems] = useState<Attachment[]>([]);
|
|
18
|
+
return (
|
|
19
|
+
<FileInput
|
|
20
|
+
label="Attachments"
|
|
21
|
+
items={items}
|
|
22
|
+
onFiles={(files) =>
|
|
23
|
+
setItems((current) => [
|
|
24
|
+
...current,
|
|
25
|
+
...files.map((file) => ({
|
|
26
|
+
id: crypto.randomUUID(),
|
|
27
|
+
name: file.name,
|
|
28
|
+
file,
|
|
29
|
+
})),
|
|
30
|
+
])
|
|
31
|
+
}
|
|
32
|
+
onRemove={(id) =>
|
|
33
|
+
setItems((current) => current.filter((item) => item.id !== id))
|
|
34
|
+
}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The example retains each original `File` alongside its display metadata. Your app chooses acceptance rules and builds `FormData` for uploads; see [retained file selection](https://github.com/KhallilB/kbui/blob/main/docs/guides/file-inputs.md#choosing-and-removing-files).
|
|
41
|
+
|
|
42
|
+
## More examples
|
|
43
|
+
|
|
44
|
+
- [Rejected selection feedback](https://kbui.kcb.pro/storybook/?path=/story/components-fileinput--rejected): Keep accepted items visible while explaining a rejection.
|
|
45
|
+
- [Image-picker hints](https://kbui.kcb.pro/storybook/?path=/story/components-fileinput--evidence): Compare image acceptance hints and helper text.
|
|
46
|
+
- [Item metadata](https://kbui.kcb.pro/storybook/?path=/story/components-fileinput--custom-content): Customize retained-file content without losing its identity.
|
|
47
|
+
|
|
48
|
+
## Reference
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Notes |
|
|
51
|
+
| ---------------------------------------------------- | ------------------------------------ | ----------------------- | -------------------------------------------------------------------- |
|
|
52
|
+
| `label` | `string` | required | Visible field name and accessible picker context |
|
|
53
|
+
| `items` | `readonly FileInputItem[]` | required | Retained files with stable ids, names, and optional descriptions |
|
|
54
|
+
| `onFiles` | `(files: File[]) => void` | required | Check the selection and update retained files in your app |
|
|
55
|
+
| `onRemove` | `(id: string) => void` | required | Request removal; update items to confirm it |
|
|
56
|
+
| `accept` | `string` | unset | Native picker hint, such as image/*; does not validate files |
|
|
57
|
+
| `multiple` | `boolean` | `true` | Allow multiple selection; use a singular chooseLabel for single mode |
|
|
58
|
+
| `disabled`, `readOnly` | `boolean` | `false` | Prevent edits while keeping the retained list visible |
|
|
59
|
+
| `description`, `error` | `string` | unset | Help or actionable rejection text associated with the field |
|
|
60
|
+
| `visuallyHidden` | `boolean` | `false` | Hide the visual label while preserving its accessible name |
|
|
61
|
+
| `chooseLabel` | `string` | Choose files | Localized visible picker action |
|
|
62
|
+
| `emptyMessage` | `string` | No files added. | Localized empty-state text |
|
|
63
|
+
| `removeLabel` | `(item: FileInputItem) => string` | Remove + filename | Accessible remove action; keep the filename in the name |
|
|
64
|
+
| `removedMessage` | `(item: FileInputItem) => string` | filename + removed. | Announcement after removal is confirmed |
|
|
65
|
+
| `selectionMessage` | `(count: number) => string` | count + files selected. | Announcement after native selection |
|
|
66
|
+
| `renderItem` | `(item: FileInputItem) => ReactNode` | name + description | Custom item content; keep visible file identity |
|
|
67
|
+
| `inputRef`, `triggerRef` | element refs | unset | Hidden native input and visible picker access |
|
|
68
|
+
| `triggerClassName`, `listClassName`, `itemClassName` | `string` | unset | Classes for picker, retained list, and items |
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
## Related components
|
|
73
|
+
|
|
74
|
+
Use [Progress](Progress.md) to present caller-owned upload progress. File selection and uploading are separate steps.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# FormActions
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-formactions--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Button, FormActions, Input } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<form onSubmit={(event) => event.preventDefault()}>
|
|
16
|
+
<Input label="Project name" name="project" />
|
|
17
|
+
<FormActions divider>
|
|
18
|
+
<Button type="submit">Save changes</Button>
|
|
19
|
+
<Button type="reset" variant="ghost">
|
|
20
|
+
Reset
|
|
21
|
+
</Button>
|
|
22
|
+
</FormActions>
|
|
23
|
+
</form>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## More examples
|
|
29
|
+
|
|
30
|
+
- [Separate the action row](https://kbui.kcb.pro/storybook/?path=/story/components-formactions--with-divider): Keep a boundary above the actions.
|
|
31
|
+
- [Primary and secondary groups](https://kbui.kcb.pro/storybook/?path=/story/components-formactions--split-alignment): Compare actions at opposite ends of the row.
|
|
32
|
+
|
|
33
|
+
## Reference
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default | Notes |
|
|
36
|
+
| ---------- | ------------------------------- | ------- | -------------------------------------------------- |
|
|
37
|
+
| `align` | `"end" \| "start" \| "between"` | `"end"` | Horizontal button alignment |
|
|
38
|
+
| `divider` | `boolean` | `false` | Adds a top border and spacing above the action row |
|
|
39
|
+
| `children` | `ReactNode` | unset | Form buttons in reading and Tab order |
|
|
40
|
+
|
|
41
|
+
Other native div props and `ref` pass through. Use `--kb-formactions-gap` and `--kb-formactions-padding-top` to adjust spacing.
|
|
42
|
+
|
|
43
|
+
## Related components
|
|
44
|
+
|
|
45
|
+
Use [Fieldset](Fieldset.md) for named groups and [ErrorSummary](ErrorSummary.md) for failed submission recovery. Use [Toolbar](Toolbar.md) when controls need arrow-key navigation.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Grid
|
|
2
|
+
|
|
3
|
+
Arrange cards or other content in responsive columns, fixed column counts, or a single vertical stack. Grid uses ordinary CSS layout, without an ARIA grid role or special keyboard navigation, and resets native list markers and margins when rendered as `ul` or `ol`.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/layout-grid--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Card, Grid } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Grid as="ul" role="list" columns={2} gap="md" aria-label="Projects">
|
|
16
|
+
<Card as="li">
|
|
17
|
+
<h2>First project</h2>
|
|
18
|
+
<p>Ready for review.</p>
|
|
19
|
+
</Card>
|
|
20
|
+
<Card as="li">
|
|
21
|
+
<h2>Second project</h2>
|
|
22
|
+
<p>In progress.</p>
|
|
23
|
+
</Card>
|
|
24
|
+
</Grid>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## More examples
|
|
30
|
+
|
|
31
|
+
- [Fixed column counts](https://kbui.kcb.pro/storybook/?path=/story/layout-grid--columns): Compare one through four equal columns.
|
|
32
|
+
- [Responsive minimum widths](https://kbui.kcb.pro/storybook/?path=/story/layout-grid--column-widths): Compare automatic wrapping at different minimum item widths.
|
|
33
|
+
- [Gaps and alignment](https://kbui.kcb.pro/storybook/?path=/story/layout-grid--gaps-and-alignment): Compare spacing presets and cross-axis alignment.
|
|
34
|
+
- [A vertical collection](https://kbui.kcb.pro/storybook/?path=/story/layout-grid--stacked-list): Keep list structure while stacking items.
|
|
35
|
+
|
|
36
|
+
## Reference
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Notes |
|
|
39
|
+
| --------------------------- | --------------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `as` | `div` / `ul` / `ol` | `div` | Use ul or ol for a collection; children must then be list items |
|
|
41
|
+
| `layout` | `auto` / `stack` | `auto` | Auto fits equal columns to available width; stack uses one column |
|
|
42
|
+
| `columns` | `auto` / `1` / `2` / `3` / `4` | `auto` | Explicit equal column count (collapsing to 1 on narrow mobile viewports) or automatic wrapping |
|
|
43
|
+
| `minItemWidth` | `sm` / `md` / `lg` | `md` | Minimum width (`14rem`, `18.75rem`, `24rem`) before automatic columns wrap |
|
|
44
|
+
| `gap` | `none` / `sm` / `md` / `lg` | `lg` (`--kb-grid-gap`) | Space between columns and stacked rows |
|
|
45
|
+
| `align` | `start` / `center` / `end` / `baseline` / `stretch` | `stretch` | Cross-axis alignment within each grid row |
|
|
46
|
+
| `children` | `ReactNode` | unset | Content in document and keyboard order |
|
|
47
|
+
| `className`, `style`, `ref` | native element props | unset | Style and reference the chosen container |
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Grid as="ul" role="list" layout="stack" gap="md" aria-label="Projects">
|
|
51
|
+
<Card as="li">
|
|
52
|
+
<h2>
|
|
53
|
+
<a href="/project">Project</a>
|
|
54
|
+
</h2>
|
|
55
|
+
<p>Summary</p>
|
|
56
|
+
</Card>
|
|
57
|
+
</Grid>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use `minItemWidth`, `columns`, `gap`, and `align` for common layouts, or override `--kb-grid-gap` and `--kb-grid-min-item-width` (`-sm`, `-md`, `-lg`) on a subtree. Keep the visual order the same as the reading order.
|
|
61
|
+
|
|
62
|
+
Grid removes list markers. Include `role="list"` on list renderings to retain list exposure in Safari when `list-style: none` is applied; see [MDN’s list-style accessibility guidance](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/list-style#accessibility). Confirm list/item announcement with your supported browser and screen reader.
|
|
63
|
+
|
|
64
|
+
## Related components
|
|
65
|
+
|
|
66
|
+
Use [Split](Split.md) for exactly two weighted columns and [Inline](Inline.md) for a wrapping row of independent items.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Heading
|
|
2
|
+
|
|
3
|
+
Native `h1`–`h6` headings with visual size independent of rank.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-heading--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Heading } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Heading level={1} size="lg">
|
|
16
|
+
Project overview
|
|
17
|
+
</Heading>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## More examples
|
|
23
|
+
|
|
24
|
+
- [Document hierarchy](https://kbui.kcb.pro/storybook/?path=/story/components-heading--hierarchy): Compare semantic heading ranks.
|
|
25
|
+
- [Visual hierarchy](https://kbui.kcb.pro/storybook/?path=/story/components-heading--sizes): Compare sizes separately from heading rank.
|
|
26
|
+
- [A complete article](https://kbui.kcb.pro/storybook/?path=/story/components-heading--article): Combine Heading, Text, Link, and Code.
|
|
27
|
+
|
|
28
|
+
## Reference
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Default | Notes |
|
|
31
|
+
| ------------------ | ----------------------------------------- | ---------- | -------------------------------------------------------------------------- |
|
|
32
|
+
| `level` | `1` \| `2` \| `3` \| `4` \| `5` \| `6` | `2` | Document rank; choose from page structure |
|
|
33
|
+
| `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 |
|
|
34
|
+
| `className`, `ref` | Native heading props | unset | Classes merge; ref targets native heading |
|
|
35
|
+
|
|
36
|
+
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](https://github.com/KhallilB/kbui/blob/main/docs/guides/typography.md) for composition, CSS recipes and accessibility guidance.
|
|
37
|
+
|
|
38
|
+
## Related components
|
|
39
|
+
|
|
40
|
+
Pair with [Text](Text.md), [Link](Link.md), and [Code](Code.md) for readable document content.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Image
|
|
2
|
+
|
|
3
|
+
Reserve a stable frame for images, with crop, contain and fallback states. The same accessible alternative remains available while loading and after failure.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-image--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Image } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Image
|
|
16
|
+
src="/products/studio-coat.jpg"
|
|
17
|
+
alt="Sand wool coat with broad lapels"
|
|
18
|
+
ratio="portrait"
|
|
19
|
+
fit="contain"
|
|
20
|
+
width={900}
|
|
21
|
+
height={1200}
|
|
22
|
+
fallback="Preview unavailable"
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## More examples
|
|
29
|
+
|
|
30
|
+
- [Crop and contain](https://kbui.kcb.pro/storybook/?path=/story/components-image--crop-and-contain): Compare detail crops with complete product images.
|
|
31
|
+
- [Ratios](https://kbui.kcb.pro/storybook/?path=/story/components-image--ratios): Square, wide, intrinsic and missing media.
|
|
32
|
+
- [Failure and recovery](https://kbui.kcb.pro/storybook/?path=/story/components-image--failure-and-recovery): Replace a failed source without shifting layout.
|
|
33
|
+
|
|
34
|
+
- [Editorial image library](https://kbui.kcb.pro/storybook/?path=/story/components-image--asset-library): Ten original portrait, object and scene illustrations with individual downloads.
|
|
35
|
+
|
|
36
|
+
## Reference
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Notes |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `alt` | `string` | required | Accessible alternative; empty string hides decorative media |
|
|
41
|
+
| `src`, `srcSet`, `sizes` | native image attributes | unset | Responsive source selection; changing these resets request state |
|
|
42
|
+
| `ratio` | `ImageRatio` | `"landscape"` | `square` (1:1), `landscape` (4:3), `portrait` (3:4), `wide` (16:9), or `auto` |
|
|
43
|
+
| `width`, `height` | native image dimensions | unset | Forwarded to img; with `ratio="auto"`, reserve their ratio before loading |
|
|
44
|
+
| `fit` | `"cover"` \| `"contain"` | `"cover"` | Crop to fill or show entire image |
|
|
45
|
+
| `position` | CSS object position | browser center | Focal point, such as `"50% 25%"` |
|
|
46
|
+
| `fallback` | `ReactNode` | image outline icon | Non-interactive visual for loading, missing and failed media |
|
|
47
|
+
| `loading`, `fetchPriority` | native image attributes | browser defaults | Choose lazy/eager loading and priority per placement |
|
|
48
|
+
| `decoding` | native image attribute | `"async"` | Decode preference |
|
|
49
|
+
| `crossOrigin`, `referrerPolicy` | native image attributes | unset | Request policy |
|
|
50
|
+
| `onLoad`, `onError` | native image handlers | unset | Observe request outcome; called with native img events |
|
|
51
|
+
| `classNames` | keyed classes | unset | `root`, `image`, `fallback` |
|
|
52
|
+
| `ref` | `Ref<HTMLSpanElement>` | unset | Frame element; remaining span props and style apply here |
|
|
53
|
+
|
|
54
|
+
The frame exposes `data-state="empty|loading|loaded|error"`, `data-ratio`, and `data-fit`. The internal native image is hidden from assistive technology; the outer image role owns the alternative across all states. `aria-label`, `aria-labelledby`, and `aria-describedby` belong to the frame. An empty `alt` always hides the complete image.
|
|
55
|
+
|
|
56
|
+
`auto` uses positive width and height; without both, it falls back to the landscape ratio. The image remains within the reserved frame, including after failure. A caller `style.aspectRatio` overrides framing. Image fetches follow native browser behavior; the component adds no timeout, retry loop, cache, upload or URL policy. A new source starts a fresh request; to retry the same URL intentionally, change the component key.
|
|
57
|
+
|
|
58
|
+
Fallback content is visual-only and must contain no controls. Place a named replacement/retry Button and meaningful error text outside the frame. Use [media recipes](../../../../docs/guides/media-and-identity.md) for responsive sources, localized errors and CSS-only markup.
|
|
59
|
+
|
|
60
|
+
## Related components
|
|
61
|
+
|
|
62
|
+
Use [Avatar](Avatar.md) for fixed-size identity, [Thumbnail](Thumbnail.md) for captions and metadata, and [Grid](Grid.md) for responsive collections.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Inline
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
[All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/layout-inline--docs)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import "@kb.ui/react/styles.css";
|
|
11
|
+
import { Button, Inline } from "@kb.ui/react";
|
|
12
|
+
|
|
13
|
+
export function Example() {
|
|
14
|
+
return (
|
|
15
|
+
<Inline>
|
|
16
|
+
<Button>Save changes</Button>
|
|
17
|
+
<Button variant="secondary">Cancel</Button>
|
|
18
|
+
</Inline>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## More examples
|
|
24
|
+
|
|
25
|
+
- [Wrapping actions](https://kbui.kcb.pro/storybook/?path=/story/layout-inline--wrapping): Inspect source order as controls wrap.
|
|
26
|
+
- [A native list](https://kbui.kcb.pro/storybook/?path=/story/layout-inline--list): Retain list semantics inside a row.
|
|
27
|
+
- [Mixed content](https://kbui.kcb.pro/storybook/?path=/story/layout-inline--alignment): Compare alignment with different content sizes.
|
|
28
|
+
|
|
29
|
+
## Reference
|
|
30
|
+
|
|
31
|
+
| Prop | Values | Default |
|
|
32
|
+
| --------- | ---------------------------------------------- | -------- |
|
|
33
|
+
| `as` | `div` `ul` `ol` `nav` | `div` |
|
|
34
|
+
| `gap` | `none` `sm` (0.5rem) `md` (1rem) `lg` (1.5rem) | `md` |
|
|
35
|
+
| `align` | `start` `center` `end` `baseline` `stretch` | `center` |
|
|
36
|
+
| `justify` | `start` `center` `end` `between` | `start` |
|
|
37
|
+
|
|
38
|
+
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](https://github.com/KhallilB/kbui/blob/main/docs/guides/layout.md).
|
|
39
|
+
|
|
40
|
+
## Related components
|
|
41
|
+
|
|
42
|
+
Use [Toolbar](Toolbar.md) when actions need coordinated arrow-key navigation. Use [Grid](Grid.md) when items need shared columns.
|