@capra/core 1.5.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/index.cjs +42 -78
  2. package/dist/index.d.cts +8 -2
  3. package/dist/index.d.mts +8 -2
  4. package/dist/index.mjs +42 -78
  5. package/dist/style.css +62 -32
  6. package/docs/conventions--docs.md +186 -0
  7. package/docs/core-alert--design.md +110 -0
  8. package/docs/core-alert--usage.md +13 -0
  9. package/docs/core-anchor--design.md +39 -0
  10. package/docs/core-anchor--usage.md +39 -0
  11. package/docs/core-autocompletefield--design.md +91 -0
  12. package/docs/core-autocompletefield--usage.md +18 -0
  13. package/docs/core-badge--design.md +70 -0
  14. package/docs/core-badge--usage.md +13 -0
  15. package/docs/core-breadcrumbs--design.md +65 -0
  16. package/docs/core-breadcrumbs--usage.md +16 -0
  17. package/docs/core-button--design.md +97 -0
  18. package/docs/core-button--usage.md +17 -0
  19. package/docs/core-buttonlink--design.md +7 -0
  20. package/docs/core-buttonlink--usage.md +24 -0
  21. package/docs/core-card--design.md +100 -0
  22. package/docs/core-card--usage.md +5 -0
  23. package/docs/core-checkbox--design.md +66 -0
  24. package/docs/core-checkbox--usage.md +34 -0
  25. package/docs/core-collapse--design.md +28 -0
  26. package/docs/core-collapse--usage.md +20 -0
  27. package/docs/core-datepickerfield--design.md +71 -0
  28. package/docs/core-datepickerfield--usage.md +57 -0
  29. package/docs/core-daterangepickerfield--design.md +76 -0
  30. package/docs/core-daterangepickerfield--usage.md +62 -0
  31. package/docs/core-divider--design.md +35 -0
  32. package/docs/core-divider--usage.md +8 -0
  33. package/docs/core-drawer--design.md +87 -0
  34. package/docs/core-drawer--usage.md +9 -0
  35. package/docs/core-emptystate--design.md +45 -0
  36. package/docs/core-emptystate--usage.md +13 -0
  37. package/docs/core-helpertext--design.md +30 -0
  38. package/docs/core-helpertext--usage.md +11 -0
  39. package/docs/core-iconbutton--design.md +87 -0
  40. package/docs/core-iconbutton--usage.md +15 -0
  41. package/docs/core-inputrow--design.md +85 -0
  42. package/docs/core-inputrow--usage.md +6 -0
  43. package/docs/core-label--design.md +27 -0
  44. package/docs/core-label--usage.md +17 -0
  45. package/docs/core-link--design.md +58 -0
  46. package/docs/core-link--usage.md +16 -0
  47. package/docs/core-listitem--design.md +70 -0
  48. package/docs/core-listitem--usage.md +6 -0
  49. package/docs/core-menu--design.md +106 -0
  50. package/docs/core-menu--usage.md +16 -0
  51. package/docs/core-modal--design.md +39 -0
  52. package/docs/core-modal--usage.md +11 -0
  53. package/docs/core-numberfield--design.md +12 -0
  54. package/docs/core-numberfield--usage.md +14 -0
  55. package/docs/core-pagination--design.md +30 -0
  56. package/docs/core-pagination--usage.md +13 -0
  57. package/docs/core-passwordfield--design.md +7 -0
  58. package/docs/core-passwordfield--usage.md +3 -0
  59. package/docs/core-pill--design.md +94 -0
  60. package/docs/core-pill--usage.md +10 -0
  61. package/docs/core-popover--design.md +25 -0
  62. package/docs/core-popover--usage.md +8 -0
  63. package/docs/core-radio--design.md +39 -0
  64. package/docs/core-radio--usage.md +8 -0
  65. package/docs/core-radiogroup--design.md +5 -0
  66. package/docs/core-radiogroup--usage.md +12 -0
  67. package/docs/core-radiotile--design.md +5 -0
  68. package/docs/core-radiotile--usage.md +10 -0
  69. package/docs/core-ribbon--design.md +39 -0
  70. package/docs/core-ribbon--usage.md +12 -0
  71. package/docs/core-skeleton--design.md +88 -0
  72. package/docs/core-skeleton--usage.md +13 -0
  73. package/docs/core-skeletongroup--design.md +50 -0
  74. package/docs/core-skeletongroup--usage.md +10 -0
  75. package/docs/core-spinner--design.md +99 -0
  76. package/docs/core-spinner--usage.md +11 -0
  77. package/docs/core-switch--design.md +145 -0
  78. package/docs/core-switch--usage.md +8 -0
  79. package/docs/core-tabnav--design.md +77 -0
  80. package/docs/core-tabnav--usage.md +63 -0
  81. package/docs/core-tag--design.md +21 -0
  82. package/docs/core-tag--usage.md +11 -0
  83. package/docs/core-text--design.md +32 -0
  84. package/docs/core-text--usage.md +10 -0
  85. package/docs/core-textarea--design.md +74 -0
  86. package/docs/core-textarea--usage.md +18 -0
  87. package/docs/core-textfield--design.md +81 -0
  88. package/docs/core-textfield--usage.md +12 -0
  89. package/docs/core-textinput--design.md +72 -0
  90. package/docs/core-textinput--usage.md +19 -0
  91. package/docs/core-toast--design.md +100 -0
  92. package/docs/core-toast--usage.md +11 -0
  93. package/docs/core-tooltip--design.md +61 -0
  94. package/docs/core-tooltip--usage.md +48 -0
  95. package/docs/core-topnav--design.md +75 -0
  96. package/docs/core-topnav--usage.md +6 -0
  97. package/docs/core-verticalnavigation--design.md +31 -0
  98. package/docs/core-verticalnavigation--usage.md +17 -0
  99. package/docs/core-visuallyhidden--design.md +87 -0
  100. package/docs/core-visuallyhidden--usage.md +35 -0
  101. package/docs/history-changelogs-capra-core--docs.md +60 -0
  102. package/docs/index.md +110 -0
  103. package/docs/using-capra--docs.md +39 -0
  104. package/package.json +5 -4
