@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,145 @@
1
+ # Core/Switch - Design
2
+
3
+ ## Properties
4
+
5
+ ### Label
6
+
7
+ Switches must be paired with an accessible label, using text that clearly describes the action being performed in 1
8
+ to 3 words. The language of the label should be phrased in a way that a response of “on”/“off” or “yes”/”no” makes
9
+ sense to the user.
10
+
11
+ <img src="images/guidelines/switch/example-1.png" />
12
+
13
+ ### Size
14
+
15
+ Switches come in two different sizes. Medium is the default and preferred size for most situations. Small size is
16
+ used when a switch is inline with another element, such as a table or popover.
17
+
18
+ <img src="images/guidelines/switch/example-2.png" />
19
+
20
+ ### Selected
21
+
22
+ Switches appear as either selected (on) or unselected (off). Switches cannot be in an indefinite state.
23
+
24
+ <img src="images/guidelines/switch/example-3.png" />
25
+
26
+ ### Disabled
27
+
28
+ Switches can be disabled in either a selected or unselected state if there is a prerequisite to altering its state.
29
+
30
+ <img src="images/guidelines/switch/example-4.png" />
31
+
32
+ ## Behavior
33
+
34
+ ### Immediate
35
+
36
+ Switches immediately update the state of the application or UI when their state changes. If a delay is necessary, a
37
+ loading indicator should be used to inform the user that the process is taking longer.
38
+
39
+ <img src="images/guidelines/switch/example-5.png" />
40
+
41
+ ### Labels
42
+
43
+ Avoid using the words “on” or “off” within the label. Switches imply an on/off state so including it in the label is
44
+ redundant.
45
+
46
+ <img src="images/guidelines/switch/example-6.png" />
47
+
48
+ ## Best Practices
49
+
50
+ ### Labels
51
+
52
+ **Do**
53
+
54
+ <img src="images/guidelines/switch/example-7.png" />
55
+
56
+ Do use clear and concise labels.
57
+
58
+ **Don't**
59
+
60
+ <img src="images/guidelines/switch/example-8.png" />
61
+
62
+ Avoid using action-related verbs with “on” or “off” when adding labels to controls. Switches imply an on/off state
63
+ so including it in the label is redundant.
64
+
65
+ ### Placement
66
+
67
+ **Do**
68
+
69
+ <img src="images/guidelines/switch/example-9.png" />
70
+
71
+ Do use switches as trailing elements.
72
+
73
+ **Don't**
74
+
75
+ <img src="images/guidelines/switch/example-10.png" />
76
+
77
+ Don’t use switches as leading elements.
78
+
79
+ **Do**
80
+
81
+ <img src="images/guidelines/switch/example-11.png" />
82
+
83
+ Do ensure switches are either aligned with the grid or with each other when multiple switches are stacked.
84
+
85
+ **Don't**
86
+
87
+ <img src="images/guidelines/switch/example-12.png" />
88
+
89
+ Don't misalign switches by placing them immediately after labels when multiple switches are stacked, as this can
90
+ affect legibility.
91
+
92
+ ### Checkbox vs Switch
93
+
94
+ **Do**
95
+
96
+ <img src="images/guidelines/switch/example-13.png" />
97
+
98
+ If the action is part of a larger form, use a checkbox instead. The items will be submitted with the rest of the
99
+ form details.
100
+
101
+ **Don't**
102
+
103
+ <img src="images/guidelines/switch/example-14.png" />
104
+
105
+ Switches apply changes immediately and don't require the user to submit anything. If you need to include the data in
106
+ form content, use a checkbox set.
107
+
108
+ ### Radio vs Switch
109
+
110
+ **Do**
111
+
112
+ <img src="images/guidelines/switch/example-15.png" />
113
+
114
+ Switches are used for activation, not selection. If you are selecting between two available options, use a radio set
115
+ instead.
116
+
117
+ **Don't**
118
+
119
+ <img src="images/guidelines/switch/example-16.png" />
120
+
121
+ Switches should not be used to choose between opposing or discrete options. Instead, use switches for on/off
122
+ situations.
123
+
124
+ ## Accessibility
125
+
126
+ ### Keyboard interaction
127
+
128
+ | Key | Function |
129
+ | ---------------------- | ------------------------------------------------------------- |
130
+ | `Tab`<br />`Shift-Tab` | Moves focus into/out of the switch. |
131
+ | `Space` | When focus is on the switch, changes the state of the switch. |
132
+
133
+ ### WAI-ARIA Roles, States, and Properties
134
+
135
+ * The switch has `role=switch`.
136
+ * The switch has an accessible label provided by one of the following:
137
+ * Visible text content contained within the element with `role=switch`.
138
+ * A visible label referenced by the value of `aria-labelledby` set on the element with `role=switch`.
139
+ * `aria-label` set on the element with `role=switch`.
140
+ * When on, the switch element has state `aria-checked` set to true.
141
+ * When off, the switch element has state `aria-checked` set to false.
142
+ * If a set of switches is presented as a logical group with a visible label, either:
143
+ * The switches are included in an element with `role=group` that has the property `aria-labelledby` set to the ID of the element containing the group label.
144
+ * The set is contained in an HTML `<fieldset>` and the label for the set is contained in an HTML `<legend>` element.
145
+ * If the presentation includes additional descriptive static text relevant to a switch or switch group, the switch or switch group has the property `aria-describedby` set to the ID of the element containing the description.
@@ -0,0 +1,8 @@
1
+ # Core/Switch - Usage
2
+
3
+ ### Switch
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `size` | `'sm' \| 'md'` | No | `--` | `--` |
8
+ | `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,77 @@
1
+ # Core/TabNav - Design
2
+
3
+ TabNav provides a horizontal or vertical navigation styled as tabs. Tab items are links that redirect to URLs. With `subItems`, horizontal tabs open a dropdown menu; vertical tabs use an inline indented list (Tab Nav | Vertical in Figma).
4
+
5
+ Tabs and TabNav organize and manage content allowing users to navigate between different sections within the current context.
6
+
7
+ * **Tabs** organize content sections to be displayed at one time. They are displayed in Modals, Drawers, and other content panels.
8
+ * **TabNav** is a navigation menu with links, styled as tabs. They are used in Page Headers and other places where navigation is needed.
9
+
10
+ ## Properties
11
+
12
+ ### Label
13
+
14
+ Every tab must have a brief but descriptive label.
15
+
16
+ ### Variant
17
+
18
+ TabNav has two variants:
19
+
20
+ * **Default**: a single navigational link.
21
+ * **Dropdown**: a dropdown menu that displays a ListBox with additional navigational links.
22
+
23
+ ## Content
24
+
25
+ ### Labels
26
+
27
+ Tab labels should be one or two words, using title case (Tab Label). Labels should be less than 12 characters, with a maximum of 32 characters.
28
+
29
+ ## Best Practices
30
+
31
+ **Do**
32
+
33
+ <p>
34
+ Do follow the maximum character length of tab labels.
35
+ </p>
36
+
37
+ **Don't**
38
+
39
+ <p>
40
+ Don't exceed the 32 maximum character length.
41
+ </p>
42
+
43
+ **Do**
44
+
45
+ <p>
46
+ Do keep tab labels short and concise.
47
+ </p>
48
+
49
+ **Don't**
50
+
51
+ <p>
52
+ Don't wrap tab labels.
53
+ </p>
54
+
55
+ ## Accessibility
56
+
57
+ ### Keyboard interaction
58
+
59
+ | Key | Function |
60
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `Tab` / `Shift + Tab` | Moves focus into the tab list, putting focus onto the active tab. When the tab list has focus, moves focus to the next focusable element (generally within the tab panel). |
62
+ | `Left Arrow` / `Up Arrow` | Moves focus to, and activate, the previous tab. If focus is on the first tab, move focus to the last tab. Up performs the same action when `tabPlacement="vertical"`. |
63
+ | `Right Arrow` / `Down Arrow` | Moves focus to, and activate, the next tab. If focus is on the last tab, move focus to the first tab. Down performs the same action when `tabPlacement="vertical"`. |
64
+ | `Shift+F10` | Opens the menu for tabs with a dropdown. |
65
+
66
+ ### ARIA considerations
67
+
68
+ TabNav uses link-based navigation. The following apply:
69
+
70
+ * The container has `role="navigation"` with an `aria-label` for the navigation.
71
+ * Active nav links have `aria-current="page"` set.
72
+ * Tabs that contain a dropdown use a button with `aria-haspopup="menu"` and `aria-expanded` set.
73
+ * Dropdown menu items use the Menu component with appropriate roles.
74
+
75
+ ### Orientation
76
+
77
+ Use `tabPlacement="horizontal"` (default) for a horizontal tab bar at the bottom, or `tabPlacement="vertical"` for a vertical tab bar on the left.
@@ -0,0 +1,63 @@
1
+ # Core/TabNav - Usage
2
+
3
+ TabNav provides a horizontal or vertical navigation styled as tabs. Tab items are links that redirect to URLs. With `subItems`, horizontal tabs open a dropdown menu; vertical tabs use an inline indented list (Tab Nav | Vertical in Figma).
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `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. |
8
+ | `activeKey` | `string` | No | `--` | Key of the currently active tab (for visual styling). Typically derived from the current URL. |
9
+ | `onTabClick` | `(key: string, event: React.MouseEvent) => void` | No | `--` | Callback when a tab link is clicked (before navigation). |
10
+ | `items` | `TabNavItemType[]` | Yes | `--` | Tab items configuration. |
11
+ | `tabPlacement` | `(typeof tabNavPlacements)[number]` | No | 'horizontal' | Orientation of the tab bar: horizontal (bottom) or vertical (left).<br>@default 'horizontal' |
12
+ | `centered` | `boolean` | No | false | Whether to center the tabs.<br>@default false |
13
+ | `tabBarExtraSlot` | `React.ReactNode` | No | `--` | Slot for extra content in the tab bar (e.g. right side). |
14
+ | `wrap` | `boolean` | No | true | Whether tab items can wrap to multiple lines.<br>@default true |
15
+ | `aria-label` | `string` | No | 'Navigation' | `--` |
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { TabNav } from '@capra/core';
21
+
22
+ // Basic usage - tab items are links that redirect to URLs
23
+ <TabNav
24
+ activeKey={currentPath}
25
+ items={[
26
+ { key: '1', name: 'Tab 1', href: '/tab1' },
27
+ { key: '2', name: 'Tab 2', href: '/tab2' },
28
+ ]}
29
+ />
30
+
31
+ // Optional `name` (visible) + `aria-label` on the item when the accessible name differs
32
+ <TabNav
33
+ activeKey="overview"
34
+ items={[
35
+ { key: 'overview', name: 'Overview', 'aria-label': 'Tab 1, 1 of 3, selected', href: '/overview' },
36
+ ]}
37
+ />
38
+
39
+ // With icons and disabled tab
40
+ <TabNav
41
+ activeKey="1"
42
+ items={[
43
+ { key: '1', name: 'Search', icon: <SearchOutlined size="sm" />, href: '/search' },
44
+ { key: '2', name: 'Disabled', disabled: true, href: '/disabled' },
45
+ ]}
46
+ />
47
+
48
+ // With subnav dropdown (tabs with subItems show a chevron and open a menu on click)
49
+ <TabNav
50
+ activeKey="overview::summary"
51
+ items={[
52
+ {
53
+ key: 'overview',
54
+ name: 'Overview',
55
+ subItems: [
56
+ { key: 'summary', name: 'Summary', href: '/overview/summary' },
57
+ { key: 'details', name: 'Details', href: '/overview/details' },
58
+ ],
59
+ },
60
+ { key: 'settings', name: 'Settings', href: '/settings' },
61
+ ]}
62
+ />
63
+ ```
@@ -0,0 +1,21 @@
1
+ # Core/Tag - Design
2
+
3
+ A tag component for displaying a label and an optional icon.
4
+
5
+ ## Accessibility
6
+
7
+ ### Keyboard interaction
8
+
9
+ | Key | Function |
10
+ | ---------------------- | ----------------------------------------------------- |
11
+ | `Tab`<br />`Shift-Tab` | Moves focus to the next/previous interactive element. |
12
+ | `Space` | If the tag's remove icon has focus, remove the tag. |
13
+
14
+ 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.
15
+
16
+ ### Draggability
17
+
18
+ The tag can be made draggable by setting the `draggable` prop to `true`. When the tag is draggable, the user can drag the tag to a new position in the list.
19
+ The drag handle provides an onKeyDown handler that allows the user to drag the tag with the keyboard.
20
+
21
+ NOTE: The keyboard accessibility of the drag functionality is not defined, and is not part of this component.
@@ -0,0 +1,11 @@
1
+ # Core/Tag - Usage
2
+
3
+ A tag component for displaying a label and an optional icon.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `color` | `(typeof tagColors)[number]` | No | 'default' | The color of the tag. Defaults to `default`. |
8
+ | `icon` | `SvgIcon \| SvgLogo` | No | `--` | The icon or logo to display in the tag. |
9
+ | `children` | `string` | Yes | `--` | The label text to display in the tag. |
10
+ | `onDelete` | `() => void` | No | `--` | The callback function for when the user clicks the delete button. |
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,32 @@
1
+ # Core/Text - Design
2
+
3
+ Component for displaying text. The visual display can be controlled via `variant`. The underlying HTML element can be controlled via the `as` prop, which defaults to a `span` tag.
4
+
5
+ ## Properties
6
+
7
+ ### Text
8
+
9
+ A text component isn't very useful if you're not going to put some text in it.
10
+
11
+ ### Variant
12
+
13
+ Variant describe the contextual purpose of the text. Text may be: heading, to create logic sections within the UI
14
+ body, for regular text throughout the UI metric, to display in graphs and data visualizations code, to display
15
+ monospace code snippets
16
+
17
+ ### Color
18
+
19
+ Text inherits color from its container element. In some cases text color may be adjusted outside its container's intention.
20
+
21
+ ### As
22
+
23
+ Gives semantic meaning to the Text variant (style), setting the underlying element rendered by the component.
24
+
25
+ ## Accessibility
26
+
27
+ ### Guidelines
28
+
29
+ Key factors to follow for an accessible typography:
30
+
31
+ * Color. Provide enough contrast between text and its background, check out the minimum recommended [WCAG 2.2 color contrast ratio](https://www.w3.org/TR/WCAG22/#contrast-minimum) (4.5:1).
32
+ * Heading hierarchy. Based on the [W3 guidelines](https://www.w3.org/WAI/tutorials/page-structure/headings/), don't skip heading levels. Make sure to separate the semantics from the style.
@@ -0,0 +1,10 @@
1
+ # Core/Text - Usage
2
+
3
+ Component for displaying text. The visual display can be controlled via `variant`. The underlying HTML element can be controlled via the `as` prop, which defaults to a `span` tag.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `variant` | `(typeof variants)[number]` | No | `--` | The text style variant. Defaults to `body`. |
8
+ | `color` | `Color \| 'inherit'` | No | `--` | The text foreground color. Can be a theme color or inherited from the environment. Defaults to `inherit`.<br>@default inherit |
9
+ | `as` | `As` | No | `--` | The underlying element rendered by the component. Defaults to `span`. |
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. |
@@ -0,0 +1,74 @@
1
+ # Core/TextArea - Design
2
+
3
+ TextArea component for multi-line text entry.
4
+
5
+ ### Anatomy
6
+
7
+ The text area is a multi-line field. When `resizable` is true, a resize handle allows vertical resizing. Use with
8
+ `InputField` for labels, helper text, and validation messaging.
9
+
10
+ ## Properties
11
+
12
+ ### Value
13
+
14
+ The value is submitted with the form. The value replaces any placeholder text in the field after the first character
15
+ is entered.
16
+
17
+ ### Placeholder text
18
+
19
+ Placeholder text is visible until a character is entered. Because the placeholder text disappears, putting
20
+ instructions or requirements as placeholder text is not accessible. Helper text is the preferred method to convey
21
+ this information.
22
+
23
+ ### Resizable
24
+
25
+ When `resizable` is `true` (default) and `autoSize` is off, a resize handle is shown and the user can drag to change
26
+ height vertically. When `autoSize` is on, manual resizing is disabled. When `resizable` is `false`, the height is
27
+ fixed.
28
+
29
+ ### Auto size
30
+
31
+ `autoSize` grows the height with content (Ant Design–style API). Pass `true` or `{ minRows?, maxRows? }`. When auto
32
+ size is on, manual resize is disabled. Height follows content; optional `maxRows` caps growth and enables vertical
33
+ scrolling for overflow.
34
+
35
+ ### Status
36
+
37
+ `danger`: Used to indicate an error or invalid state.
38
+
39
+ `warning`: Used to indicate a warning.
40
+
41
+ Styling matches TextInput for consistent forms.
42
+
43
+ ## Behavior
44
+
45
+ ### Error messages
46
+
47
+ When validation fails, the field border uses the attention styling and helper text shows an error message. Error
48
+ messages should be concise and replace any previously visible helper text where appropriate.
49
+
50
+ ### Disabled
51
+
52
+ Disabled fields cannot be modified and cannot receive focus. Values in a disabled field are not submitted as part of
53
+ the form.
54
+
55
+ ### Read-only
56
+
57
+ Read-only fields cannot be modified. The value of a read-only field is submitted as part of the form.
58
+
59
+ ## Accessibility
60
+
61
+ ### Keyboard interaction
62
+
63
+ | Key | Function |
64
+ | ------------------- | -------------------------------------- |
65
+ | `Tab` / `Shift+Tab` | Moves focus into/out of the text area. |
66
+ | `Arrow keys` | Move the caret within the text. |
67
+ | `Enter` | Inserts a new line. |
68
+
69
+ ### Labeling and validation
70
+
71
+ The component renders a semantic `textarea` element. Provide an accessible name with `aria-label` or
72
+ `aria-labelledby`, and associate helper or error text with `aria-describedby` when used inside `InputField` or your own
73
+ layout. The component sets `aria-invalid` when `appearance` is `danger`. Ensure focus indicators are visible (at least
74
+ 2px, 3:1 contrast) and interactive targets meet at least 24×24 CSS pixels where applicable.
@@ -0,0 +1,18 @@
1
+ # Core/TextArea - Usage
2
+
3
+ TextArea component for multi-line text entry.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `appearance` | `(typeof appearances)[number]` | No | `--` | Appearance of the text area.<br>@default 'default' |
8
+ | `resizable` | `boolean` | No | `--` | Whether the text area can be vertically resized by the user.<br>@default true |
9
+ | `autoSize` | `boolean \| { minRows?: number; maxRows?: number }` | No | `--` | Auto-growing height (Ant Design `Input.TextArea`–style).<br>`true` grows with content; use `{ minRows, maxRows }` to clamp height.<br>When enabled, manual vertical resize is disabled (`resize: none`). |
10
+ | `showCount` | `boolean` | No | `--` | When true, shows a character count. |
11
+ | `onChange` | `(value: string) => void` | No | `--` | Called with the new string value when the input changes. |
12
+ | `helperText` | `string` | No | `--` | Helper text below the field. Replaced by error message when status is error. Use for requirements, disclaimers. |
13
+ | `label` | `string` | No | `--` | Label for the field. Required for accessibility; use aria-label if another element acts as label. |
14
+ | `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. |
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
+
17
+ Use `InputField` with `input={TextArea}` for label above the field, helper text, character count, and validation
18
+ appearance. Use `layout="vertical"` (default) or `layout="horizontal"` on `InputField` to match TextInput layouts.
@@ -0,0 +1,81 @@
1
+ # Core/TextField - Design
2
+
3
+ Single-line text field with optional label and helper text.
4
+
5
+ The following guidelines are common across text-based inputs ([Core Components — Inputs](https://www.figma.com/design/ejoPUMrdRDAlyc2vyDIWWe/Core-Components?node-id=21133-20423) in Figma).
6
+
7
+ ## Properties
8
+
9
+ ### Label
10
+
11
+ A label is required for input fields and succinctly describes the field’s purpose. If another text element is acting
12
+ as the label—like a section title—ensure the proper ARIA relationships are linked.
13
+
14
+ ### Value
15
+
16
+ The value is submitted with the form. The value replaces any placeholder text in the field after the first character
17
+ is entered.
18
+
19
+ ### Placeholder text
20
+
21
+ Placeholder text is visible until a character is entered. Because the placeholder text disappears, putting
22
+ instructions or requirements as placeholder text is not accessible. Helper text is the preferred method to convey
23
+ this information.
24
+
25
+ ### Helper text
26
+
27
+ Helper text is placed below the field and informs the user of any requirements, disclaimers, and errors. Helper text
28
+ is shown persistently but is replaced by error text when an error occurs.
29
+
30
+ ### Layout
31
+
32
+ There are two layouts available for text fields: **vertical** and **horizontal**. With vertical labels, the content
33
+ will shift to keep the cursor in view as the user enters characters. When the field loses focus, the content will
34
+ scroll to the beginning. Focusing on the field again returns the user to the end of the content. Horizontal labels
35
+ appear on the leading side of the field, and should only be used when space is limited.
36
+
37
+ ## Behavior
38
+
39
+ ### Overflow
40
+
41
+ Values overflow past the trailing edge of the field. While focused, the content will shift to keep the cursor in
42
+ view as the user enters characters. When the field loses focus, the content will scroll to the beginning. Focusing
43
+ on the field again returns the user to the end of the content. Generally, text fields should avoid overflow. Use a
44
+ text area field for longer entries.
45
+
46
+ ## Content
47
+
48
+ ### Search and filter fields
49
+
50
+ Search and Filter fields allow a user to enter and clear query strings.
51
+
52
+ **Clear button:** The clear icon appears when a value is present in the text field. When cleared the icon disappears and
53
+ the text input keeps focus.
54
+
55
+ ## Feedback
56
+
57
+ ### Error messages
58
+
59
+ When a field fails validation, the field’s border displays the attention color. The helper text also displays an
60
+ error message to help the user successfully fulfill the field requirements. Error messages are concise and direct,
61
+ and replace any previously visible helper text. An error icon is prepended to the helper text to enhance
62
+ discoverability.
63
+
64
+ ### Disabled
65
+
66
+ Disabled fields cannot be modified and cannot gain focus. Values in a disabled field are not submitted as part of
67
+ the form.
68
+
69
+ ### Read-only
70
+
71
+ Read-only fields cannot be modified and cannot gain focus. The value of a read-only field is submitted as part of
72
+ the form.
73
+
74
+ ## Accessibility
75
+
76
+ * **Label:** Provide a visible `label` or associate another element via `aria-labelledby` / `aria-label` so the control has an accessible name. Do not rely on placeholder alone for the name.
77
+ * **Instructions and requirements:** Prefer persistent `helperText` (or other visible, associated text) over placeholder for instructions; placeholder disappears and is easy to miss.
78
+ * **Errors:** Use `appearance="danger"` with error content in `helperText` so validation state is exposed (`aria-invalid`) and messaging replaces prior helper text.
79
+ * **Required:** Set `required` when the field is mandatory so required state is available to assistive technologies.
80
+ * **Disabled:** Disabled fields are not interactive; their values are not submitted with native form submission.
81
+ * **Read-only:** Read-only values are still submitted; the field is not editable. Native read-only inputs may remain focusable for selection and screen readers—align with your product pattern if focus should be limited.
@@ -0,0 +1,12 @@
1
+ # Core/TextField - Usage
2
+
3
+ Single-line text field with optional label and helper text.
4
+
5
+ | Prop | Type | Required | Default | Description |
6
+ | --- | --- | --- | --- | --- |
7
+ | `onChange` | `(value: string) => void` | No | `--` | Called with the new string value when the input changes. |
8
+ | `showCount` | `boolean` | No | `--` | When true, shows a character count. |
9
+ | `value` | `string \| number \| undefined` | No | `--` | `--` |
10
+ | `helperText` | `string` | No | `--` | Helper text below the field. Replaced by error message when status is error. Use for requirements, disclaimers. |
11
+ | `label` | `string` | No | `--` | Label for the field. Required for accessibility; use aria-label if another element acts as label. |
12
+ | `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,72 @@
1
+ # Core/TextInput - Design
2
+
3
+ TextInput component for single-line text entry. Backwards compatible with Ant Design v5 Input.
4
+
5
+ ## Anatomy
6
+
7
+ ## Properties
8
+
9
+ ### Value
10
+
11
+ The value is submitted with the form. The value replaces any placeholder text in the field after the first character
12
+ is entered.
13
+
14
+ ### Placeholder text
15
+
16
+ Placeholder text is visible until a character is entered. Because the placeholder text disappears, putting
17
+ instructions or requirements as placeholder text is not accessible. Helper text is the preferred method to convey
18
+ this information.
19
+
20
+ ### Size
21
+
22
+ <p>
23
+ `md`
24
+
25
+ : Standard size used across the majority of the UI.
26
+ </p>
27
+
28
+ <p>
29
+ `sm`
30
+
31
+ : Used when an input is in a supporting position, such as directly above a table for filtering.
32
+ </p>
33
+
34
+ ### Status
35
+
36
+ `error`: Used to indicate that the input has an error.
37
+
38
+ `warning`: Used to indicate that the input has a warning.
39
+
40
+ ## Behavior
41
+
42
+ ### Overflow
43
+
44
+ Input values overflow past the trailing edge of the input container. While focused, the content will shift to keep
45
+ the cursor in view as the user enters characters. When the field loses focus, the content will scroll to the
46
+ beginning. Focusing on the field again returns the user to the end of the content. Generally, text fields should
47
+ avoid overflow. Use a Text area field for longer entries.
48
+
49
+ ### Error messages
50
+
51
+ When a field fails validation, the input's border displays the attention color. The helper text also displays
52
+ an error message to help the user successfully fulfill the input requirements. Error messages are concise and
53
+ direct, and replace any previously visible helper text. An error icon is prepended to the helper text to enhance
54
+ discoverability.
55
+
56
+ ### Disabled
57
+
58
+ Disabled fields can not be modified and can not gain focus. Values in a disabled field are not submitted as part of
59
+ the form.
60
+
61
+ ### Read-only
62
+
63
+ Read-only fields can not be modified. The value of a read-only field is submitted as part of the form.
64
+
65
+ ## Accessibility
66
+
67
+ ### Keyboard interaction
68
+
69
+ | Key | Function |
70
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------- |
71
+ | `Tab` / `Shift+Tab` | Moves focus into/out of the input field.<br />For inputs with embedded actions, move to the next/previous action |
72
+ | `Enter` / `Space` | For inputs with embedded actions, activates the currently focused action. |
@@ -0,0 +1,19 @@
1
+ # Core/TextInput - Usage
2
+
3
+ TextInput component for single-line text entry. Backwards compatible with Ant Design v5 Input.
4
+
5
+ :::warning[Internal only]
6
+
7
+ `TextInput` is not exported from the public `@capra/core` API. For single-line text entry in product code, use [`TextField`](?path=/docs/core-textfield--design).
8
+
9
+ :::
10
+
11
+ | Prop | Type | Required | Default | Description |
12
+ | --- | --- | --- | --- | --- |
13
+ | `appearance` | `(typeof appearances)[number]` | No | `--` | Appearance of the input.<br>@default 'default' |
14
+ | `leadingSlot` | `React.ReactNode` | No | `--` | Content before the input (e.g. icon). |
15
+ | `size` | `(typeof sizes)[number]` | No | `--` | Size of the input.<br>@default 'md' |
16
+ | `trailingSlot` | `React.ReactNode` | No | `--` | Content after the input (e.g. icon or clear 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. |
18
+
19
+ Use `layout="vertical"` (default) for label above the field; use `layout="horizontal"` for label on the leading side when space is limited.