@kb.ui/react 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +79 -66
  2. package/dist/components/ConfirmAction/ConfirmAction.d.ts +42 -0
  3. package/dist/components/Dashboard/Dashboard.d.ts +17 -0
  4. package/dist/components/Form/Form.d.ts +19 -0
  5. package/dist/components/FormSection/FormSection.d.ts +26 -0
  6. package/dist/components/Gallery/Gallery.d.ts +26 -0
  7. package/dist/components/PageHeader/PageHeader.d.ts +27 -0
  8. package/dist/components/Panel/Panel.d.ts +3 -1
  9. package/dist/components/Settings/Settings.d.ts +11 -0
  10. package/dist/components/Skeleton/Skeleton.d.ts +8 -6
  11. package/dist/components/Stack/Stack.d.ts +15 -0
  12. package/dist/components/StatsRow/StatsRow.d.ts +33 -0
  13. package/dist/components/SupportingPane/SupportingPane.d.ts +15 -0
  14. package/dist/index.d.ts +10 -0
  15. package/dist/index.js +718 -333
  16. package/dist/index.js.map +1 -1
  17. package/dist/styles.css +1 -1
  18. package/docs/components/Accordion.md +9 -9
  19. package/docs/components/Avatar.md +4 -4
  20. package/docs/components/Badge.md +4 -4
  21. package/docs/components/Button.md +8 -8
  22. package/docs/components/Callout.md +3 -3
  23. package/docs/components/Card.md +4 -4
  24. package/docs/components/Checkbox.md +5 -5
  25. package/docs/components/Code.md +2 -2
  26. package/docs/components/CodeBlock.md +7 -7
  27. package/docs/components/Collection.md +5 -5
  28. package/docs/components/CollectionList.md +6 -6
  29. package/docs/components/CollectionRow.md +11 -11
  30. package/docs/components/Combobox.md +3 -3
  31. package/docs/components/ConfirmAction.md +100 -0
  32. package/docs/components/Container.md +2 -2
  33. package/docs/components/CopyableText.md +9 -9
  34. package/docs/components/Dashboard.md +81 -0
  35. package/docs/components/DescriptionList.md +3 -3
  36. package/docs/components/Dialog.md +7 -7
  37. package/docs/components/Disclosure.md +4 -4
  38. package/docs/components/EmptyState.md +1 -1
  39. package/docs/components/ErrorSummary.md +5 -3
  40. package/docs/components/Fieldset.md +6 -6
  41. package/docs/components/FileInput.md +5 -5
  42. package/docs/components/Form.md +67 -0
  43. package/docs/components/FormActions.md +3 -3
  44. package/docs/components/FormSection.md +57 -0
  45. package/docs/components/Gallery.md +84 -0
  46. package/docs/components/Grid.md +13 -13
  47. package/docs/components/Heading.md +3 -3
  48. package/docs/components/Image.md +3 -3
  49. package/docs/components/Inline.md +3 -3
  50. package/docs/components/Input.md +3 -3
  51. package/docs/components/Link.md +2 -2
  52. package/docs/components/Menu.md +5 -5
  53. package/docs/components/MultiSelect.md +2 -2
  54. package/docs/components/NumberField.md +5 -5
  55. package/docs/components/PageHeader.md +68 -0
  56. package/docs/components/Panel.md +11 -3
  57. package/docs/components/Popover.md +9 -9
  58. package/docs/components/Progress.md +1 -1
  59. package/docs/components/RadioGroup.md +3 -3
  60. package/docs/components/ScrollArea.md +1 -1
  61. package/docs/components/Select.md +2 -2
  62. package/docs/components/Separator.md +3 -3
  63. package/docs/components/Settings.md +57 -0
  64. package/docs/components/Skeleton.md +56 -16
  65. package/docs/components/Spinner.md +9 -4
  66. package/docs/components/Split.md +4 -4
  67. package/docs/components/Stack.md +54 -0
  68. package/docs/components/Stat.md +1 -1
  69. package/docs/components/StatsRow.md +80 -0
  70. package/docs/components/Status.md +7 -6
  71. package/docs/components/SupportingPane.md +59 -0
  72. package/docs/components/Switch.md +5 -5
  73. package/docs/components/Table.md +12 -12
  74. package/docs/components/Tabs.md +10 -10
  75. package/docs/components/Text.md +2 -2
  76. package/docs/components/Textarea.md +4 -4
  77. package/docs/components/Thumbnail.md +7 -7
  78. package/docs/components/Toast.md +9 -9
  79. package/docs/components/Toolbar.md +4 -4
  80. package/docs/components/Tooltip.md +3 -3
  81. package/package.json +1 -1