@@ -0,0 +1,91 @@
1
+ # Core/AutocompleteField - Design
2
+
3
+ AutocompleteField combines a text field with a suggestions list. Consumers can supply static `AutocompleteField.Item` children or an `items` collection with an optional default item renderer. The field allows custom values that are not in the list.
4
+
5
+ ## Anatomy
6
+
7
+ 1. **Text input** — Entry is through a standard text input. The field keeps focus while the list is open so typing and keyboard
8
+ navigation stay in one place.
9
+ 2. **ListBox** — Filtered results appear in a ListBox under the field.
10
+
11
+ ## Properties
12
+
13
+ ### Label
14
+
15
+ A label is required for input fields and succinctly describes the field’s purpose. If another text element is acting
16
+ as the label, like a section title, ensure the proper aria relationships are linked.
17
+
18
+ ### Placeholder text
19
+
20
+ <p>
21
+ Placeholder text is visible until a character is entered.
22
+ </p>
23
+
24
+ <p>
25
+ Because the placeholder text disappears, putting instructions or requirements as placeholder text is not
26
+ accessible. Helper text is the preferred method to convey this information.
27
+ </p>
28
+
29
+ ### Helper text
30
+
31
+ Helper text is placed below the field and informs the user of any requirements, disclaimers, and errors. Helper text
32
+ is shown persistently but is replaced by error text when an error occurs.
33
+
34
+ ### Layout
35
+
36
+ There are two layouts available for text fields, vertical and horizontal. Vertical labels are the preferred layout,
37
+ appearing above the field. Horizontal labels appear on the leading side of the field, and should only be used when
38
+ space is limited.
39
+
40
+ ## Layout and spacing
41
+
42
+ * Input renders identically to [TextField](?path=/docs/core-textfield--design).
43
+ * Suggestions are presented using a ListBox.
44
+
45
+ ## Behavior
46
+
47
+ ### Autocomplete vs. Select
48
+
49
+ <p>
50
+ **Autocomplete** is an input box with text hints that users can type freely into. Hints are presented and refined
51
+ ina selection list as the user types. Freeform entry is allowed.
52
+ </p>
53
+
54
+ <p>
55
+ **Select**
56
+
57
+ allows selecting options only among a given set of choices.
58
+ </p>
59
+
60
+ ### Filtering
61
+
62
+ As the user types into the text field options are filtered based on the value.
63
+
64
+ ## Best Practices
65
+
66
+ Do:
67
+
68
+ * Do show a "no results" message when the filter returns nothing.
69
+ * Do support keyboard-only navigation of suggestions.
70
+
71
+ Don't:
72
+
73
+ * Don't use AutocompleteField for small mutually exclusive sets (about seven or fewer visible options) — use [RadioGroup](?path=/docs/core-radiogroup--design) or Select.
74
+ * Don't use AutocompleteField for plain freeform text with no list validation — use [TextField](?path=/docs/core-textfield--design).
75
+ * Don't require picking from the list while still allowing arbitrary text without explaining that behavior.
76
+
77
+ ## Accessibility
78
+
79
+ * `role="combobox"` on the input, `aria-expanded` reflects list open state.
80
+ * `aria-controls` references the suggestion list `id`.
81
+ * `aria-activedescendant` references the currently focused suggestion.
82
+ * Suggestion list: `role="listbox"`, each suggestion: `role="option"`.
83
+
84
+ ### Keyboard interaction
85
+
86
+ * Keyboard interactions follow Select and ListBox.
87
+
88
+ ## Related components
89
+
90
+ * [TextField](?path=/docs/core-textfield--design) — For freeform text without suggestions.
91
+ * [RadioGroup](?path=/docs/core-radiogroup--design) — For small mutually exclusive option sets.
@@ -0,0 +1,18 @@
1
+ # Core/AutocompleteField - Usage
2
+
3
+ AutocompleteField combines a text field with a suggestions list. Consumers can supply static `AutocompleteField.Item` children or an `items` collection with an optional default item renderer. The field allows custom values that are not in the list.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `canClear` | `boolean` | No | `--` | Whether to show a clear button for the input. |
8
+ | `children` | `React.ReactNode \| (( values: T & { defaultChildren: React.ReactNode \| undefined; }, ) => React.ReactNode)` | No | `--` | The children to render in the dropdown. |
9
+ | `itemFilter` | `(textValue: string, inputValue: string) => boolean` | No | `--` | A function that filters the items based on the input value. |
10
+ | `onChange` | `(value: string) => void` | No | `--` | A callback function that is called when the input value changes. |
11
+ | `onOpenChange` | `(isOpen: boolean) => void` | No | `--` | A callback function that is called when the dropdown is opened or closed. |
12
+ | `items` | `AutocompleteItem[]` | No | `--` | The items to display in the dropdown. |
13
+ | `value` | `AutocompleteItem['value']` | No | `--` | The value of the input. |
14
+ | `shouldAutoSizeDropdown` | `boolean` | No | `--` | Whether to automatically size the dropdown to the width of the input. Defaults to `true` |
15
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
16
+ | `helperText` | `string` | No | `--` | Helper text below the field. Replaced by error message when status is error. Use for requirements, disclaimers. |
17
+ | `label` | `string` | No | `--` | Label for the field. Required for accessibility; use aria-label if another element acts as label. |
18
+ | `layout` | `'vertical' \| 'horizontal'` | No | `--` | Label and field layout: vertical (label above) or horizontal (label on leading side). Prefer vertical; use horizontal when space is limited. |
@@ -0,0 +1,70 @@
1
+ # Core/Badge - Design
2
+
3
+ Badges display an indicator/counter on an associated component.
4
+
5
+ ## Properties
6
+
7
+ ### Label
8
+
9
+ A label is required to indicate the number of notifications.
10
+
11
+ ### Size
12
+
13
+ Badges come in 3 sizes to support ones, tens, and values above 100.
14
+
15
+ ### Dot
16
+
17
+ Use a dot to show notifications without a count.
18
+
19
+ ### Appearance
20
+
21
+ Badges can be colored based on their status. The `attention` appearance is the general purpose color used for numbered badges and does not necessarily communicate severity.
22
+
23
+ Using color as the only means to communicate status should be avoided (WCAG SC 1.4.1: Use of Color, Level A). Badges that communicate status must be accompanied by supplementary information that clearly communicates the status.
24
+
25
+ ## Behavior
26
+
27
+ ### Corner attachment
28
+
29
+ Badges are placed in the top-right of the parent component to avoid obscuring the parent content.
30
+
31
+ ### Inline
32
+
33
+ When used with text labels, badges are placed on the trailing side and vertically aligned to the text's line height.
34
+
35
+ ## Content
36
+
37
+ ### Maximum
38
+
39
+ The maximum number shown in 99. When there are more than 99 notifications a "+" is appended to the label.
40
+
41
+ ## Best Practices
42
+
43
+ Do:
44
+
45
+ * Do cap displayed values at 99 with a "99+" label.
46
+ * Do use the dot variant for simple presence indicators.
47
+ * Do include count context in the parent's accessible label.
48
+
49
+ Don't:
50
+
51
+ * Don't use Badge for semantic status text — use Pill.
52
+ * Don't use Badge for labels or tags — use Tag.
53
+ * Don't place Badge on non-interactive decorative elements.
54
+ * Don't use Badge colors as the only method to communicate status.
55
+
56
+ ## Accessibility
57
+
58
+ * The badge is a nested static element; it is announced as part of its parent.
59
+ * The parent element's accessible label should include the count context (e.g., "Notifications, 5 unread").
60
+ * Use `aria-live="polite"` on the parent for dynamic badge updates.
61
+
62
+ ## Content
63
+
64
+ * Numeric only.
65
+ * Max displayed value: 99; use "99+" for larger counts.
66
+
67
+ ## Related components
68
+
69
+ * [Pill](?path=/docs/core-pill--design) — For semantic status labels.
70
+ * [Tag](?path=/docs/core-tag--design) — For removable text chips.
@@ -0,0 +1,13 @@
1
+ # Core/Badge - Usage
2
+
3
+ Badges display an indicator/counter on an associated component.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `variant` | `'counter' \| 'dot'` | No | `--` | The variant of the badge. 'counter' displays a count, 'dot' displays only a dot.<br>@default 'counter' |
8
+ | `appearance` | `'danger' \| 'info' \| 'success' \| 'warning'` | No | 'danger' | Controls the Badge color.<br>@default 'danger' |
9
+ | `count` | `number` | No | 0 | The number to display in the badge. Default is 0. |
10
+ | `showZero` | `boolean` | No | false | Whether to display the badge when the count is zero. Default is false. |
11
+ | `overflowCount` | `number` | No | 99 | The number to display in the badge when the count is greater than the overflow count. Default is 99. |
12
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
13
+ | `aria-live` | `React.AriaAttributes['aria-live']` | No | `--` | `--` |
@@ -0,0 +1,65 @@
1
+ # Core/Breadcrumbs - Design
2
+
3
+ Renders a breadcrumb trail with built-in support for collection behavior, keyboard support, and current-page semantics. Wrap items with {@link Breadcrumb}. The last item should represent the current page (typically without an `href`).
4
+
5
+ ## Usage
6
+
7
+ Use Breadcrumbs on views that sit deeper than the home or root level so people see where they are in the hierarchy and can jump to ancestors.
8
+
9
+ Place them above the page title, keep labels aligned with each destination's title, and render every segment except the current page as a link.
10
+
11
+ ## Layout and spacing
12
+
13
+ * Place above the page heading.
14
+
15
+ ## Behavior
16
+
17
+ * Current page item is not a link (no click interaction).
18
+
19
+ ## Content
20
+
21
+ * Use the same label as the page heading for each item.
22
+ * Title case.
23
+ * Keep each label concise (1-3 words).
24
+
25
+ ## Best Practices
26
+
27
+ Do:
28
+
29
+ * Do make all items except the last one clickable links.
30
+ * Do mark the current page with `aria-current="page"`.
31
+
32
+ Don't:
33
+
34
+ * Don't show breadcrumbs on top-level pages — there is no trail to show.
35
+ * Don't use breadcrumbs when the IA is flat and would produce a single segment.
36
+ * Don't use custom separator text that is read by screen readers.
37
+
38
+ ## Accessibility
39
+
40
+ * Wrap in a `<nav aria-label="breadcrumb">` element.
41
+ * Current page item uses `aria-current="page"`.
42
+ * Separator characters are `aria-hidden="true"`.
43
+
44
+ ### Keyboard interaction
45
+
46
+ | Key | Function |
47
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
+ | `Tab` | Move focus forward along the breadcrumb trail. |
49
+ | `Shift + Tab` | Move focus back along the breadcrumb trail. |
50
+ | `Enter` | Activates the currently focused link. If a dropdown crumb has focus, opens the menu and gives focus to the currently selected option. If a menu item has focus, activates the item and closes the menu. |
51
+ | `Space` | If a dropdown crumb has focus, opens the menu and gives focus to the currently selected option. |
52
+ | `Down Arrow` | If a dropdown crumb has focus, opens the menu and gives focus to the currently selected option. If a menu item has focus, moves focus to the next item. |
53
+ | `Up Arrow` | If a menu item has focus, moves focus to the previous item. |
54
+ | `Esc` | If a dropdown crumb is open, closes the menu and returns focus to the trigger. |
55
+
56
+ * If a dropdown crumb is open: the `tab` and `shift`+`tab` keys do not navigate.
57
+
58
+ ### Labeling
59
+
60
+ * Breadcrumbs represent a hierarchy and need to announce themselves accordingly. Using `aria-label`, a crumb should identify itself and its parents.
61
+ * Use `aria-current=”page”` to indicate the last page in the breadcrumb order.
62
+
63
+ ## Related components
64
+
65
+ * [TabNav](?path=/docs/core-tabnav--design) — For in-page section navigation.
@@ -0,0 +1,16 @@
1
+ # Core/Breadcrumbs - Usage
2
+
3
+ Renders a breadcrumb trail with built-in support for collection behavior, keyboard support, and current-page semantics. Wrap items with {@link Breadcrumb}. The last item should represent the current page (typically without an `href`).
4
+
5
+ :::warning[Partially implemented]
6
+
7
+ The `Breadcrumbs` component is partially implemented and does not yet support dropdowns as items.
8
+
9
+ :::
10
+
11
+ | Prop | Type | Required | Default | Description |
12
+ | --- | --- | --- | --- | --- |
13
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
14
+ | `aria-label` | `string` | No | 'Breadcrumb' | Accessible name for the breadcrumb navigation landmark.<br>Defaults to `"Breadcrumb"`. |
15
+ | `size` | `string` | No | 'md' | `--` |
16
+ | `shouldEmpasizeCurrent` | `boolean` | No | true | `--` |
@@ -0,0 +1,97 @@
1
+ # Core/Button - Design
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ ## Usage
6
+
7
+ Use a Button when someone needs to submit a form, confirm an action, or move a workflow forward, and the action warrants a dedicated, labeled control.
8
+
9
+ Use at most one primary (`variant="primary"`) button per view or modal for the main outcome. Pair it with a secondary (`variant="secondary"`) button for cancel or alternate paths. Use `appearance="danger"` with primary or secondary for destructive or irreversible actions.
10
+
11
+ ## Properties
12
+
13
+ ### Variant
14
+
15
+ | Variant | Usage |
16
+ | ----------- | --------------------------------------------------------------------- |
17
+ | `primary` | Highest visual weight. Use once per view for the main action. |
18
+ | `secondary` | Pairs with a primary button for cancel or alternative paths. |
19
+ | `tertiary` | Lowest visual weight. Use for supplementary or de-emphasized actions. |
20
+
21
+ ### Label
22
+
23
+ Labels should use a verb + noun structure to describe what the button will do when pressed.
24
+
25
+ ### Icon
26
+
27
+ Buttons have two icon slots; a leading and a trailing icon. Use the leading icons to visually reinforce their meaning and draw attention.
28
+
29
+ Trailing icons are used for disclosure and additional behavior indications.
30
+
31
+ ### Size
32
+
33
+ Buttons come is three different sizes. Medium is the default and preferred size for most situations.
34
+
35
+ Small size is used when a button is inline with another element, such as a table or popover.
36
+
37
+ ### Appearance
38
+
39
+ | Appearance | Default | Usage |
40
+ | ---------- | ------- | ----------------------------------------------------------- |
41
+ | `default` | ✓ | Standard interactive actions. |
42
+ | `neutral` | | Lower-prominence secondary actions within a filled surface. |
43
+ | `danger` | | Destructive or irreversible actions (delete, revoke). |
44
+
45
+ ### Size
46
+
47
+ | Size | Default | Usage |
48
+ | ---- | ------- | --------------------------------------------------- |
49
+ | `sm` | | Compact toolbars, table row actions, dense layouts. |
50
+ | `md` | ✓ | Standard form actions, modal footers. |
51
+ | `lg` | | Call-to-action in empty states, hero sections. |
52
+ | `xl` | | Marketing or onboarding hero sections. |
53
+
54
+ ## Content
55
+
56
+ * Use verb-first labels: "Save changes", "Add item", "Delete record".
57
+ * Title case for all button labels.
58
+ * Keep labels to 1-3 words when possible. Never exceed 5 words.
59
+ * Use "Add" not "New" (e.g., "Add source", not "New source").
60
+ * Avoid vague labels like "OK" or "Submit" — be specific about the action.
61
+
62
+ ## Behavior
63
+
64
+ * Activated with mouse click, Enter key, or Space key.
65
+ * Pending state (`pending` prop): replaces the leading icon or prepends a spinner while an async action is in progress; preserve button width to avoid layout shift.
66
+ * Disabled state: buttons with `disabled` prop are non-interactive and non-focusable; use `aria-disabled` if the button should remain focusable (e.g., with a tooltip explaining why it's disabled).
67
+
68
+ ## Best Practices
69
+
70
+ Do:
71
+
72
+ * Do use a single `variant="primary"` button per view.
73
+ * Do pair primary with secondary for confirm/cancel patterns.
74
+ * Do use `appearance="danger"` for destructive actions.
75
+ * Do use verb-first, title-case labels.
76
+
77
+ Don't:
78
+
79
+ * Don't use a Button for navigation to another page — use [Link](?path=/docs/core-link--design) or [Anchor](?path=/docs/core-anchor--design).
80
+ * Don't use a Button for text-only inline navigation — use [Link](?path=/docs/core-link--design).
81
+ * Don't use a Button for icon-only actions — use [IconButton](?path=/docs/core-iconbutton--design).
82
+ * Don't use two primary buttons side by side.
83
+ * Don't truncate button labels.
84
+ * Don't disable a button without explaining why (use `aria-disabled` with a tooltip).
85
+
86
+ ## Accessibility
87
+
88
+ * Always provide a visible text label; if the design requires a short label, add `aria-label` for context.
89
+ * For icon-only use cases, use [IconButton](?path=/docs/core-iconbutton--design) instead (which enforces an accessible label).
90
+ * Tab / Shift+Tab to focus. Enter or Space to activate.
91
+ * The pending state must be communicated to assistive technology (e.g., `aria-label="Saving..."` when `pending` is true).
92
+
93
+ ## Related components
94
+
95
+ * [IconButton](?path=/docs/core-iconbutton--design) — For icon-only actions.
96
+ * [Link](?path=/docs/core-link--design) — For inline text navigation.
97
+ * [Modal](?path=/docs/core-modal--design) — Buttons typically appear in modal footers for confirm/cancel patterns.
@@ -0,0 +1,17 @@
1
+ # Core/Button - Usage
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `children` | `string` | Yes | `--` | The `label` for the button. |
8
+ | `variant` | `(typeof variants)[number]` | No | 'secondary' | Which button style to use. Defaults to `secondary`. |
9
+ | `appearance` | `(typeof appearances)[number]` | No | 'default' | Appearance to apply to the button. Defaults to `default`. |
10
+ | `size` | `(typeof sizes)[number]` | No | 'md' | Size of the button. Defaults to `md`. |
11
+ | `disabled` | `boolean` | No | false | Whether the button is disabled. |
12
+ | `pending` | `boolean` | No | false | Whether the button is in a pending state. |
13
+ | `leadingIcon` | `SvgIcon` | No | `--` | Icon to display before the button text. |
14
+ | `trailingIcon` | `SvgIcon` | No | `--` | Icon to display after the button text. |
15
+ | `block` | `boolean` | No | `--` | Whether to display the button as a block-level (full-width) component. Defaults to `false`. |
16
+ | `onClick` | `React.ComponentProps<'button'>['onClick']` | No | `--` | Click handler for the button. |
17
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
@@ -0,0 +1,7 @@
1
+ # Core/ButtonLink - Design
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ `ButtonLink` follows the design guidelines for [`Button`](?path=/docs/core-button--design) and uses [`Link`](?path=/docs/core-link--design) interally. Use it when you need a link styled as a button.
6
+
7
+ See those pages for more details on the properties and usage of `ButtonLink`.
@@ -0,0 +1,24 @@
1
+ # Core/ButtonLink - Usage
2
+
3
+ Primary interactive element displaying text and supporting leading and trailing icons.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `children` | `string` | Yes | `--` | The `label` for the link. |
8
+ | `variant` | `(typeof variants)[number]` | No | 'secondary' | Which visual style to use. Defaults to `secondary`. |
9
+ | `appearance` | `(typeof appearances)[number]` | No | 'default' | Appearance to apply to the link. Defaults to `default`. |
10
+ | `size` | `(typeof sizes)[number]` | No | 'md' | Size of the link. Defaults to `md`. |
11
+ | `disabled` | `boolean` | No | false | Whether the link is disabled. |
12
+ | `pending` | `boolean` | No | false | Whether the link is in a pending state. |
13
+ | `leadingIcon` | `SvgIcon` | No | `--` | Icon to display before the link text. |
14
+ | `trailingIcon` | `SvgIcon` | No | `--` | Icon to display after the link text. |
15
+ | `block` | `boolean` | No | `--` | Whether to display the link as a block-level (full-width) component. Defaults to `false`. |
16
+ | `as` | `As` | No | `--` | The underlying element rendered by the component. Defaults to `a`. |
17
+ | `href` | `unknown` | No | `--` | A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). |
18
+ | `hrefLang` | `string` | No | `--` | Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang). |
19
+ | `target` | `HTMLAttributeAnchorTarget` | No | `--` | The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). |
20
+ | `rel` | `string` | No | `--` | The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). |
21
+ | `download` | `boolean \| string` | No | `--` | Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download). |
22
+ | `referrerPolicy` | `HTMLAttributeReferrerPolicy` | No | `--` | How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy). |
23
+ | `routerOptions` | `unknown` | No | `--` | Options for the configured client side router. |
24
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
@@ -0,0 +1,100 @@
1
+ # Core/Card - Design
2
+
3
+ The base component for the card.
4
+
5
+ ## Usage
6
+
7
+ Use a Card to group related content—title, optional description, body, actions, and footer—into one scannable unit, often in grids or lists of similar items.
8
+
9
+ Treat the card as a container: put links and buttons inside slots rather than making the whole surface ambiguous.
10
+
11
+ ## Properties
12
+
13
+ ### Title
14
+
15
+ <p>
16
+ All cards must have a title identifying their content purpose. Use sentence case.
17
+ </p>
18
+
19
+ <p>
20
+ Card titles are wrapped by an `h2` by default, but can change based on their hierarchy within the page. Be sure to
21
+ note the heading level in your design file. The header's visual presentation remains the same regardless of
22
+ heading level.
23
+ </p>
24
+
25
+ ### Description
26
+
27
+ <p>
28
+ Optional. The description gives additional context to the contexts of the card. Descriptions should be brief,
29
+ taking up no more than a single line.
30
+ </p>
31
+
32
+ ### Actions
33
+
34
+ <p>
35
+ Contextual actions act on the main content area but keep the user's workflow within the card. Common examples
36
+ would be controls that act upon data visualizations, such as a View Switcher and range selections.
37
+ </p>
38
+
39
+ <p>
40
+ Supporting, non-interactive, data can also be displayed in this space.
41
+ </p>
42
+
43
+ ### Content
44
+
45
+ <p>
46
+ The primary content of the card. This is generally "one thing", though that could be a complex element such as a
47
+ graph or form.
48
+ </p>
49
+
50
+ ### Footer
51
+
52
+ <p>
53
+ Place actions or supplementary information to the primary content in the card's footer.
54
+ </p>
55
+
56
+ <p>
57
+ Actions placed here (e.g., a submit button for a form) take the user's workflow out of the card. There should be
58
+ an explicit indication of completion within the context of the card when the action is taken.
59
+ </p>
60
+
61
+ ## Layout and spacing
62
+
63
+ * Padding: `spacing.xl` on all sides (standard), `spacing.lg` for compact cards.
64
+ * Title and description: `spacing.sm` gap between them.
65
+ * Title/description block and content: `spacing.lg` gap.
66
+ * Border: `shape.border.default`, `shape.radius.xl`.
67
+ * Background: `color.background.panel.solid`.
68
+
69
+ ## Behavior
70
+
71
+ * Cards are static containers by default.
72
+ * If the entire card is interactive (e.g., a selectable card), use `role="button"` with keyboard support. Prefer [RadioTile](?path=/docs/core-radiotile--design) for selection scenarios.
73
+
74
+ ## Content
75
+
76
+ * Title: sentence case, noun phrase.
77
+ * Description: optional; one short line, sentence case with punctuation if needed.
78
+ * Action labels: verb-first, title case.
79
+
80
+ ## Best Practices
81
+
82
+ Do:
83
+
84
+ * Do include a title in every card.
85
+ * Do use the footer slot for secondary metadata (timestamps, status).
86
+
87
+ Don't:
88
+
89
+ * Don't make the entire card surface the only navigation affordance — put a [Link](?path=/docs/core-link--design) or [Button](?path=/docs/core-button--design) inside the content.
90
+ * Don't use Card for tabular data — use a table.
91
+
92
+ ## Accessibility
93
+
94
+ * Card titles are typically wrapped at an `h2` by default; choose the heading level (`h2`–`h6`) to match the page outline. Note the intended level in design specs—the visual style stays the same across levels.
95
+ * If the card is a landmark region, wrap with `<section aria-labelledby>`.
96
+
97
+ ## Related components
98
+
99
+ * [RadioTile](?path=/docs/core-radiotile--design) — For selectable card options.
100
+ * [Modal](?path=/docs/core-modal--design) — For focused overlay containers.
@@ -0,0 +1,5 @@
1
+ # Core/Card - Usage
2
+
3
+ The base component for the card.
4
+
5
+ ## Card
@@ -0,0 +1,66 @@
1
+ # Core/Checkbox - Design
2
+
3
+ Checkbox component for capturing boolean user input. Supports controlled and uncontrolled modes with proper accessibility.
4
+
5
+ ## Usage
6
+
7
+ Use a Checkbox when people can turn several options on or off independently within a group, and those choices apply when the form is submitted (or in another explicit save step).
8
+
9
+ Use a visible group heading and stack options so each label stays associated with its control. Use `indeterminate` on a parent checkbox when a tree or grouped list is partially selected.
10
+
11
+ ## Properties
12
+
13
+ ### Label
14
+
15
+ A label is required for all checkboxes. They should be short and represent a value or yes/no decision. Ensure
16
+ `aria-label` or `aria-labelledby` is used if the checkbox label is not immediately associated with the control.
17
+
18
+ ### Checked
19
+
20
+ A checkbox can be unchecked, checked, or in an indeterminate state
21
+
22
+ ### Disabled
23
+
24
+ A checkbox can be disabled in any state if there is a prerequisite to enable the selection.
25
+
26
+ ## Content
27
+
28
+ * Sentence case labels.
29
+ * Describe the option, not the action (e.g., "Send email notifications", not "Enable email").
30
+
31
+ ## Behaviour
32
+
33
+ ### Single choice
34
+
35
+ A single discrete checkbox can be used for yes/no decisions within a form.
36
+
37
+ ### Overflow
38
+
39
+ Labels will wrap if they are wider than the parent container. The checkbox remains aligned to the top of the text
40
+ box.
41
+
42
+ ## Best Practices
43
+
44
+ Do:
45
+
46
+ * Do use checkboxes for multi-select form options.
47
+ * Do use `indeterminate` for parent checkboxes in tree structures.
48
+ * Do provide a group heading for checkbox groups.
49
+
50
+ Don't:
51
+
52
+ * Don't use Checkbox for settings that apply immediately without submit — use Switch.
53
+ * Don't use Checkbox for mutually exclusive options — use RadioGroup.
54
+ * Don't use a lone Checkbox as a single on/off setting that applies immediately — use Switch.
55
+
56
+ ## Accessibility
57
+
58
+ * `role="checkbox"`, `aria-checked` (including "mixed" for indeterminate).
59
+ * Associate label using `<label for>` or wrapping `<label>`.
60
+ * Checkbox group must have a group heading using `role="group"` with `aria-labelledby`.
61
+ * Keyboard: Tab / Shift+Tab moves focus; Space or Enter toggles state when the checkbox is focused.
62
+
63
+ ## Related components
64
+
65
+ * [Switch](?path=/docs/core-switch--design) — For immediate binary settings.
66
+ * [RadioGroup](?path=/docs/core-radiogroup--design) — For mutually exclusive selections.
@@ -0,0 +1,34 @@
1
+ # Core/Checkbox - Usage
2
+
3
+ Checkbox component for capturing boolean user input. Supports controlled and uncontrolled modes with proper accessibility.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `indeterminate` | `boolean` | No | `--` | Whether the checkbox is in an indeterminate state. |
8
+ | `checked` | `boolean` | No | `--` | Controlled checked state. Use with onChange for controlled component. |
9
+ | `defaultChecked` | `boolean` | No | `--` | Default checked state for uncontrolled component. |
10
+ | `children` | `string \| React.ReactNode` | No | `--` | The label for the checkbox. |
11
+ | `FORCE__className` | `string` | No | `--` | 🚨 This prop is meant to be an escape hatch. 🚨<br><br>If the desired style cannot be achieved using component props, use this as a last resort. The inner workings of Capra components are implementation details and this escape hatch gives one access to those implementation details. We cannot make any guarantees that styles will applied correctly across version updates. Please use it responsibly.<br><br>Add a CSS class to the component. |
12
+
13
+ ## Integration Notes
14
+
15
+ ### Ant Design Form Compatibility
16
+
17
+ When using Checkbox inside an Ant Design `<Form>` component, the focus ring may appear incorrectly due to Ant Design's global CSS:
18
+
19
+ ```css
20
+ .ant-form input[type='checkbox']:focus {
21
+ outline-offset: -2px;
22
+ }
23
+ ```
24
+
25
+ Capra's Checkbox includes `!important` on its focus styles to override this, but if you encounter issues, add a local override where you're using this component:
26
+
27
+ ```css
28
+ .checkbox {
29
+ input[type='checkbox']:focus,
30
+ input[type='checkbox']:focus-visible {
31
+ outline-offset: 2px !important;
32
+ }
33
+ }
34
+ ```