@capra/core 1.5.2 → 1.6.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 (102) hide show
  1. package/dist/index.cjs +27 -24
  2. package/dist/index.mjs +27 -24
  3. package/dist/style.css +62 -32
  4. package/docs/conventions--docs.md +186 -0
  5. package/docs/core-alert--design.md +110 -0
  6. package/docs/core-alert--usage.md +13 -0
  7. package/docs/core-anchor--design.md +39 -0
  8. package/docs/core-anchor--usage.md +39 -0
  9. package/docs/core-autocompletefield--design.md +91 -0
  10. package/docs/core-autocompletefield--usage.md +18 -0
  11. package/docs/core-badge--design.md +70 -0
  12. package/docs/core-badge--usage.md +13 -0
  13. package/docs/core-breadcrumbs--design.md +65 -0
  14. package/docs/core-breadcrumbs--usage.md +16 -0
  15. package/docs/core-button--design.md +97 -0
  16. package/docs/core-button--usage.md +17 -0
  17. package/docs/core-buttonlink--design.md +7 -0
  18. package/docs/core-buttonlink--usage.md +24 -0
  19. package/docs/core-card--design.md +100 -0
  20. package/docs/core-card--usage.md +5 -0
  21. package/docs/core-checkbox--design.md +66 -0
  22. package/docs/core-checkbox--usage.md +34 -0
  23. package/docs/core-collapse--design.md +28 -0
  24. package/docs/core-collapse--usage.md +20 -0
  25. package/docs/core-datepickerfield--design.md +71 -0
  26. package/docs/core-datepickerfield--usage.md +57 -0
  27. package/docs/core-daterangepickerfield--design.md +76 -0
  28. package/docs/core-daterangepickerfield--usage.md +62 -0
  29. package/docs/core-divider--design.md +35 -0
  30. package/docs/core-divider--usage.md +8 -0
  31. package/docs/core-drawer--design.md +87 -0
  32. package/docs/core-drawer--usage.md +9 -0
  33. package/docs/core-emptystate--design.md +45 -0
  34. package/docs/core-emptystate--usage.md +13 -0
  35. package/docs/core-helpertext--design.md +30 -0
  36. package/docs/core-helpertext--usage.md +11 -0
  37. package/docs/core-iconbutton--design.md +87 -0
  38. package/docs/core-iconbutton--usage.md +15 -0
  39. package/docs/core-inputrow--design.md +85 -0
  40. package/docs/core-inputrow--usage.md +6 -0
  41. package/docs/core-label--design.md +27 -0
  42. package/docs/core-label--usage.md +17 -0
  43. package/docs/core-link--design.md +58 -0
  44. package/docs/core-link--usage.md +16 -0
  45. package/docs/core-listitem--design.md +70 -0
  46. package/docs/core-listitem--usage.md +6 -0
  47. package/docs/core-menu--design.md +106 -0
  48. package/docs/core-menu--usage.md +16 -0
  49. package/docs/core-modal--design.md +39 -0
  50. package/docs/core-modal--usage.md +11 -0
  51. package/docs/core-numberfield--design.md +12 -0
  52. package/docs/core-numberfield--usage.md +14 -0
  53. package/docs/core-pagination--design.md +30 -0
  54. package/docs/core-pagination--usage.md +13 -0
  55. package/docs/core-passwordfield--design.md +7 -0
  56. package/docs/core-passwordfield--usage.md +3 -0
  57. package/docs/core-pill--design.md +94 -0
  58. package/docs/core-pill--usage.md +10 -0
  59. package/docs/core-popover--design.md +25 -0
  60. package/docs/core-popover--usage.md +8 -0
  61. package/docs/core-radio--design.md +39 -0
  62. package/docs/core-radio--usage.md +8 -0
  63. package/docs/core-radiogroup--design.md +5 -0
  64. package/docs/core-radiogroup--usage.md +12 -0
  65. package/docs/core-radiotile--design.md +5 -0
  66. package/docs/core-radiotile--usage.md +10 -0
  67. package/docs/core-ribbon--design.md +39 -0
  68. package/docs/core-ribbon--usage.md +12 -0
  69. package/docs/core-skeleton--design.md +88 -0
  70. package/docs/core-skeleton--usage.md +13 -0
  71. package/docs/core-skeletongroup--design.md +50 -0
  72. package/docs/core-skeletongroup--usage.md +10 -0
  73. package/docs/core-spinner--design.md +99 -0
  74. package/docs/core-spinner--usage.md +11 -0
  75. package/docs/core-switch--design.md +145 -0
  76. package/docs/core-switch--usage.md +8 -0
  77. package/docs/core-tabnav--design.md +77 -0
  78. package/docs/core-tabnav--usage.md +63 -0
  79. package/docs/core-tag--design.md +21 -0
  80. package/docs/core-tag--usage.md +11 -0
  81. package/docs/core-text--design.md +32 -0
  82. package/docs/core-text--usage.md +10 -0
  83. package/docs/core-textarea--design.md +74 -0
  84. package/docs/core-textarea--usage.md +18 -0
  85. package/docs/core-textfield--design.md +81 -0
  86. package/docs/core-textfield--usage.md +12 -0
  87. package/docs/core-textinput--design.md +72 -0
  88. package/docs/core-textinput--usage.md +19 -0
  89. package/docs/core-toast--design.md +100 -0
  90. package/docs/core-toast--usage.md +11 -0
  91. package/docs/core-tooltip--design.md +61 -0
  92. package/docs/core-tooltip--usage.md +48 -0
  93. package/docs/core-topnav--design.md +75 -0
  94. package/docs/core-topnav--usage.md +6 -0
  95. package/docs/core-verticalnavigation--design.md +31 -0
  96. package/docs/core-verticalnavigation--usage.md +17 -0
  97. package/docs/core-visuallyhidden--design.md +87 -0
  98. package/docs/core-visuallyhidden--usage.md +35 -0
  99. package/docs/history-changelogs-capra-core--docs.md +49 -0
  100. package/docs/index.md +110 -0
  101. package/docs/using-capra--docs.md +39 -0
  102. package/package.json +7 -6