@@ -41,26 +41,26 @@ export function DeliveryQuestions() {
41
41
 
42
42
  | Part / prop | Type | Default | Purpose |
43
43
  |---|---|---|---|
44
- | `Accordion<Value>` | Base UI Accordion root props | `div` | Groups items; generic values preserve callback types. |
44
+ | `Accordion<Value>` | Base UI `Accordion` root props | `div` | Groups items; generic values preserve callback types. |
45
45
  | `value` / `defaultValue` | `Value[]` | `[]` | Controlled or initial expanded item values. Use arrays in both modes. |
46
46
  | `onValueChange` | `(values, details) => void` | — | Requests expansion changes; `details.cancel()` rejects them. |
47
47
  | `multiple` | `boolean` | `false` | Allows independent expanded items. |
48
48
  | `disabled` | `boolean` | `false` | Disables all triggers; does not conceal already open content. |
49
49
  | `keepMounted` / `hiddenUntilFound` | `boolean` | `false` | Root defaults for panel retention or supported browser search reveal. |
50
- | `Accordion.Item` | Base UI Accordion item props | `div` | Requires a stable unique `value` for controlled usage; accepts item `disabled`. |
51
- | `Accordion.Header` | Base UI Accordion heading props | `h3` | Contains the trigger; use `render={<h2 />}` or another heading for document hierarchy. |
52
- | `Accordion.Trigger` | Base UI Accordion trigger props | `button` | Visible section label and expansion control. |
53
- | `Accordion.Panel` | Base UI Accordion panel props | Named `region` | Owns content; accepts per-panel retention options. |
50
+ | `Accordion.Item` | Base UI `Accordion` item props | `div` | Requires a stable unique `value` for controlled usage; accepts item `disabled`. |
51
+ | `Accordion.Header` | Base UI `Accordion` heading props | `h3` | Contains the trigger; use `render={<h2 />}` or another heading for document hierarchy. |
52
+ | `Accordion.Trigger` | Base UI `Accordion` trigger props | `button` | Visible section label and expansion control. |
53
+ | `Accordion.Panel` | Base UI `Accordion` panel props | Named `region` | Owns content; accepts per-panel retention options. |
54
54
  | `className` / `render` / `ref` | Part-specific native props | — | Customize each part; class names accept strings. |
55
55
 
56
- Tab and Shift+Tab visit enabled triggers and expanded controls in DOM order. Enter/Space toggle the focused item. Base UI 1.9 uses normal Tab navigation; its deprecated orientation and loopFocus props do not add arrow-key navigation. Closing the last open item is allowed. No business validation is inferred from expansion.
56
+ Tab and Shift+Tab visit enabled triggers and expanded controls in DOM order. Enter/Space toggle the focused item. Base UI 1.9 uses normal Tab navigation; its deprecated orientation and `loopFocus` props do not add arrow-key navigation. Closing the last open item is allowed. No business validation is inferred from expansion.
57
57
 
58
- Keep essential information discoverable and interactive actions outside the heading button. Avoid an excessive number of region landmarks: keep groups focused and split large documents into meaningful sections. Hidden/unmounted content does not supply persistent form state: use keepMounted or caller-owned values. Nested groups own separate state.
58
+ Keep essential information discoverable and interactive actions outside the heading button. Avoid an excessive number of region landmarks: keep groups focused and split large documents into meaningful sections. Hidden/unmounted content does not supply persistent form state: use `keepMounted` or caller-owned values. Nested groups own separate state.
59
59
 
60
60
  Style `--kb-accordion-padding`, `-radius`, `-background`, `-color`, `-border` and `-trigger-height`; classes cover root, item, header, trigger and panel. Preserve expanded/disabled attributes and native focus outlines when composing custom renderers.
61
61
 
62
- Panels expand and collapse through measured height transitions; reversing mid-transition follows the latest toggle. Content grows naturally once expanded. `--kb-accordion-motion-duration` and `-motion-easing` control panel and caret motion; reduced motion disables transitions. `.kb-accordion-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.
62
+ Panels expand and collapse through measured height transitions; reversing mid-transition follows the latest toggle. Content grows naturally once expanded. `--kb-accordion-motion-duration` and `-motion-easing` control panel and caret motion; reduced motion disables transitions. `.kb-accordion-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.
63
63
 
64
64
  ## Related components
65
65
 
66
- Use [Disclosure](Disclosure.md) for a single optional section or [Panel](Panel.md) for a structured work surface. Use [Popover](Popover.md) for controls anchored outside normal document flow.
66
+ Use [`Disclosure`](Disclosure.md) for a single optional section or [`Panel`](Panel.md) for a structured work surface. Use [`Popover`](Popover.md) for controls anchored outside normal document flow.
@@ -32,7 +32,7 @@ export function Example() {
32
32
 
33
33
  ## Shapes
34
34
 
35
- `AvatarShape` accepts `circle`, `square`, `rounded`, `hexagon` and `diamond`. These shapes are implemented locally and unreleased. `square` has zero corner radius; `rounded` uses softly rounded corners.
35
+ `AvatarShape` accepts `circle`, `square`, `rounded`, `hexagon` and `diamond`. `square` has zero corner radius; `rounded` uses softly rounded corners.
36
36
 
37
37
  Shape changes only the silhouette. Photos and initials remain upright, and the accessible identity, size and image request state stay unchanged. Hexagon and diamond clip the media frame to their polygon; they do not rotate the content.
38
38
 
@@ -69,12 +69,12 @@ The default circle uses `--kb-avatar-radius`; rounded uses the existing `--kb-av
69
69
  | `shape` | `AvatarShape` | `"circle"` | `circle`, `square`, `rounded`, `hexagon` or `diamond`; clips upright media |
70
70
  | `onLoad`, `onError` | native image handlers | unset | Photo result callbacks |
71
71
  | `classNames` | keyed classes | unset | `root`, `media`, `initials` |
72
- | `ref` | `Ref<HTMLSpanElement>` | unset | Root element; native span props pass through |
72
+ | `ref` | `Ref<HTMLSpanElement>` | unset | Root element; native `span` props pass through |
73
73
 
74
74
  Initials use the first Unicode code point of the first and last whitespace-separated names, uppercased; a single word contributes one initial. This is a convenience, not a universal naming rule. Supply `initials` for the person's preferred form. Empty identities render `?`; localize `Unknown person` through `aria-label`. The accessible name remains the full identity, not the initials.
75
75
 
76
- Avatar adds no focus stop. Place navigation in a named Link or an action in a Button. Use `decorative` when an equivalent visible name is adjacent or the parent control already supplies the identity. Keep presence and account state in separately labeled Status/Badge content. See [media recipes](../../../../docs/guides/media-and-identity.md).
76
+ `Avatar` adds no focus stop. Place navigation in a named `Link` or an action in a `Button`. Use `decorative` when an equivalent visible name is adjacent or the parent control already supplies the identity. Keep presence and account state in separately labeled `Status`/`Badge` content. See [media recipes](../../../../docs/guides/media-and-identity.md).
77
77
 
78
78
  ## Related components
79
79
 
80
- Use [Image](Image.md) for flexible media framing, [Thumbnail](Thumbnail.md) for captioned previews, and [Status](Status.md) for changing state.
80
+ Use [`Image`](Image.md) for flexible media framing, [`Thumbnail`](Thumbnail.md) for captioned previews, and [`Status`](Status.md) for changing state.
@@ -1,6 +1,6 @@
1
1
  # Badge
2
2
 
3
- 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.
3
+ 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.
4
4
 
5
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-badge--docs)
6
6
 
@@ -17,7 +17,7 @@ export function Example() {
17
17
 
18
18
  ## More examples
19
19
 
20
- - [Literal identifiers](https://kbui.kcb.pro/storybook/?path=/story/components-badge--mono): Compare monospace metadata.
20
+ - [Literal identifiers](https://kbui.kcb.pro/storybook/?path=/story/components-badge--mono): Show an identifier in a monospace font.
21
21
  - [Semantic tones](https://kbui.kcb.pro/storybook/?path=/story/components-badge--tones): Check text remains meaningful across tones.
22
22
 
23
23
  ## Reference
@@ -30,8 +30,8 @@ export function Example() {
30
30
  | `mono` | `boolean` | `false` | Small uppercase monospace for short identifiers |
31
31
  | `preserveCase` | `boolean` | `false` | Preserve case and spacing for branch names, paths, and other literal values |
32
32
 
33
- Native span props pass through. Badge adds no focus stop or live announcement.
33
+ You can pass native `<span>` props. `Badge` adds no Tab stop or live announcement.
34
34
 
35
35
  ## Related components
36
36
 
37
- Use [Status](Status.md) for changing state and [Code](Code.md) for code within prose.
37
+ Use [`Status`](Status.md) for changing state and [`Code`](Code.md) for code within prose.
@@ -1,6 +1,6 @@
1
1
  # Button
2
2
 
3
- Use a Button for an action such as saving a form or opening a dialog. Choose a variant to match the action’s importance.
3
+ Use a `Button` for an action such as saving a form or opening a dialog. Choose a variant to match the action’s importance.
4
4
 
5
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-button--docs)
6
6
 
@@ -19,21 +19,21 @@ export function Example() {
19
19
 
20
20
  - [Styled navigation](https://kbui.kcb.pro/storybook/?path=/story/components-button--as-link): Render a link with the correct semantics.
21
21
  - [Icon-only actions](https://kbui.kcb.pro/storybook/?path=/story/components-button--icon-only): Give the action an accessible name.
22
- - [Size choices](https://kbui.kcb.pro/storybook/?path=/story/components-button--sizes): Compare density and target sizes.
22
+ - [Size choices](https://kbui.kcb.pro/storybook/?path=/story/components-button--sizes): Compare button sizes.
23
23
 
24
24
  ## Reference
25
25
 
26
26
  | Prop | Type | Default | Notes |
27
27
  | ----------- | ------------------------------------------------- | ----------- | -------------------------------------------------------------------------- |
28
- | `children` | `ReactNode` | unset | Visible action label, or an icon paired with aria-label |
28
+ | `children` | `ReactNode` | unset | Visible action label, or an icon paired with `aria-label` |
29
29
  | `variant` | `"primary" \| "secondary" \| "ghost" \| "danger"` | `"primary"` | Main, supporting, quiet, or destructive action emphasis |
30
- | `size` | `sm` / `md` / `lg` / `icon` | `md` | Height and padding; icon is square and requires aria-label |
31
- | `type` | native button type | `button` | Set submit for form submission; use button for other form actions |
30
+ | `size` | `sm` / `md` / `lg` / `icon` | `md` | Height and padding; `icon` is square and requires `aria-label` |
31
+ | `type` | native `button` type | `button` | Set `type="submit"` for form submission; use `type="button"` for other form actions |
32
32
  | `disabled` | `boolean` | `false` | Blocks interaction; explain unavailable actions in nearby text when needed |
33
- | `render` | element | unset | Use an anchor with nativeButton=false and role=link for navigation |
33
+ | `render` | element | unset | Use an anchor with `nativeButton={false}` and `role="link"` for navigation |
34
34
  | `className` | `string` | unset | Extra classes on the rendered control; function values are not supported |
35
35
 
36
- All props accepted by a native button or Base UI's `Button` also work. To render a link, pass an anchor and tell Base UI it is not a native button:
36
+ All props accepted by a native `button` or Base UI's `Button` also work. To render a link, pass an anchor and tell Base UI it is not a native `button`:
37
37
 
38
38
  ```tsx
39
39
  <Button render={<a href="/docs" />} nativeButton={false} role="link">
@@ -43,4 +43,4 @@ All props accepted by a native button or Base UI's `Button` also work. To render
43
43
 
44
44
  ## Related components
45
45
 
46
- Use [Link](Link.md) for navigation. Group coordinated actions with [Toolbar](Toolbar.md), or independent wrapping actions with [Inline](Inline.md).
46
+ Use [`Link`](Link.md) for navigation. Group coordinated actions with [`Toolbar`](Toolbar.md), or independent wrapping actions with [`Inline`](Inline.md).
@@ -32,10 +32,10 @@ export function Example() {
32
32
  | `title` | `ReactNode` | unset | Short summary above the message |
33
33
  | `tone` | `neutral` / `info` / `success` / `warning` / `danger` | `neutral` | Reinforces the message without replacing its wording |
34
34
  | `icon` | `ReactNode` | unset | Decorative icon; hidden from assistive technology |
35
- | `actions` | `ReactNode` | unset | Named buttons or links that help resolve the message |
36
- | `live` | `boolean` | `false` | Adds role=status for changing message text; does not move focus |
35
+ | `actions` | `ReactNode` | unset | Named buttons or links that help resolve the message; end-aligned, primary last |
36
+ | `live` | `boolean` | `false` | Adds `role=status` for changing message text; does not move focus |
37
37
  | `classNames` | keyed classes | unset | Style icon, content, title, body, or actions |
38
38
 
39
39
  ## Related components
40
40
 
41
- Use [Status](Status.md) for a short changing state and [Dialog](Dialog.md) for a focused modal task.
41
+ Use [`Status`](Status.md) for a short changing state and [`Dialog`](Dialog.md) for a focused modal task.
@@ -1,6 +1,6 @@
1
1
  # Card
2
2
 
3
- Group related content with an optional title, summary, links, and actions. Card renders an article by default and adds no interaction of its own.
3
+ Group related content with an optional title, summary, links, and actions. `Card` renders an article by default and adds no interaction of its own.
4
4
 
5
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-card--docs)
6
6
 
@@ -23,7 +23,7 @@ export function Example() {
23
23
  ## More examples
24
24
 
25
25
  - [A navigable card](https://kbui.kcb.pro/storybook/?path=/story/components-card--single-link): Use a real link for the primary destination.
26
- - [Quiet content rows](https://kbui.kcb.pro/storybook/?path=/story/components-card--plain): Compare a surface without raised emphasis.
26
+ - [Quiet content rows](https://kbui.kcb.pro/storybook/?path=/story/components-card--plain): Show a flat card without a raised surface.
27
27
 
28
28
  ## Reference
29
29
 
@@ -34,8 +34,8 @@ export function Example() {
34
34
  | `children` | `ReactNode` | unset | Related content; your app provides headings, links, and actions |
35
35
  | `className`, `style`, `ref` | native element props | unset | Style and reference the chosen container |
36
36
 
37
- 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.
37
+ `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.
38
38
 
39
39
  ## Related components
40
40
 
41
- Arrange a collection with [Grid](Grid.md). Use [Panel](Panel.md) when a section needs structured header, body, and footer parts.
41
+ Arrange a collection with [`Grid`](Grid.md). Use [`Panel`](Panel.md) when a section needs structured header, body, and footer parts.
@@ -1,6 +1,6 @@
1
1
  # Checkbox
2
2
 
3
- 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.
3
+ 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.
4
4
 
5
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-checkbox--docs)
6
6
 
@@ -25,8 +25,8 @@ export function Example() {
25
25
 
26
26
  ## More examples
27
27
 
28
- - [Partial selection](https://kbui.kcb.pro/storybook/?path=/story/components-checkbox--mixed): Inspect an aggregate mixed state.
29
- - [Validation feedback](https://kbui.kcb.pro/storybook/?path=/story/components-checkbox--invalid): Associate an error with the choice.
28
+ - [Partial selection](https://kbui.kcb.pro/storybook/?path=/story/components-checkbox--mixed): Show a partly selected group.
29
+ - [Validation feedback](https://kbui.kcb.pro/storybook/?path=/story/components-checkbox--invalid): Show an error for the choice.
30
30
 
31
31
  ## Reference
32
32
 
@@ -41,7 +41,7 @@ export function Example() {
41
41
  | `visuallyHidden` | `boolean` | `false` | Hide label visually |
42
42
  | `controlClassName` | `string` | | Added to the native checkbox |
43
43
  | `ref` | `Ref<HTMLInputElement>` | | Native checkbox, including form and indeterminate state |
44
- | `name` / `value` / `required` | native input props | | Form serialization and validation |
44
+ | `name` / `value` / `required` | native `input` props | | Form serialization and validation |
45
45
  | `className` | `string` | | Root class |
46
46
 
47
47
  ```tsx
@@ -57,4 +57,4 @@ Clicking the label or pressing Space calls `onCheckedChange`. The checkbox chang
57
57
 
58
58
  ## Related components
59
59
 
60
- Use [RadioGroup](RadioGroup.md) for one visible choice and [Switch](Switch.md) for an immediate on/off setting.
60
+ Use [`RadioGroup`](RadioGroup.md) for one visible choice and [`Switch`](Switch.md) for an immediate on/off setting.
@@ -70,8 +70,8 @@ export function SnippetExample() {
70
70
 
71
71
  Single-line strings without block props render as an inline `code` element that inherits surrounding line height and wraps long paths. Strings containing `\n` or any block prop (`language`, `title`, `copyable`, `lineNumbers`, `highlightLines`, `minLines`, `collapsible`, `collapsedLines`, `maxHeight`, `tokens`) switch automatically to a framed block listing unless `block={false}` is set. Line numbers use CSS `attr(data-line-number)` so selecting or reading `code.textContent` returns only the raw code. Customize block surfaces and syntax colors with `--kb-code-block-*` and `--kb-code-syntax-*`.
72
72
 
73
- Block copying shares the [copy feedback props](CopyableText.md#reference): `disabled`, `copyLabel`, `copyingLabel`, `copiedLabel`, `copyErrorLabel`, `successMessage`, `errorMessage`, `feedbackDuration` and `onCopyError`. Code defaults to `Copy code`, `Copy failed`, `Code copied to clipboard` and `Failed to copy code. Select and copy the text manually.`. `onCopy` is a successful-write callback rather than a native clipboard event handler. Pending writes retain focus and ignore repeated activation; errors remain visible until retry or source change. `classNames.feedback` styles the persistent polite status region. Block viewports expose a named keyboard scroll region using title or `Code`.
73
+ Block copying shares the [copy feedback props](CopyableText.md#reference): `disabled`, `copyLabel`, `copyingLabel`, `copiedLabel`, `copyErrorLabel`, `successMessage`, `errorMessage`, `feedbackDuration` and `onCopyError`. `Code` defaults to `Copy code`, `Copy failed`, `Code copied to clipboard` and `Failed to copy code. Select and copy the text manually.`. `onCopy` is a successful-write callback rather than a native clipboard event handler. Pending writes retain focus and ignore repeated activation; errors remain visible until retry or source change. `classNames.feedback` styles the persistent polite status region. Block viewports expose a named keyboard scroll region using `title` or the label “Code”.
74
74
 
75
75
  ## Related components
76
76
 
77
- Use [CodeBlock](CodeBlock.md) for explicit block semantics, [CopyableText](CopyableText.md) for copyable identifiers, [Text](Text.md) for prose and [Link](Link.md) for a destination.
77
+ Use [`CodeBlock`](CodeBlock.md) for explicit block semantics, [`CopyableText`](CopyableText.md) for copyable identifiers, [`Text`](Text.md) for prose and [`Link`](Link.md) for a destination.
@@ -1,6 +1,6 @@
1
1
  # CodeBlock
2
2
 
3
- An explicit block listing for commands, configuration and source. Reuses Code highlighting, line numbers, line emphasis and collapse behavior, with shared copy feedback and a keyboard-scrollable viewport.
3
+ An explicit block listing for commands, configuration and source. Reuses `Code` highlighting, line numbers, line emphasis and collapse behavior, with shared copy feedback and a keyboard-scrollable viewport.
4
4
 
5
5
  [All components](../../README.md#components) · [Usage](#usage) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-codeblock--docs)
6
6
 
@@ -19,7 +19,7 @@ export function Example() {
19
19
  }
20
20
  ```
21
21
 
22
- `children` must be the exact source string. Copy excludes line numbers, syntax markup, highlighted-line decoration and display padding. Collapsed blocks copy the full source. Empty strings disable copying. CodeBlock always renders a block, including single-line commands. It uses `.kb-codeblock.kb-code[data-block]`; shared `.kb-code-*` parts and `--kb-code-*` tokens remain compatible with Code.
22
+ `children` must be the exact source string. Copy excludes line numbers, syntax markup, highlighted-line decoration and display padding. Collapsed blocks copy the full source. Empty strings disable copying. `CodeBlock` always renders a block, including single-line commands. It uses `.kb-codeblock.kb-code[data-block]`; shared `.kb-code-*` parts and `--kb-code-*` tokens remain compatible with `Code`.
23
23
 
24
24
  Clipboard feedback appears after the actual write resolves. Pending writes suppress repeat activation and preserve button focus. Errors stay visible with manual selection instructions until retry or source change. Success resets after `feedbackDuration` (two seconds by default, zero retains it). Changes to source or disabled state invalidate outstanding feedback; unmounted instances ignore completion. Already-issued operating-system writes cannot be cancelled.
25
25
 
@@ -56,22 +56,22 @@ Override `--kb-code-syntax-*` through `style` or a class to change individual sy
56
56
  | `onCopyError` | `(error: unknown) => void` | unset | Current write failed or API unavailable |
57
57
  | `lineNumbers` | `boolean` | `false` | Decorative line gutter |
58
58
  | `startLine` | `number` | `1` | First displayed line number |
59
- | `highlightLines` | `readonly number[]` | unset | Emphasized display line numbers, accounting for startLine |
59
+ | `highlightLines` | `readonly number[]` | unset | Emphasized display line numbers, accounting for `startLine` |
60
60
  | `minLines` | `number` | unset | Minimum displayed lines without altering source |
61
61
  | `collapsible` | `boolean` | `false` | Show expand/collapse action |
62
- | `collapsedLines` | `number` | unset | Collapsed viewport line count; falls back to minLines |
62
+ | `collapsedLines` | `number` | unset | Collapsed viewport line count; falls back to `minLines` |
63
63
  | `defaultCollapsed` | `boolean` | `false` | Initial local collapsed state |
64
64
  | `collapsed` | `boolean` | unset | Controlled collapsed state |
65
65
  | `onCollapsedChange` | `(collapsed: boolean) => void` | unset | Collapse state request |
66
66
  | `maxHeight` | `string \| number` | unset | Scrollable viewport limit; number interpreted as CSS pixels |
67
67
  | `tokens` | `readonly CodeToken[]` | automatic | Ordered, non-overlapping UTF-16 ranges for external syntax highlighting |
68
- | `classNames` | `Partial<Record<CodePart, string>>` | unset | Shared Code slots including `copy`, `feedback`, `viewport`, `line`, `lineNumber`, `lineText` |
68
+ | `classNames` | `Partial<Record<CodePart, string>>` | unset | Shared `Code` slots including `copy`, `feedback`, `viewport`, `line`, `lineNumber`, `lineText` |
69
69
  | `className`, `ref`, other props | Native root props | unset | Root `div`; ref typed as HTMLDivElement |
70
70
 
71
- No syntax dependency is added. Supported languages use Code's small tokenizer; external highlighting can supply tokens. When loading standalone CSS parts, import both `code.css` and `codeblock.css` in that order. The bundled stylesheet includes both.
71
+ No syntax dependency is added. Supported languages use `Code`'s small tokenizer; external highlighting can supply tokens. When loading standalone CSS parts, import both `code.css` and `codeblock.css` in that order. The bundled stylesheet includes both.
72
72
 
73
73
  Automated checks exercise exact copies, controlled collapse, keyboard activation, scrolling and accessibility scans. Verify real clipboard permission behavior and human screen-reader announcements in the consuming application. See [shared copy guidance](https://github.com/KhallilB/kbui/blob/main/docs/guides/copyable-content.md).
74
74
 
75
75
  ## Related components
76
76
 
77
- Use [Code](Code.md) for inline literals or automatic block detection and [CopyableText](CopyableText.md) for identifiers and references outside source listings.
77
+ Use [`Code`](Code.md) for inline literals or automatic block detection and [`CopyableText`](CopyableText.md) for identifiers and references outside source listings.
@@ -95,7 +95,7 @@ A column has `key`, `header`, `cell(item)`, optional ascending `compare(a, b)`,
95
95
 
96
96
  Client mode processes records in this order: predicate, stable comparison, page slice. Removed or newly disabled IDs disappear from effective selection. Server mode preserves off-page IDs; eligibility for unseen records remains the application’s responsibility. Both modes remove disabled IDs present in the current response. Zero results have one empty page. Invalid counts, pages and sizes throw `RangeError` rather than emitting broken navigation.
97
97
 
98
- `state` is controlled when supplied. Each controlled proposal starts from the latest accepted props; a rejected proposal cannot affect a later interaction. Combine coordinated controlled changes in the parent before applying one next state. Uncontrolled commands in one event compose sequentially, including derived page bounds and page selection. Retained methods consult the latest committed dataset, eligibility rules, callbacks and accepted state, so asynchronous completion removes only its submitted IDs. Rendered state remains owned by the parent until it accepts `onStateChange`. Normalized selection and clamped page never trigger onStateChange during data refresh; the next user transition emits normalized state. Uncontrolled state retains those corrections so deleted/reintroduced IDs stay deselected and growing datasets do not restore an obsolete page. Controlled parent stores should reconcile their canonical state when external data changes. Use immutable arrays/objects and stable IDs across refreshes.
98
+ `state` is controlled when supplied. Each controlled proposal starts from the latest accepted props; a rejected proposal cannot affect a later interaction. Combine coordinated controlled changes in the parent before applying one next state. Uncontrolled commands in one event compose sequentially, including derived page bounds and page selection. Retained methods consult the latest committed dataset, eligibility rules, callbacks and accepted state, so asynchronous completion removes only its submitted IDs. Rendered state remains owned by the parent until it accepts `onStateChange`. Normalized selection and clamped page never trigger `onStateChange` during data refresh; the next user transition emits normalized state. Uncontrolled state retains those corrections so deleted/reintroduced IDs stay deselected and growing datasets do not restore an obsolete page. Controlled parent stores should reconcile their canonical state when external data changes. Use immutable arrays/objects and stable IDs across refreshes.
99
99
 
100
100
  ### useCollection
101
101
 
@@ -154,7 +154,7 @@ export function RecordList() {
154
154
  | Component | Required props | Optional props and behavior |
155
155
  | --- | --- | --- |
156
156
  | `Collection.Pagination` | `page`, `pageSize`, `totalItems`, `onPageChange` | `onPageSizeChange`, `pageSizes` (10, 25, 50), `disabled`, native nav props/ref. Includes current page size, emits bounded page requests; caller resets page when size changes. |
157
- | `Collection.BulkActions` | `selectedKeys`, `actions`, `onClear` | `onSuccess(keys)`, `onPendingChange(boolean)`, `disabled`, native fieldset props/ref. Caller owns selection; omitted onSuccess preserves it. |
157
+ | `Collection.BulkActions` | `selectedKeys`, `actions`, `onClear` | `onSuccess(keys)`, `onPendingChange(boolean)`, `disabled`, native `fieldset` props/ref. Caller owns selection; omitted `onSuccess` preserves it. |
158
158
 
159
159
  ### Bulk-action boundary
160
160
 
@@ -170,9 +170,9 @@ Offset pagination requires a known total. Cursor paging, unknown totals, all-mat
170
170
 
171
171
  ### Styling and accessibility
172
172
 
173
- Override `--kb-collection-gap`, `--kb-collection-cell-padding`, `--kb-collection-radius`, `--kb-collection-border`, `--kb-collection-header-background`, and `--kb-collection-selected-background`, and `--kb-collection-table-min-width` (36rem) on a subtree. Partial CSS imports also need Button, Checkbox, Input and Select styles. CSS provides layout and visual states; a non-React renderer owns every state transition and ARIA relationship.
173
+ Override `--kb-collection-gap`, `--kb-collection-cell-padding`, `--kb-collection-radius`, `--kb-collection-border`, `--kb-collection-header-background`, and `--kb-collection-selected-background`, and `--kb-collection-table-min-width` (36rem) on a subtree. Partial CSS imports also need `Button`, `Checkbox`, `Input` and `Select` styles. CSS provides layout and visual states; a non-React renderer owns every state transition and ARIA relationship.
174
174
 
175
- Filters and page-size controls use the shared Select theme, keyboard navigation, option indicators and focus recovery. Labels sit above fields; filter fields wrap and pagination buttons stay grouped, with long page counts wrapping within the available width.
175
+ Filters and page-size controls use the shared `Select` theme, keyboard navigation, option indicators and focus recovery. Labels sit above fields; filter fields wrap and pagination buttons stay grouped, with long page counts wrapping within the available width.
176
176
 
177
177
  Native table semantics, `aria-sort`, mixed checkboxes, named pagination, polite statuses and failure alerts expose workflow state. Tab moves between controls; Space toggles checkboxes; Enter/Space activate buttons. The named table viewport is keyboard focusable for horizontal scrolling. Controls wrap on narrow screens; tabular content can scroll independently. Selection remains explicit in checkbox state in forced colors.
178
178
 
@@ -180,4 +180,4 @@ Verify the full search, sort, select-across-pages, submit, failure and retry jou
180
180
 
181
181
  ## Related components
182
182
 
183
- Use [Grid](Grid.md) for static card layout, [Checkbox](Checkbox.md) for independent choices, and [MultiSelect](MultiSelect.md) for choosing values rather than operating on records. Use [Dialog](Dialog.md) for application-owned confirmation and [Toast](Toast.md) for mutation outcomes outside the collection.
183
+ Use [`Grid`](Grid.md) for static card layout, [`Checkbox`](Checkbox.md) for independent choices, and [`MultiSelect`](MultiSelect.md) for choosing values rather than operating on records. Use [`Dialog`](Dialog.md) for application-owned confirmation and [`Toast`](Toast.md) for mutation outcomes outside the collection.
@@ -1,6 +1,6 @@
1
1
  # CollectionList
2
2
 
3
- Group records in a native list when people scan names, summaries, status and actions. Use Table when column-by-column comparison is the main task.
3
+ Group records in a native list when people scan names, summaries, status and actions. Use `Table` when column-by-column comparison is the main task.
4
4
 
5
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-collectionlist--docs)
6
6
 
@@ -30,15 +30,15 @@ export function Example() {
30
30
  | Prop | Default | Behavior |
31
31
  |---|---|---|
32
32
  | `as` | `ul` | `ul` for records without a required order; `ol` for an ordered sequence |
33
- | `density` | `comfortable` | `comfortable` or `dense`; affects immediate CollectionRow children |
34
- | `dividers` | true | Rules between immediate CollectionRow children |
33
+ | `density` | `comfortable` | `comfortable` or `dense`; affects immediate `CollectionRow` children |
34
+ | `dividers` | true | Rules between immediate `CollectionRow` children |
35
35
 
36
36
  The root accepts native attributes, `className`, `style` and the correct list ref. With `as="ol"`, native `start`, `reversed`, `type` and numbering behavior remain available. Public types are `CollectionListElement` and generic `CollectionListProps`. A default `role="list"` preserves list semantics where list-style removal affects accessibility exposure; the native element still supplies the structure. See the [W3C list styling guidance](https://design-system.w3.org/styles/lists.html#considerations) for marker removal and list semantics. This is an ordinary list with normal Tab navigation, without listbox selection or arrow-key item navigation.
37
37
 
38
- Use CollectionRow or native `li` children. A non-row `li` retains native semantics but does not receive row slot styling. If a record has leading content or an aside, the list reserves matching columns across its immediate rows; missing optional content does not shift record titles. Metadata and actions stack beneath content below 40rem of available width. Nested lists keep their own sizing and density. Ordered markers remain visible in both directions.
38
+ Use `CollectionRow` or native `li` children. A non-row `li` retains native semantics but does not receive row slot styling. If a record has leading content or an aside, the list reserves matching minimum columns across its immediate rows; missing optional content does not shift record titles. Metadata and actions share one end-aligned line, and stack beneath content, still end-aligned, when a row is narrower than 48rem. Nested lists keep their own sizing and density. Ordered markers remain visible in both directions.
39
39
 
40
- Your app owns stable keys, data ordering, filtering, selection policy, pagination and requests. Keep filters mounted while results update so drafts and keyboard focus survive. Put useful empty/error guidance and a named retry action outside an empty list. Use `aria-busy` for pending content and a concise status message outside the busy subtree. Pagination or virtualization is app-owned; CollectionList renders the children you provide.
40
+ Your app owns stable keys, data ordering, filtering, selection policy, pagination and requests. Keep filters mounted while results update so drafts and keyboard focus survive. Put useful empty/error guidance and a named retry action outside an empty list. Use `aria-busy` for pending content and a concise status message outside the busy subtree. Pagination or virtualization is app-owned; `CollectionList` renders the children you provide.
41
41
 
42
42
  ## Related components
43
43
 
44
- [CollectionRow](CollectionRow.md) supplies record slots; [DescriptionList](DescriptionList.md) presents individual record facts; [Table](Table.md) supports aligned column comparison. See [Structured data](../../../../docs/guides/structured-data.md) for composition guidance.
44
+ [`CollectionRow`](CollectionRow.md) supplies record slots; [`DescriptionList`](DescriptionList.md) presents individual record facts; [`Table`](Table.md) supports aligned column comparison. See [Structured data](../../../../docs/guides/structured-data.md) for composition guidance.
@@ -1,6 +1,6 @@
1
1
  # CollectionRow
2
2
 
3
- Make one record easy to scan inside CollectionList. Compose its primary name, supporting detail, optional selection, metadata and independent actions.
3
+ Make one record easy to scan inside `CollectionList`. Compose its primary name, supporting detail, optional selection, metadata and independent actions.
4
4
 
5
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-collectionrow--docs)
6
6
 
@@ -34,29 +34,29 @@ export function Example() {
34
34
 
35
35
  ## More examples
36
36
 
37
- - [Selection and actions](https://kbui.kcb.pro/storybook/?path=/story/components-collectionrow--selection-and-actions): Checkbox, primary navigation, independent Buttons, Menu focus return and disabled actions.
37
+ - [Selection and actions](https://kbui.kcb.pro/storybook/?path=/story/components-collectionrow--selection-and-actions): `Checkbox`, primary navigation, independent Buttons, `Menu` focus return and disabled actions.
38
38
  - [Long content](https://kbui.kcb.pro/storybook/?path=/story/components-collectionrow--long-content): Wrapping identifiers, metadata and action text.
39
39
 
40
40
  ## Reference
41
41
 
42
42
  | Prop | Default | Behavior |
43
43
  |---|---|---|
44
- | `title` | required | Record name as a ReactNode; compose a Link or correctly ranked Heading when appropriate |
45
- | `description` | unset | Supporting ReactNode, including DescriptionList or zero values |
46
- | `leading` | unset | Avatar, decorative icon or a separately named selection control |
47
- | `metadata` | unset | Status, formatted number, timestamp or other concise ReactNode |
48
- | `actions` | unset | Named Buttons, links or Menu composition; controls keep their own semantics |
44
+ | `title` | required | Record name as a `ReactNode`; compose a `Link` or correctly ranked `Heading` when appropriate |
45
+ | `description` | unset | Supporting `ReactNode`, including `DescriptionList` or zero values |
46
+ | `leading` | unset | `Avatar`, decorative icon or a separately named selection control |
47
+ | `metadata` | unset | `Status`, formatted number, timestamp or other concise `ReactNode` |
48
+ | `actions` | unset | Named Buttons, links or `Menu` composition; controls keep their own semantics |
49
49
  | `selected` | false | Visual state; a selection control owns accessible checked state |
50
50
  | `classNames` | unset | Extra classes for `layout`, `leading`, `content`, `title`, `description`, `aside`, `metadata` and `actions` |
51
51
 
52
- CollectionRow renders native `li`; place it inside CollectionList or another native list. Optional null, boolean and empty-string content omits its slot; numeric zero remains visible. Native list-item attributes, `className`, `style` and ref pass through. `CollectionRowProps` replaces the native title tooltip attribute with the required record title; use a Tooltip composition for contextual help. CollectionRow has no whole-row click handler, navigation destination or automatic focus stop. A link in title handles navigation; an action Button handles its own workflow. Independent actions do not toggle selection implicitly.
52
+ `CollectionRow` renders native `li`; place it inside `CollectionList` or another native list. Optional null, boolean and empty-string content omits its slot; numeric zero remains visible. Native list-item attributes, `className`, `style` and ref pass through. `CollectionRowProps` replaces the native title tooltip attribute with the required record title; use a `Tooltip` composition for contextual help. `CollectionRow` has no whole-row click handler, navigation destination or automatic focus stop. A link in title handles navigation; an action `Button` handles its own workflow. Independent actions do not toggle selection implicitly.
53
53
 
54
- Keep a persistent, record-specific name on selection controls and actions. Hide decorative icons yourself, and supply meaningful alternative text for informative images. When content can be selected, keep `selected` consistent with Checkbox checked state; use stable IDs when filtering or sorting. Disable actual controls for unavailable operations rather than treating the whole row as disabled. A selected row is an ordinary list item, so CollectionRow does not emit grid/listbox `aria-selected` semantics.
54
+ Keep a persistent, record-specific name on selection controls and actions. Hide decorative icons yourself, and supply meaningful alternative text for informative images. When content can be selected, keep `selected` consistent with `Checkbox` checked state; use stable IDs when filtering or sorting. Disable actual controls for unavailable operations rather than treating the whole row as disabled. A selected row is an ordinary list item, so `CollectionRow` does not emit grid/listbox `aria-selected` semantics.
55
55
 
56
- CollectionList aligns optional leading and aside columns across rows. The defaults reserve 3rem for leading content and 12rem for an aside; override `--kb-collectionrow-leading-width` and `--kb-collectionrow-aside-width` for your content. Set padding and gap with component tokens. Below 40rem of parent list width, metadata and actions stack beneath content in DOM order. Long labels and composed Status text wrap, including chips with decorative icons. Action Buttons retain size-based minimum heights while expanding for text. Dense list spacing does not shrink control targets. Standalone native lists do not provide CollectionList's shared responsive alignment; use the paired components for this behavior.
56
+ `CollectionList` aligns optional leading and aside columns across rows. The defaults reserve at least 3rem for leading content and 12rem for an aside; wider leading media, or an aside that needs more room to keep metadata and actions on one line, widens its own row, so set `--kb-collectionrow-leading-width` and `--kb-collectionrow-aside-width` to your widest content to keep every title aligned. Set padding and gap with component tokens. Metadata and actions share one end-aligned line; when the row itself is narrower than 48rem, inside or outside a list, they stack beneath content in DOM order and stay end-aligned. Long labels and composed `Status` text wrap, including chips with decorative icons. Action Buttons retain size-based minimum heights while expanding for text. Dense list spacing does not shrink control targets. Standalone native lists do not provide `CollectionList`'s shared responsive alignment; use the paired components for this behavior.
57
57
 
58
58
  Your app owns loading, error text, formatting, focus after a removed record, and selection scope. Avoid nesting interactive controls inside the title link or making the whole list item act as another button. Verify keyboard order, responsive wrapping and focus in your actual composition; automated stories do not establish screen-reader interoperability or complete-page accessibility.
59
59
 
60
60
  ## Related components
61
61
 
62
- Use [CollectionList](CollectionList.md) for a native record list, [DescriptionList](DescriptionList.md) for key/value details, [Table](Table.md) for comparison across columns, and [Menu](Menu.md) for overflow actions. See [Structured data](../../../../docs/guides/structured-data.md) for the shared decision guide.
62
+ Use [`CollectionList`](CollectionList.md) for a native record list, [`DescriptionList`](DescriptionList.md) for key/value details, [`Table`](Table.md) for comparison across columns, and [`Menu`](Menu.md) for overflow actions. See [Structured data](../../../../docs/guides/structured-data.md) for the shared decision guide.
@@ -1,8 +1,8 @@
1
1
  # Combobox
2
2
 
3
- Use Combobox to filter a longer option list before choosing one or multiple values. Each option has a string `value`, a visible `label`, and an optional `disabled` flag. Single selection uses `string | null`; enable `multiple` to use a `readonly string[]` value and a `(value: string[]) => void` callback. Pass `null` or `[]` for the corresponding empty selection.
3
+ Use `Combobox` to filter a longer option list before choosing one or multiple values. Each option has a string `value`, a visible `label`, and an optional `disabled` flag. Single selection uses `string | null`; enable `multiple` to use a `readonly string[]` value and a `(value: string[]) => void` callback. Pass `null` or `[]` for the corresponding empty selection.
4
4
 
5
- Multiple mode delegates to [MultiSelect](MultiSelect.md), including removable chips, keyboard navigation, clear-all, form submission, and disabled/read-only states. Its popup stays open after selections and deselections, retaining the current filter. Press Escape, click outside, or use the toggle to dismiss it. It uses `.kb-multiselect` CSS anatomy and `ClassNames<MultiSelectSlot>` slots, including `chips`, `chip`, `chipLabel`, and `chipRemove`. Single mode retains `.kb-combobox` anatomy. `ComboboxProps` remains the extensible single-selection interface, so existing wrappers can keep extending it. `ComboboxSingleProps` aliases that interface; use `ComboboxMultipleProps` for a multiple-selection wrapper or React's `ComponentProps<typeof Combobox>` for the complete discriminated union.
5
+ Multiple mode delegates to [`MultiSelect`](MultiSelect.md), including removable chips, keyboard navigation, clear-all, form submission, and disabled/read-only states. Its popup stays open after selections and deselections, retaining the current filter. Press Escape, click outside, or use the toggle to dismiss it. It uses `.kb-multiselect` CSS anatomy and `ClassNames<MultiSelectSlot>` slots, including `chips`, `chip`, `chipLabel`, and `chipRemove`. Single mode retains `.kb-combobox` anatomy. `ComboboxProps` remains the extensible single-selection interface, so existing wrappers can keep extending it. `ComboboxSingleProps` aliases that interface; use `ComboboxMultipleProps` for a multiple-selection wrapper or React's `ComponentProps<typeof Combobox>` for the complete discriminated union.
6
6
 
7
7
  [All components](../../README.md#components) · [Usage](#usage) · [Examples](#more-examples) · [Reference](#reference) · [Live examples and accessibility](https://kbui.kcb.pro/storybook/?path=/docs/components-combobox--docs)
8
8
 
@@ -85,4 +85,4 @@ export function DeploymentRegions() {
85
85
 
86
86
  ## Related components
87
87
 
88
- Use [Select](Select.md) for a dropdown without text filtering, [RadioGroup](RadioGroup.md) for visible options, and [MultiSelect](MultiSelect.md) for several searchable choices.
88
+ Use [`Select`](Select.md) for a dropdown without text filtering, [`RadioGroup`](RadioGroup.md) for visible options, and [`MultiSelect`](MultiSelect.md) for several searchable choices.
@@ -0,0 +1,100 @@
1
+ # ConfirmAction
2
+
3
+ `ConfirmAction` puts a destructive action behind a modal confirmation built on [`Dialog`](Dialog.md). The trigger only opens the confirmation; `onConfirm` runs after a second, explicit choice. It owns Cancel-first focus, the pending guard, blocked dismissal while pending, the failure alert with retry, and closing only after success.
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-confirmaction--docs)
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import "@kb.ui/react/styles.css";
11
+ import { useState } from "react";
12
+ import { ConfirmAction } from "@kb.ui/react";
13
+
14
+ async function deleteProject(): Promise<void> {
15
+ const response = await fetch("/api/projects/portal", { method: "DELETE" });
16
+ if (!response.ok) throw new Error(`Delete failed: ${response.status}`);
17
+ }
18
+
19
+ export function Example() {
20
+ const [deleted, setDeleted] = useState(false);
21
+ return (
22
+ <>
23
+ <p role="status">{deleted ? "Project deleted." : ""}</p>
24
+ <ConfirmAction
25
+ title="Delete project?"
26
+ description="This permanently removes the project and its data."
27
+ pendingLabel="Deleting…"
28
+ errorMessage="Could not delete the project. Try again."
29
+ onConfirm={deleteProject}
30
+ onConfirmed={() => setDeleted(true)}
31
+ >
32
+ Delete project
33
+ </ConfirmAction>
34
+ </>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## More examples
40
+
41
+ - [Default](https://kbui.kcb.pro/storybook/?path=/story/components-confirmaction--default): A danger-zone deletion with consequence details and a pending state.
42
+ - [Failure and retry](https://kbui.kcb.pro/storybook/?path=/story/components-confirmaction--failure-and-retry): The first attempt fails, the dialog stays open with an alert, and the retry succeeds.
43
+ - [Row action](https://kbui.kcb.pro/storybook/?path=/story/components-confirmaction--row-action): A quiet row trigger whose success removes the row and moves focus to the list heading.
44
+
45
+ ## Reference
46
+
47
+ | Part or behavior | Purpose |
48
+ | --- | --- |
49
+ | Trigger | A `danger` [`Button`](Button.md) by default. Native button props, `ref`, `className` and `disabled` reach it. Replace its look with `render`, such as `render={<Button variant="ghost" size="sm" />}`. |
50
+ | Popup | A `Dialog.Content` with `.kb-confirmaction`. `title` names it and `description` describes it; `details` adds further consequence content. |
51
+ | Actions | Cancel first, focused on open, then a `danger` confirm button. |
52
+ | Pending | While `onConfirm` runs, the popup has `aria-busy` and `data-pending`, Escape is ignored, and both buttons stay focusable with `aria-disabled` and ignore presses, so focus is never dropped. |
53
+ | Failure | A throw or rejection keeps the dialog open and shows `errorMessage` in a `role="alert"` danger [`Callout`](Callout.md). Confirming again retries. Closing or reopening clears the error. |
54
+ | Success | The dialog closes, focus returns to the trigger or `finalFocus`, then `onConfirmed` runs. |
55
+ | Outside press | Never dismisses, pending or not. |
56
+
57
+ | Prop | Type | Default | Notes |
58
+ | --- | --- | --- | --- |
59
+ | `children` | `ReactNode` | required | Trigger text; also the confirm button text unless `confirmLabel` is set |
60
+ | `title` | `ReactNode` | required | `Dialog` heading and accessible name; ask the question the action settles |
61
+ | `description` | `ReactNode` | unset | The consequence; the dialog's accessible description |
62
+ | `details` | `ReactNode` | unset | Further consequence content, such as what else is removed |
63
+ | `onConfirm` | `() => unknown` | required | Runs the action. Return a promise for asynchronous work; throw or reject on failure |
64
+ | `onConfirmed` | `() => void` | unset | Runs once per success, after the popup has unmounted; remove the trigger here. Also runs when success lands after a controlled close |
65
+ | `confirmLabel` | `ReactNode` | `children` | Confirm button text; repeat the action's verb |
66
+ | `pendingLabel` | `ReactNode` | `confirmLabel` | Confirm button text while the action runs |
67
+ | `cancelLabel` | `ReactNode` | `"Cancel"` | Cancel button text |
68
+ | `errorMessage` | `ReactNode \| (error: unknown) => ReactNode` | `"The action did not complete. Try again."` | Alert text after a failure; a function receives the thrown reason |
69
+ | `open` | `boolean` | uncontrolled | Controlled visibility |
70
+ | `defaultOpen` | `boolean` | `false` | Initial visibility when uncontrolled |
71
+ | `onOpenChange` | `(open: boolean) => void` | unset | Each visibility change, including the close after success; pending dismissals never reach it |
72
+ | `finalFocus` | `Dialog` `finalFocus` | trigger | Focus target after closing; set it when success removes the trigger |
73
+ | `container` | portal container | document body | Themed host for the popup |
74
+ | `classNames` | `{ popup?, backdrop?, details?, error? }` | unset | Classes for inner parts |
75
+ | `render` | Base UI `render` | `<Button variant="danger" />` | Trigger element |
76
+
77
+ ```tsx
78
+ <ConfirmAction
79
+ render={<Button variant="ghost" size="sm" />}
80
+ aria-label="Revoke Laptop"
81
+ title="Revoke Laptop?"
82
+ description="Requests signed with this key fail immediately."
83
+ confirmLabel="Revoke key"
84
+ finalFocus={listHeading}
85
+ onConfirm={() => revokeKey("laptop")}
86
+ onConfirmed={() => removeRow("laptop")}
87
+ >
88
+ Revoke
89
+ </ConfirmAction>
90
+ ```
91
+
92
+ ## Responsibilities
93
+
94
+ The application owns the operation: authorization, idempotency, timeouts and what the server deletes. `onConfirm` must settle; a promise that never settles leaves the dialog pending. Announce success in the page, because the dialog is gone when it completes. Remove the trigger's row in `onConfirmed`, not inside `onConfirm`: a data layer that removes the row while the action is still settling unmounts the dialog mid-close and loses focus. Do not attach the same action anywhere else on the trigger; the confirmation is its one route.
95
+
96
+ For an urgent interruption that needs `alertdialog` semantics, use an alert-dialog primitive. `ConfirmAction` remains a named modal dialog, as the [confirmation pattern](../../../../docs/guides/forms-and-overlays.md#confirmation-pattern) describes.
97
+
98
+ ## Related components
99
+
100
+ Use [`Dialog`](Dialog.md) to compose a confirmation that needs fields or a different action layout. Use [`Button`](Button.md) `variant="danger"` alone only when the action is reversible, such as one with undo.
@@ -34,8 +34,8 @@ export function Example() {
34
34
  | `size` | `sm` (40rem) `md` (64rem) `lg` (80rem) `full` (unbounded) | `lg` |
35
35
  | `gutter` | Shared 1–2rem inline padding; false removes it | `true` |
36
36
 
37
- 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.
37
+ Set `as` explicitly when using an element other than the default; native props and refs then match that element. An explicit `gutter` value takes priority over a conflicting data attribute. Widths include side padding. Use one page container, and turn off nested gutters when the parent already provides padding.
38
38
 
39
39
  ## Related components
40
40
 
41
- Use [Inline](Inline.md) for a row, [Grid](Grid.md) for a collection, and [Split](Split.md) for two responsive columns.
41
+ Use [`Inline`](Inline.md) for a row, [`Stack`](Stack.md) for vertical flow, [`Grid`](Grid.md) for a collection, and [`Split`](Split.md) for two responsive columns.