@utilitywarehouse/hearth-react 0.28.7 → 0.29.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/README.md +34 -20
  2. package/SKILL.md +355 -0
  3. package/dist/{chunk-TLCA3FQZ.js → chunk-ABES5BZY.js} +2 -2
  4. package/dist/{chunk-OHPQ5IRM.cjs → chunk-Y2CHQFKQ.cjs} +2 -2
  5. package/dist/{chunk-OHPQ5IRM.cjs.map → chunk-Y2CHQFKQ.cjs.map} +1 -1
  6. package/dist/components/CardAccordion/CardAccordion.context.d.ts.map +1 -1
  7. package/dist/components/ExpandableCard/ExpandableCard.cjs +1 -1
  8. package/dist/components/ExpandableCard/ExpandableCard.js +1 -1
  9. package/dist/components/ProgressBar/ProgressBar.cjs +1 -1
  10. package/dist/components/ProgressBar/ProgressBar.js +1 -1
  11. package/dist/helpers/get-classname-styles.d.ts.map +1 -1
  12. package/dist/helpers/logger.d.ts.map +1 -1
  13. package/dist/helpers/merge-ids.d.ts.map +1 -1
  14. package/dist/hooks/use-ids.d.ts.map +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/package.json +14 -10
  19. package/public/llms/components/accordion.md +321 -0
  20. package/public/llms/components/alert.md +217 -0
  21. package/public/llms/components/avatar.md +112 -0
  22. package/public/llms/components/badge.md +158 -0
  23. package/public/llms/components/body-text.md +200 -0
  24. package/public/llms/components/box.md +148 -0
  25. package/public/llms/components/breadcrumbs.md +97 -0
  26. package/public/llms/components/button.md +595 -0
  27. package/public/llms/components/card-accordion.md +277 -0
  28. package/public/llms/components/card.md +985 -0
  29. package/public/llms/components/checkbox-group.md +193 -0
  30. package/public/llms/components/checkbox-tile.md +116 -0
  31. package/public/llms/components/checkbox.md +108 -0
  32. package/public/llms/components/combobox.md +360 -0
  33. package/public/llms/components/container.md +162 -0
  34. package/public/llms/components/currency-input.md +85 -0
  35. package/public/llms/components/date-input.md +90 -0
  36. package/public/llms/components/date-picker.md +159 -0
  37. package/public/llms/components/description-list.md +149 -0
  38. package/public/llms/components/detail-text.md +89 -0
  39. package/public/llms/components/divider.md +88 -0
  40. package/public/llms/components/em.md +43 -0
  41. package/public/llms/components/expandable-card.md +231 -0
  42. package/public/llms/components/flex.md +197 -0
  43. package/public/llms/components/grid.md +244 -0
  44. package/public/llms/components/heading.md +65 -0
  45. package/public/llms/components/helper-text.md +27 -0
  46. package/public/llms/components/highlight-banner.md +94 -0
  47. package/public/llms/components/icon-button.md +516 -0
  48. package/public/llms/components/icon-container.md +247 -0
  49. package/public/llms/components/inline-link.md +190 -0
  50. package/public/llms/components/label.md +28 -0
  51. package/public/llms/components/link.md +236 -0
  52. package/public/llms/components/list.md +715 -0
  53. package/public/llms/components/menu.md +270 -0
  54. package/public/llms/components/modal.md +328 -0
  55. package/public/llms/components/pagination.md +138 -0
  56. package/public/llms/components/password-input.md +93 -0
  57. package/public/llms/components/progress-bar.md +139 -0
  58. package/public/llms/components/progress-stepper.md +147 -0
  59. package/public/llms/components/radio-group.md +487 -0
  60. package/public/llms/components/search-input.md +132 -0
  61. package/public/llms/components/section-header.md +82 -0
  62. package/public/llms/components/select.md +148 -0
  63. package/public/llms/components/skeleton.md +282 -0
  64. package/public/llms/components/spinner.md +59 -0
  65. package/public/llms/components/strong.md +49 -0
  66. package/public/llms/components/switch.md +106 -0
  67. package/public/llms/components/table.md +230 -0
  68. package/public/llms/components/tabs.md +320 -0
  69. package/public/llms/components/text-area.md +141 -0
  70. package/public/llms/components/text-input.md +228 -0
  71. package/public/llms/components/toast.md +323 -0
  72. package/public/llms/components/toggle-button-card.md +513 -0
  73. package/public/llms/components/tooltip.md +188 -0
  74. package/public/llms/components/unstyled-icon-button.md +175 -0
  75. package/public/llms/components/validation-text.md +29 -0
  76. package/public/llms/components/verification-input.md +96 -0
  77. package/public/llms/docs/changelog.md +1430 -0
  78. package/public/llms/docs/common-props/align-self.md +90 -0
  79. package/public/llms/docs/common-props/border.md +308 -0
  80. package/public/llms/docs/common-props/colour.md +221 -0
  81. package/public/llms/docs/common-props/flex-items.md +91 -0
  82. package/public/llms/docs/common-props/gap.md +111 -0
  83. package/public/llms/docs/common-props/grid-items.md +96 -0
  84. package/public/llms/docs/common-props/margin.md +105 -0
  85. package/public/llms/docs/common-props/opacity.md +100 -0
  86. package/public/llms/docs/common-props/order.md +90 -0
  87. package/public/llms/docs/common-props/overflow.md +89 -0
  88. package/public/llms/docs/common-props/padding.md +102 -0
  89. package/public/llms/docs/common-props/position.md +92 -0
  90. package/public/llms/docs/common-props/size.md +93 -0
  91. package/public/llms/docs/common-props/spacing.md +97 -0
  92. package/public/llms/docs/common-props/text.md +35 -0
  93. package/public/llms/docs/common-props/z-index.md +88 -0
  94. package/public/llms/docs/design-tokens.md +72 -0
  95. package/public/llms/docs/getting-started.md +117 -0
  96. package/public/llms/docs/layout.md +135 -0
  97. package/public/llms/docs/migrating.md +302 -0
  98. package/public/llms/docs/responsive-design/breakpoints.md +119 -0
  99. package/public/llms/docs/responsive-design/media-queries.md +89 -0
  100. package/public/llms/docs/responsive-design/responsive-props.md +37 -0
  101. package/public/llms.txt +97 -0
  102. package/scripts/init-ai.js +142 -0
  103. package/styles.css +1 -1
  104. /package/dist/{chunk-TLCA3FQZ.js.map → chunk-ABES5BZY.js.map} +0 -0