@@ -0,0 +1,87 @@
1
+ # Core/Drawer - Design
2
+
3
+ ## Behavior
4
+
5
+ ### Modality
6
+
7
+ A contextual sheet can be **modal** or **non-modal**.
8
+
9
+ **Modal** sheets use a scrim to block interaction with the main page.
10
+
11
+ **Non-modal** sheets allow simultaneous interaction with the sheet and main page surfaces.
12
+ Non-modal sheets are best used for experiences that require a persistent but dismissible sheet that benefits from
13
+ interacting with the main page, like viewing location details on a map.
14
+
15
+ ### Navigation
16
+
17
+ Navigating within a context sheet should be avoided where possible. If navigating is necessary, keep it shallow –
18
+ no more than 1 level deep.
19
+
20
+ When presenting a secondary view in a context sheet, the primary view content is replaced. The secondary view is
21
+ dismissed by making a selection or pressing a backward navigation button.
22
+
23
+ ### Dismissing
24
+
25
+ Context sheets are dismissed by:
26
+
27
+ 1. Pressing the close button
28
+ 2. Confirming or cancelling the drawer
29
+ 3. Interacting with the scrim (when present)
30
+ 4. Pressing the escape key when the general sheet container is focused
31
+
32
+ In code, wire footer actions and other dismiss paths to `onClose`. A scrim is shown when the drawer
33
+ is **modal** (`modal`).
34
+
35
+ ## Screen size
36
+
37
+ ### Small screens
38
+
39
+ On small screens, the vertical height of a context sheet defaults up to 50% of the screen height. Scrolling the
40
+ sheet first slides it to full height before the content area scrolls.
41
+
42
+ ### Medium and large screens
43
+
44
+ On larger screens, drawers are fixed to the **trailing** edge of the screen. Content that extends beyond the
45
+ vertical bounds of the drawer scrolls. Do not scroll horizontally. The drawer header and footer are pinned above the
46
+ scrolled content. Drawers have a min-width of 400px and max-width of 80% of the parent viewport.
47
+
48
+ ## Best practices
49
+
50
+ ### Stacking
51
+
52
+ **Do**
53
+
54
+ Keep interactions within context sheets on the sheet surface. Use inline progressive disclosure to reveal
55
+ additional or optional content.
56
+
57
+ **Don't**
58
+
59
+ Launch other context sheets over a context sheet.
60
+
61
+ ### In-sheet navigation
62
+
63
+ **Do**
64
+
65
+ Keep navigation to a minimum within context sheets. Keep the navigation stack shallow when necessary, no more than
66
+ 1 level.
67
+
68
+ **Don't**
69
+
70
+ Add deep or multi-level navigation stacks inside a single context sheet; prefer replacing content or using shallow
71
+ steps instead.
72
+
73
+ ## Accessibility
74
+
75
+ ### Keyboard interaction
76
+
77
+ | Key | Function |
78
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
79
+ | `Tab` / `Shift+Tab` | In **modal** mode, focus stays within the drawer while open. In **non-modal** mode, focus can move freely between the sheet and the main page. |
80
+ | `Escape` | Closes the drawer whether focus is on the dialog surface or inside it (capture-phase listener). |
81
+
82
+ ### Roles and properties
83
+
84
+ * The panel uses `role="dialog"` with `aria-labelledby` (title) or `aria-label` as needed. While open, `aria-modal` is `true` for modal drawers and `false` for non-modal drawers.
85
+ * **Modal** mode: focus is trapped; `usePreventScroll` locks page scrolling. **Non-modal** mode: no focus containment or scroll lock on the document.
86
+ * The close control exposes an accessible name (“Close drawer”).
87
+ * When you add `Breadcrumbs` in the title, the trail is an ordered list with an `aria-label` of “Breadcrumb” by default; the last crumb should represent the current page (typically without an `href`).
@@ -0,0 +1,9 @@
1
+ # Core/Drawer - Usage
2
+
3
+ ### Implementation
4
+
5
+ The drawer UI is rendered in a **portal** (default `document.body`), with `position: fixed` and `top`/`bottom` anchoring so the sheet fills the **layout viewport** (the browser window on a real site; the Storybook **preview iframe** in docs/canvas). In the **Story** canvas, a decorator stretches the preview document so the iframe can grow with the panel; that shell is **skipped in Docs** so embedded previews are not forced to full-viewport height. The open drawer still fills the iframe, not the inline story box—resize the preview panel if you need a taller canvas.
6
+
7
+ ### Header
8
+
9
+ The header is the `title` slot: a string for a single heading, or a composition with `Drawer.Heading`, optional `Drawer.Description`, `Drawer.ExpandedTitleLayout`, and the shared `Breadcrumbs` components (matching the `Modal` pattern). The header stays pinned while the body scrolls.
@@ -0,0 +1,45 @@
1
+ # Core/EmptyState - Design
2
+
3
+ The EmptyState component is used to display a message when there is no data to display. Illustrations are lazy-loaded and support light/dark themes via the theme prop.
4
+
5
+ ## Properties
6
+
7
+ ### Title
8
+
9
+ All empty states have a title. Titles provide a brief summary of the reason an empty state is shown.
10
+
11
+ ### Description
12
+
13
+ All empty states have a description. Descriptions provide the details and instructions on next steps the user can take.
14
+
15
+ ### Action (optional)
16
+
17
+ A call to action can be used to provide quick access to relevant next steps. Full page empty states use a primary button. Smaller empty states use a secondary button.
18
+
19
+ ### Illustration
20
+
21
+ All empty states have an illustration. Pass an illustration slug (e.g. `EmptyFolder`, `PizzaBox`) via the `illustration` prop.
22
+
23
+ Use the `theme` prop (`light` or `dark`) to switch between light/dark variants when the illustration supports them. Illustrations are lazy-loaded for optimal bundle size.
24
+
25
+ ## Content
26
+
27
+ ### Title / explanation format
28
+
29
+ This format allows empty states to provide both a catchy main title and a more detailed explanation. The title should provide the broad action with the explanation providing additional detail.
30
+
31
+ Titles should be in sentence format with no ending punctuation. Descriptions should be in sentence format with ending punctuation.
32
+
33
+ ### Call to action
34
+
35
+ A call to action enables users to easily move forward from an empty state. It can take the form of a link embedded within the description to send the user to another page, or a button to perform an action.
36
+
37
+ Full page empty states (`size="lg"`) should use a primary button, as the action is the primary next step for the user. Smaller empty states should use a secondary button if the action is already present elsewhere on the page.
38
+
39
+ ### Description wrapping
40
+
41
+ Descriptions will wrap if the parent container is small enough, but strings should be kept short when possible.
42
+
43
+ ### Graphs
44
+
45
+ When using graph tiles, an empty state should be smaller to match the size of the graph tile.
@@ -0,0 +1,13 @@
1
+ # Core/EmptyState - Usage
2
+
3
+ The EmptyState component is used to display a message when there is no data to display. Illustrations are lazy-loaded and support light/dark themes via the theme prop.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `illustration` | `(typeof illustrationSlugs)[number]` | No | `--` | The illustration to display, identified by slug. Use theme to switch between light/dark variants when available. @default "EmptyFolder" |
8
+ | `theme` | `'light' \| 'dark'` | No | `--` | The theme for the illustration. Determines which variant to show when light/dark variants exist. @default "light" |
9
+ | `size` | `'md' \| 'lg'` | No | `--` | The size of the empty state. `lg` is for large components or the whole pages. @default "md" |
10
+ | `title` | `string` | Yes | `--` | The title to display in the empty state. |
11
+ | `description` | `string` | No | `--` | The description to display in the empty state. Please do not skip this property without a good reason. |
12
+ | `children` | `React.ReactNode` | No | `--` | Generic use for adding a button or other action elements below the description. |
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. |
@@ -0,0 +1,30 @@
1
+ # Core/HelperText - Design
2
+
3
+ Helper text for inputs.
4
+
5
+ :::warning
6
+
7
+ Prefer Capra field components—such as `TextField`, `NumberField`, `PasswordField`, `TextArea`, `DatePicker`, `DateRangePicker`, or `AutocompleteField`—which
8
+ include helper text in the standard field layout. Use standalone `HelperText` only when you are building a
9
+ custom field or a layout that those components do not cover.
10
+
11
+ :::
12
+
13
+ ## Accessibility
14
+
15
+ ### Error and warning content
16
+
17
+ For `appearance="danger"`, the helper region uses `role="alert"` so critical validation
18
+ messages are exposed promptly to assistive technologies. Warning and default appearances do not use `alert`;
19
+ ensure critical errors use `danger` when this behavior is desired.
20
+
21
+ ### Live regions
22
+
23
+ When `countText` is present, it is wrapped with `aria-live="polite"` so changes (for example
24
+ remaining characters) are announced without interrupting the user.
25
+
26
+ ### Relationship to the field
27
+
28
+ For custom compositions, associate helper copy with the control using `aria-describedby` on the input
29
+ pointing at an `id` on the helper element, or use patterns documented on the field component you wrap.
30
+ Capra built-in fields handle these relationships when you pass their `helperText` props.
@@ -0,0 +1,11 @@
1
+ # Core/HelperText - Usage
2
+
3
+ Helper text for inputs.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `appearance` | `(typeof appearances)[number]` | No | `--` | Appearance of the input.<br>@default 'default' |
8
+ | `children` | `string` | No | `--` | Main text. Use for hints, requirements, disclaimers, etc. |
9
+ | `countText` | `string` | No | `--` | Text to display on the right side of the helper text. Is marked as a live content area via `aria-live`. |
10
+ | `disabled` | `boolean` | No | `--` | Whether the input the helper text applies to is disabled. |
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. |
@@ -0,0 +1,87 @@
1
+ # Core/IconButton - Design
2
+
3
+ Interactive element displaying a single icon.
4
+
5
+ ## Properties
6
+
7
+ ### Icon
8
+
9
+ <p>
10
+ Icon buttons are used to quickly identify available actions.
11
+ </p>
12
+
13
+ <p>
14
+ Common actions, like save or search, can omit titles and use the icon alone. Avoid using an icon alone when the meaning is ambiguous, unclear, or unfamiliar.
15
+ </p>
16
+
17
+ <p>
18
+ View available icons in the Icon library.
19
+ </p>
20
+
21
+ ### Size
22
+
23
+ <p>
24
+ Buttons are available in small, medium, and large sizes. Medium is the default size and is preferred in most situations.
25
+ </p>
26
+
27
+ <p>
28
+ Small buttons are primarily used when buttons appear inline with over components, such as in a popover and to conserve space.
29
+ </p>
30
+
31
+ ### Loading
32
+
33
+ <p>
34
+ Buttons can show a loading state for actions that take longer to respond.
35
+ </p>
36
+
37
+ <p>
38
+ The loading spinner is shown in the leading icon slot, replacing an icon if present. Button text should be updated to indicate the action currently taking place. Further interaction is disabled until the action is complete.
39
+ </p>
40
+
41
+ ## Behavior
42
+
43
+ ### Tooltips
44
+
45
+ <p>
46
+ Icon buttons reveal the label in a tooltip on hover or long-press.
47
+ </p>
48
+
49
+ <img src="images/guidelines/iconbutton/behavior-tooltip.png" />
50
+
51
+ ### Loading delay
52
+
53
+ <p>
54
+ Buttons can show a loading state for actions that take longer to respond.
55
+ </p>
56
+
57
+ <p>
58
+ The loading spinner is shown in place of the icon. Further interaction is disabled until the action is complete.
59
+ </p>
60
+
61
+ ### State
62
+
63
+ <p>
64
+ Buttons use a color shift between palette indexes for interaction states. The available sates are enabled, hover, active, focused, disabled, and pending.
65
+ </p>
66
+
67
+ <img src="images/guidelines/iconbutton/behavior-state.png" />
68
+
69
+ ## Accessibility
70
+
71
+ ### Keyboard interaction
72
+
73
+ All buttons exist in the page’s natural tab sequence, reachable via TAB and SHIFT+TAB keys. Pressing SPACEBAR or ENTER activates the focused button.
74
+
75
+ ### Labeling
76
+
77
+ <p>
78
+ For buttons with an icon and text, if the icon reinforces the text, do not add any description of the icon as it would be redundant.
79
+ </p>
80
+
81
+ <p>
82
+ If the icon adds important information that is not explained in the text, then the label of the button must begin with the text with any extra information about the icon following the text. This order supports users who control their device with speech.
83
+ </p>
84
+
85
+ <p>
86
+ Icon buttons without text must have an easily identifiable (for speech users) accessible label, such as “Download.”
87
+ </p>
@@ -0,0 +1,15 @@
1
+ # Core/IconButton - Usage
2
+
3
+ Interactive element displaying a single icon.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `icon` | `SvgIcon` | Yes | `--` | Icon to display in the button. |
8
+ | `aria-label` | `string` | Yes | `--` | Accessibility label to apply to the button. |
9
+ | `variant` | `(typeof variants)[number]` | No | 'secondary' | Which button style to use. Defaults to `secondary`. |
10
+ | `appearance` | `(typeof appearances)[number]` | No | 'default' | Appearance to apply to the button. Defaults to `default`. |
11
+ | `size` | `(typeof sizes)[number]` | No | 'md' | Size of the button. Defaults to `md`. |
12
+ | `disabled` | `boolean` | No | false | Whether the button is disabled. |
13
+ | `pending` | `boolean` | No | false | Whether the button is in a pending state. |
14
+ | `onClick` | `React.ComponentProps<'button'>['onClick']` | No | `--` | Click handler for the button. |
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. |
@@ -0,0 +1,85 @@
1
+ # Core/InputRow - Design
2
+
3
+ ## Overview
4
+
5
+ `InputRow` is a horizontal container that visually merges one primary input with optional prefix and
6
+ suffix segments so the whole group reads as a single control. Use it for URLs, currency amounts, units, fixed
7
+ labels (for example `https://` or `.com`), and similar patterns where the value only makes
8
+ sense together with its neighbors.
9
+
10
+ ## `InputRow`
11
+
12
+ ### Role and labeling
13
+
14
+ The root is a `div` laid out as a flex row. When you pass `aria-label` or `aria-labelledby`, the row defaults to `role="group"` so assistive technologies can treat
15
+ the children as one related set. Give the row a short name that describes the combined value (for example
16
+ “Web address” or “Price”).
17
+
18
+ Order children left-to-right: leading segment, primary field, trailing segment. Capra field wrappers use `display: contents` when they are **direct** children of the row, so the inner input
19
+ participates in the flex layout and border-joining rules; keep fields and addons as immediate children of `InputRow`.
20
+
21
+ ### Visual treatment
22
+
23
+ Only the outer corners of the group use the standard field radius; shared edges between segments stay square
24
+ so borders overlap cleanly instead of doubling. Adjacent borders are collapsed with a small negative margin;
25
+ the segment that contains focus is raised in the stacking order so its focus ring stays visible.
26
+
27
+ ## `InputRow.Addon`
28
+
29
+ ### Static segments
30
+
31
+ `InputRow.Addon` is for **non-editable** content: fixed text, symbols, or decorative
32
+ icons. String children are rendered with the typography `Text` component; pass arbitrary nodes for
33
+ icons or richer content.
34
+
35
+ Addons are flex-shrink-safe strips with a muted surface and field-aligned borders so they match `TextInput` height and baseline. Place one or more addons before and/or after the field; the
36
+ primary input should remain the flexible segment in the middle when you have both sides.
37
+
38
+ ### Size
39
+
40
+ The `size` prop on `InputRow.Addon` (`md` by default, or `sm`)
41
+ controls minimum height and typography so the addon lines up with an adjacent `TextField` or `NumberField` using the same `size`.
42
+
43
+ ## Composing with Capra `*Field` components
44
+
45
+ ### Which fields to use
46
+
47
+ `TextField` and `NumberField` are the usual primary controls inside a row. Other Capra
48
+ field roots that expose `data-capra-field-root` (for example `AutocompleteField`, `DatePicker`, or `DateRangePicker`) use the same layout hook: the wrapper does not create
49
+ an extra flex box, so the inner control can share borders with addons like a plain `TextInput`.
50
+
51
+ Prefer one primary editable control per row. Pair it with `InputRow.Addon` for fixed text or icons,
52
+ or with another bordered control as a leading/trailing segment when the design calls for a separate control
53
+ (for example a unit or scheme picker), keeping that control a direct child so border overlap still applies.
54
+
55
+ ### Labels, helper text, and slots
56
+
57
+ Do not pass `label`, `helperText`, or `layout` props on Capra field wrappers
58
+ inside an `InputRow`. Those patterns reserve vertical space for label and helper rows and break the
59
+ single horizontal group.
60
+
61
+ Put the visible label (if any) *outside* the row—for example a standalone `Label` or
62
+ surrounding copy tied with `aria-labelledby` on `InputRow`. For validation or hints,
63
+ show helper text below the whole row, not on the nested field.
64
+
65
+ Avoid `leadingSlot` and `trailingSlot` on `TextField` when the same concern is
66
+ already expressed with `InputRow.Addon`; slots are meant for compact adornments on the input itself,
67
+ not for full row segments.
68
+
69
+ ### Accessible names
70
+
71
+ When `label` is omitted on nested fields, each focusable control still needs a name: use `aria-label` or `aria-labelledby` on `TextField`, `NumberField`, or
72
+ the inner input as documented for that component. The row-level `aria-label` names the group; each
73
+ control should have its own short name (“Domain”, “Amount”, “Unit”, and so on) where several tab stops exist.
74
+
75
+ ## Accessibility
76
+
77
+ ### Grouping
78
+
79
+ When the row combines multiple inputs or segments that share one label, put `aria-label` or `aria-labelledby` on `InputRow` and ensure each focusable control still has a distinct
80
+ accessible name where needed.
81
+
82
+ ### Addons
83
+
84
+ Treat `InputRow.Addon` as presentational unless the text is essential; decorative icons should use `aria-hidden`. If addon text conveys meaning not duplicated elsewhere, leave it in the accessibility
85
+ tree.
@@ -0,0 +1,6 @@
1
+ # Core/InputRow - Usage
2
+
3
+ | Prop | Type | Required | Default | Description |
4
+ | --- | --- | --- | --- | --- |
5
+ | `children` | `React.ReactNode` | No | `--` | `--` |
6
+ | `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,27 @@
1
+ # Core/Label - Design
2
+
3
+ Label text and optional required indicator for form fields, aligned with Capra field layouts.
4
+
5
+ :::warning
6
+
7
+ Prefer Capra field components—such as `TextField`, `NumberField`, `PasswordField`, `TextArea`, `DatePicker`, `DateRangePicker`, or `AutocompleteField`—which
8
+ wire labels, inputs, and helper text together with consistent layout and accessibility. Use standalone `Label` only when you are composing a custom field or integrating with primitives that do not ship a built-in label.
9
+
10
+ :::
11
+
12
+ ## Accessibility
13
+
14
+ ### Association
15
+
16
+ <p>
17
+ Pair `Label` with its control using `htmlFor` on the label and a matching `id` on
18
+ the input (or equivalent association pattern for custom widgets). Every form control should have an accessible name;
19
+ a visible `Label` is one straightforward way to provide it.
20
+ </p>
21
+
22
+ ### Required fields
23
+
24
+ <p>
25
+ The visual asterisk for <code>required</code> is marked <code>aria-hidden</code> so it is not double-announced; the
26
+ required state is also conveyed with visually hidden text for screen readers.
27
+ </p>
@@ -0,0 +1,17 @@
1
+ # Core/Label - Usage
2
+
3
+ Label text and optional required indicator for form fields, aligned with Capra field layouts.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `children` | `string` | No | `--` | Text to display in the label. |
8
+ | `required` | `boolean` | No | `--` | Whether the field the label is labeling is required (shows asterisk after label). |
9
+ | `trailingSlot` | `React.ReactNode` | No | `--` | Content after the label text. |
10
+ | `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. |
11
+
12
+ ## React Aria
13
+
14
+ <p>
15
+ The component uses <code>useContextProps</code> with React Aria’s <code>LabelContext</code>, so when it sits inside
16
+ compatible React Aria structures, label props can be supplied by context as well as passed directly.
17
+ </p>
@@ -0,0 +1,58 @@
1
+ # Core/Link - Design
2
+
3
+ Links are navigational elements that take users to a new page.
4
+
5
+ ## Properties
6
+
7
+ ### Text
8
+
9
+ The text representing the link should describe its destination.
10
+
11
+ ### isExternal
12
+
13
+ External links display an icon at the trailing end of the link. They navigate to a page outside the product and open
14
+ in a new tab.
15
+
16
+ ### Client-side Routing
17
+
18
+ Links support client-side routing out of the box when Capra's `RouterProvider` is used. See the
19
+ [Conventions](/docs/conventions--docs#client-side-routing) page for more details.
20
+
21
+ ## Best Practices
22
+
23
+ **Do**
24
+
25
+ <p>
26
+ Do clearly indicate the destination of a link through its text.
27
+ </p>
28
+
29
+ **Don't**
30
+
31
+ <p>
32
+ Don't use vague instructions, such as “click here”, for links.
33
+ </p>
34
+
35
+ ## Accessibility
36
+
37
+ ### Keyboard interaction
38
+
39
+ All links exist in the page's natural tab sequence, reachable via TAB and SHIFT+TAB keys. Pressing ENTER activates
40
+ the focused link.
41
+
42
+ ### External links
43
+
44
+ External links should announce themselves as opening in a new tab. For example: "Link text, opens in a new tab."
45
+
46
+ ### Keyboard focus indicator
47
+
48
+ Links inherit the standard focus indicator standard to all focusable elements.
49
+
50
+ ## Accessibility
51
+
52
+ * Meaningful link text: describe the destination, not "click here" or "read more".
53
+ * External links: announce the new-tab behavior in the link text or `aria-label` (e.g., "Opens in new tab").
54
+
55
+ ## Related components
56
+
57
+ * [Button](?path=/docs/core-button--design)
58
+ * [Anchor](?path=/docs/core-anchor--design)
@@ -0,0 +1,16 @@
1
+ # Core/Link - Usage
2
+
3
+ Links are navigational elements that take users to a new page.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `as` | `As` | No | `--` | The underlying element rendered by the component. Defaults to `a`. |
8
+ | `isExternal` | `boolean` | No | false | Whether the Link points to an external resource.<br><br>When `true` and `as="a"`, applies `target="_blank"` and `rel="noopener noreferrer"`.<br><br>Defaults to `false`. |
9
+ | `href` | `unknown` | No | `--` | A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). |
10
+ | `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). |
11
+ | `target` | `HTMLAttributeAnchorTarget` | No | `--` | The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). |
12
+ | `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). |
13
+ | `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). |
14
+ | `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). |
15
+ | `routerOptions` | `unknown` | No | `--` | Options for the configured client side router. |
16
+ | `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,70 @@
1
+ # Core/ListItem - Design
2
+
3
+ ## Properties
4
+
5
+ ### Leading
6
+
7
+ Leading slots are commonly used for icons, avatars, or checkboxes.
8
+
9
+ ### Label
10
+
11
+ A label is required for all list items. Their length may vary based on application but should always be succinct.
12
+
13
+ ### Description
14
+
15
+ The description slot is used to display the description of the list item.
16
+
17
+ ### Suffix
18
+
19
+ A suffix provides space for information such as item counts.
20
+
21
+ ### Trailing
22
+
23
+ Trailing slots are most often used for components providing supplementary information, such as Pills, or controls for menus.
24
+
25
+ ## Behavior
26
+
27
+ ### Spacing
28
+
29
+ ### Overflow
30
+
31
+ Labels will wrap if they are wider than the parent container. The list item remains aligned to the top of the text
32
+ box.
33
+
34
+ ## Best Practices
35
+
36
+ **Do**
37
+
38
+ <p>
39
+ Do maintain consistent with usage of leading and trailing slots.
40
+ </p>
41
+
42
+ **Don't**
43
+
44
+ <p>
45
+ Don't mix items with and without slots.
46
+ </p>
47
+
48
+ **Do**
49
+
50
+ <p>
51
+ Do keep interaction to single action per row.
52
+ </p>
53
+
54
+ **Don't**
55
+
56
+ <p>
57
+ Avoid having multiple interactive elements in a list row.
58
+ </p>
59
+
60
+ **Do**
61
+
62
+ <p>
63
+ Do omit unnecessary visual clutter, such as dividers.
64
+ </p>
65
+
66
+ **Don't**
67
+
68
+ <p>
69
+ Don't include dividers when using a list group.
70
+ </p>
@@ -0,0 +1,6 @@
1
+ # Core/ListItem - Usage
2
+
3
+ | Prop | Type | Required | Default | Description |
4
+ | --- | --- | --- | --- | --- |
5
+ | `as` | `As` | No | `--` | `--` |
6
+ | `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. |