@@ -0,0 +1,193 @@
1
+ # CheckboxGroup
2
+
3
+ `CheckboxGroup` provides a set of interactive buttons where multiple options can be selected at a time. The `CheckboxGroup` uses a fieldset to group related `Checkbox` controls. The `CheckboxGroup` is responsible for handling the value, label, helper text, validation, and disabled state, as well as determining the presentation and selection of the items in the list.
4
+
5
+ ```tsx
6
+ <Flex asChild>
7
+ <form>
8
+ <CheckboxGroup {...args} name="checkbox-story">
9
+ <CheckboxTile value="1" label="Energy" />
10
+ <CheckboxTile value="2" label="Broadband" />
11
+ <CheckboxTile value="3" label="Mobile" />
12
+ <CheckboxTile value="4" label="Insurance" />
13
+ </CheckboxGroup>
14
+ </form>
15
+ </Flex>
16
+ ```
17
+
18
+ ## Alternatives
19
+
20
+ - CheckboxGroupRoot: For presenting checkboxes, outside of a fieldset, without label, helper text, or error message.
21
+ - RadioGroup: For single-select
22
+
23
+ ## Accessibility
24
+
25
+ The necessary aria props, such as `aria-labelledby`, `aria-describedby` and
26
+ `aria-errormessage` are handled internally, however you can pass these and
27
+ other aria props, such as `aria-label`, to the `CheckboxGroup`, `Checkbox` &
28
+ `CheckboxTile` components yourself if you need to.
29
+
30
+ ### Keyboard interactions
31
+
32
+ <Flex direction="column" gap="200" className="sb-unstyled">
33
+ <Flex>
34
+ <Box width="300px">
35
+ <BodyText as="span" weight="bold">
36
+ Key
37
+ </BodyText>
38
+ </Box>
39
+ <BodyText as="span" weight="bold">
40
+ Description
41
+ </BodyText>
42
+ </Flex>
43
+ <Divider />
44
+ {[
45
+ { key: 'Tab', description: 'Moves keyboard focus to the checkbox.' },
46
+ { key: 'Space', description: 'Toggles checkbox between checked and unchecked states.' },
47
+ ].map((kbi, i) => (
48
+ <>
49
+ <Flex>
50
+ <Box width="300px">
51
+ <kbd>{kbi.key}</kbd>
52
+ </Box>
53
+ <BodyText as="span">{kbi.description}</BodyText>
54
+ </Flex>
55
+ {i < 4 ? <Divider /> : null}
56
+ </>
57
+ ))}
58
+ </Flex>
59
+
60
+ ## Helper text
61
+
62
+ The Checkbox group can display a secondary message as a helper text. While the
63
+ checkbox items can also display a helper text, these will not be displayed if
64
+ the checkbox group has a helper text.
65
+
66
+ ```tsx
67
+ <CheckboxGroup {...args}>
68
+ <CheckboxTile value="1" label="Rap" helperText="Including Grime" />
69
+ <CheckboxTile value="2" label="Rock" helperText="Including Heavy Metal" />
70
+ <CheckboxTile value="3" label="Folk" helperText="Including World music" />
71
+ <CheckboxTile value="4" label="Dance" helperText="Including House music" />
72
+ </CheckboxGroup>
73
+ ```
74
+
75
+ ## Validation
76
+
77
+ You can display validation status using the `validationStatus` & `validationText` props.
78
+ While the checkbox items can also display a validation text, these will not be
79
+ displayed if the checkbox group has a validation text.
80
+
81
+ ```tsx
82
+ <CheckboxGroup
83
+ {...args}
84
+ value={selected}
85
+ onValueChange={setSelected}
86
+ validationStatus={selected.length < 2 ? 'invalid' : undefined}
87
+ >
88
+ <CheckboxTile value="1" label="Bear" />
89
+ <CheckboxTile value="2" label="Koala" />
90
+ <CheckboxTile value="3" label="Wolf" />
91
+ <CheckboxTile value="4" label="Horse" />
92
+ <CheckboxTile value="5" label="Chicken" />
93
+ <CheckboxTile value="6" label="Peacock" />
94
+ </CheckboxGroup>
95
+ ```
96
+
97
+ By default, the validation text is placed above the checkbox items. Use `validationPlacement="bottom"` to display it below instead.
98
+
99
+ ```tsx
100
+ <Flex direction="column" gap="400">
101
+ <CheckboxGroup
102
+ label="Validation top (default)"
103
+ validationStatus="invalid"
104
+ validationText="Please select at least one option"
105
+ validationPlacement="top"
106
+ >
107
+ <CheckboxTile value="1" label="Bear" />
108
+ <CheckboxTile value="2" label="Koala" />
109
+ <CheckboxTile value="3" label="Wolf" />
110
+ </CheckboxGroup>
111
+ <CheckboxGroup
112
+ label="Validation bottom"
113
+ validationStatus="invalid"
114
+ validationText="Please select at least one option"
115
+ validationPlacement="bottom"
116
+ >
117
+ <CheckboxTile value="1" label="Bear" />
118
+ <CheckboxTile value="2" label="Koala" />
119
+ <CheckboxTile value="3" label="Wolf" />
120
+ </CheckboxGroup>
121
+ </Flex>
122
+ ```
123
+
124
+ ## Content width
125
+
126
+ The width of the `CheckboxGroup` should be set by the parent layout, however it is
127
+ possible to independently set the width of the children using `contentWidth`
128
+ prop.
129
+
130
+ By default it will set the width of the children to fit their content, however
131
+ you can set it to a specific width, or to `100%` to take up the full width of
132
+ the `CheckboxGroup`.
133
+
134
+ This is a responsive property, so you are able to set different widths for
135
+ different breakpoints.
136
+
137
+ ```tsx
138
+ <CheckboxGroup {...args} helperText="Setting the width of the children elements">
139
+ <CheckboxTile value="1" label="One" />
140
+ <CheckboxTile value="2" label="Two" />
141
+ <CheckboxTile value="3" label="Three" />
142
+ </CheckboxGroup>
143
+ ```
144
+
145
+ ## Controlled
146
+
147
+ A controlled value can be provided using the value prop, which accepts a string
148
+ array, corresponding to the value props of each child `Checkbox`. The
149
+ `onValueChange` event is fired when the user selects or deselects a `Checkbox`
150
+ child of the group.
151
+
152
+ ```tsx
153
+ <CheckboxGroup
154
+ label="Controlled"
155
+ helperText={`Checked: ${value.join(', ')}`}
156
+ defaultValue={value}
157
+ onValueChange={v => setValue(v)}
158
+ >
159
+ <CheckboxTile value="1" label="One" />
160
+ <CheckboxTile value="2" label="Two" />
161
+ <CheckboxTile value="3" label="Three" />
162
+ </CheckboxGroup>
163
+ ```
164
+
165
+ ## API
166
+
167
+ This component is based on the `fieldset` element and supports the following common props:
168
+
169
+ - Margin
170
+
171
+ | Prop | Type | Default | Description |
172
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
+ | `label` | `ReactNode` | — | The label for the formfield group. This should contain the question being answered by the formfield group. If you don't include a label you need to ensure you use the `aria-label` or `aria-labelledby` prop to properly associate a label with the formfield group. |
174
+ | `name` | `string` | — | |
175
+ | `required` | `boolean` | — | |
176
+ | `disabled` | `boolean` | — | |
177
+ | `defaultValue` | `string[]` | — | |
178
+ | `value` | `string[]` | — | |
179
+ | `onValueChange` | `((value: string[]) => void)` | — | |
180
+ | `direction` | `"column" \| "row"` | — | The direction of the checkboxes, will also set the aria-orientation value. |
181
+ | `contentWidth` | `Responsive<string>` | — | Set the container width of the CheckboxGroup children, independent to the width of the parent CheckboxGroup. |
182
+ | `labelVariant` | `"body" \| "heading"` | — | Set the label variant |
183
+ | `helperText` | `ReactNode` | — | Helper text for the formfield group. Provides a hint such as specific requirements for what to choose. When displayed, child components should not display their own `helperText`. |
184
+ | `validationText` | `ReactNode` | — | |
185
+ | `validationStatus` | `"valid" \| "invalid"` | — | |
186
+ | `validationPlacement` | `"top" \| "bottom"` | — | |
187
+ | `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
188
+ | `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
189
+ | `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
190
+ | `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
191
+ | `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
192
+ | `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
193
+ | `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
@@ -0,0 +1,116 @@
1
+ # CheckboxTile
2
+
3
+ The `CheckboxTile` component is a dual-state checkbox allowing users to toggle between checked and not checked. `CheckboxTile` can be used independently, however multiple checkboxes should be used within a `CheckboxGroup` to handle the state control and layout.
4
+
5
+ ```tsx
6
+ <CheckboxTile {...args} />
7
+ ```
8
+
9
+ ## Helper text
10
+
11
+ The `CheckboxTile` can display a secondary message as a helper text. This will not
12
+ show if the `CheckboxTile` is a child of a `CheckboxGroup` or `CheckboxGridGroup`
13
+ which also displays a helper text message.
14
+
15
+ ```tsx
16
+ <CheckboxTile value="1" label="One" helperText="The number one" />
17
+ ```
18
+
19
+ ## Validation text
20
+
21
+ The `CheckboxTile` can display a validation message when `validationStatus` is `invalid`. This will not
22
+ show if the `CheckboxTile` is a child of a `CheckboxGroup` which also displays a validation message.
23
+
24
+ ```tsx
25
+ <CheckboxTile value="1" label="One" validationText="That is invalid" validationStatus="invalid" />
26
+ ```
27
+
28
+ ## Image
29
+
30
+ The `CheckboxTile` can display an icon or image between the indicator and label.
31
+
32
+ ```tsx
33
+ <CheckboxTile
34
+ value="2"
35
+ label="Two"
36
+ helperText="The number two"
37
+ image={<CashbackCardMediumIcon />}
38
+ />
39
+ ```
40
+
41
+ ```tsx
42
+ <Flex width="fit-content" gap="200" direction="column">
43
+ <CheckboxTile
44
+ {...args}
45
+ label="Mastercard"
46
+ helperText=""
47
+ image={<img src={mastercard} width={40} height={24} alt="" />}
48
+ />
49
+ <CheckboxTile
50
+ {...args}
51
+ label="Visa"
52
+ helperText=""
53
+ image={<img src={visa} width={40} height={24} alt="" />}
54
+ />
55
+ <CheckboxTile label="Cash" image={<MoneyMediumIcon />} />
56
+ </Flex>
57
+ ```
58
+
59
+ **If you are using an `img` element, remember to include a null alt tag
60
+ (`alt=""` ) so the image is ignored by assistive technologies.**
61
+
62
+ ```tsx
63
+ <CheckboxTile
64
+ value="2"
65
+ label="Two"
66
+ helperText="The number two"
67
+ image={<img src="https://help.uw.co.uk/images/iPhone.svg" width={25} alt="" />}
68
+ />
69
+ ```
70
+
71
+ ## Controlled
72
+
73
+ The checked state can be controlled by using the `checked` and `onCheckedChange` props together.
74
+
75
+ ```tsx
76
+ [...]
77
+
78
+ const [checked, setChecked] = React.useState(false);
79
+
80
+ [...]
81
+
82
+ <CheckboxTile value="1" label="One" checked={checked} onCheckedChange={c => setChecked(c)} />
83
+ ```
84
+
85
+ ## Accessibility
86
+
87
+ `CheckboxTile` is, by default, appropriately labelled when using
88
+ the `label` prop, if you do not provide a label, you must specify an
89
+ `aria-label` or `aria-labelledby` for accessibility.
90
+
91
+ ## API
92
+
93
+ This component is based on the `button` element and supports the following common props:
94
+
95
+ - Margin
96
+
97
+ | Prop | Type | Default | Description |
98
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
99
+ | `label` | `ReactNode` | — | The label for the Checkbox. If not using please properly associate the checkbox with a label using the `aria-label` or `aria-labelledby` props. |
100
+ | `image` | `ReactNode` | — | Optional image to show between the check indicator and label. |
101
+ | `value` | `string` | — | The value given as data when submitted with a `name`. |
102
+ | `onCheckedChange` | `((checked: boolean) => void)` | — | Event handler called when the checked state of the checkbox changes. |
103
+ | `defaultChecked` | `boolean` | — | The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. |
104
+ | `defaultValue` | `string` | — | |
105
+ | `checked` | `boolean` | — | The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange. |
106
+ | `required` | `boolean` | — | |
107
+ | `helperText` | `ReactNode` | — | Helper text for the Checkbox. Will not display if the checkbox group has `helperText` set. |
108
+ | `validationStatus` | `"invalid"` | — | Indicates the validation state |
109
+ | `validationText` | `string` | — | Text to display when the `validationStatus` is set. |
110
+ | `margin` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
111
+ | `marginTop` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
112
+ | `marginRight` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
113
+ | `marginBottom` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
114
+ | `marginLeft` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
115
+ | `marginX` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
116
+ | `marginY` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
@@ -0,0 +1,108 @@
1
+ # Checkbox
2
+
3
+ The `Checkbox` component is a dual-state checkbox allowing users to toggle
4
+ between checked and not checked. `Checkbox` can be used independently, however
5
+ multiple checkboxes should be used within a `CheckboxGroup` to handle the state
6
+ control and layout.
7
+
8
+ ```tsx
9
+ <Checkbox {...args} />
10
+ ```
11
+
12
+ ## Helper text
13
+
14
+ The `Checkbox` can display a secondary message as a helper text. This will not
15
+ show if the `Checkbox` is a child of a `CheckboxGroup` which also displays a helper text message.
16
+
17
+ ```tsx
18
+ <Checkbox value="1" label="One" helperText="The number one" />
19
+ ```
20
+
21
+ ## Validation text
22
+
23
+ The `Checkbox` can display a validation message when `validationStatus` is `invalid`. This will not
24
+ show if the `Checkbox` is a child of a `CheckboxGroup` which also displays a validation message.
25
+
26
+ ```tsx
27
+ <Checkbox value="1" label="One" validationText="That is invalid" validationStatus="invalid" />
28
+ ```
29
+
30
+ ## Image
31
+
32
+ The `Checkbox` can display an icon or image between the indicator and label.
33
+
34
+ ```tsx
35
+ <Checkbox value="2" label="Two" helperText="The number two" image={<CashbackCardMediumIcon />} />
36
+ ```
37
+
38
+ ```tsx
39
+ <Flex width="fit-content" gap="200" direction="column">
40
+ <Checkbox
41
+ {...args}
42
+ label="Mastercard"
43
+ helperText=""
44
+ image={<img src={mastercard} width={40} alt="" />}
45
+ />
46
+ <Checkbox {...args} label="Visa" helperText="" image={<img src={visa} width={40} alt="" />} />
47
+ <Checkbox label="Cash" image={<MoneyMediumIcon />} />
48
+ </Flex>
49
+ ```
50
+
51
+ **If you are using an `img` element, remember to include a null alt tag
52
+ (`alt=""` ) so the image is ignored by assistive technologies.**
53
+
54
+ ```tsx
55
+ <Checkbox
56
+ value="2"
57
+ label="Two"
58
+ helperText="The number two"
59
+ image={<img src="https://help.uw.co.uk/images/iPhone.svg" width={25} alt="" />}
60
+ />
61
+ ```
62
+
63
+ ## Controlled
64
+
65
+ The checked state can be controlled by using the `checked` and `onCheckedChange` props together.
66
+
67
+ ```tsx
68
+ [...]
69
+
70
+ const [checked, setChecked] = React.useState(false);
71
+
72
+ [...]
73
+
74
+ <Checkbox value="1" label="One" checked={checked} onCheckedChange={c => setChecked(c)} />
75
+ ```
76
+
77
+ ## Accessibility
78
+
79
+ `Checkbox` is, by default, appropriately labelled when using the `label` prop,
80
+ if you do not provide a label, you must specify an `aria-label` or
81
+ `aria-labelledby` for accessibility.
82
+
83
+ ## API
84
+
85
+ This component is based on the `button` element and supports the following common props:
86
+
87
+ - Margin
88
+
89
+ | Prop | Type | Default | Description |
90
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
91
+ | `label` | `ReactNode` | — | The label for the Checkbox. If not using please properly associate the checkbox with a label using the `aria-label` or `aria-labelledby` props. |
92
+ | `image` | `ReactNode` | — | Optional image to show between the check indicator and label. |
93
+ | `value` | `string` | — | The value given as data when submitted with a `name`. |
94
+ | `onCheckedChange` | `((checked: boolean) => void)` | — | Event handler called when the checked state of the checkbox changes. |
95
+ | `defaultChecked` | `boolean` | — | The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. |
96
+ | `defaultValue` | `string` | — | |
97
+ | `checked` | `boolean` | — | The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange. |
98
+ | `required` | `boolean` | — | |
99
+ | `helperText` | `ReactNode` | — | Helper text for the Checkbox. Will not display if the checkbox group has `helperText` set. |
100
+ | `validationStatus` | `"invalid"` | — | Indicates the validation state |
101
+ | `validationText` | `string` | — | Text to display when the `validationStatus` is set. |
102
+ | `margin` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
103
+ | `marginTop` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
104
+ | `marginRight` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
105
+ | `marginBottom` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
106
+ | `marginLeft` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
107
+ | `marginX` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
108
+ | `marginY` | `Responsive<"0" \| "auto" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |