@aleph-alpha/ui-library 7.0.0 → 7.0.2

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 (118) hide show
  1. package/dist/system/components/UiDropdownMenu/useMobileSubmenuPlacement.d.ts +1 -1
  2. package/dist/system/icons/story-sidebar-icons.json +74 -17
  3. package/dist/system/lib.js +1167 -1162
  4. package/dist/system/patterns/UiPlaceholder/types.d.ts +1 -0
  5. package/dist/system/story-sidebar-icons.json +74 -17
  6. package/package.json +8 -3
  7. package/src/components/UiAccordion/UiAccordion.guidance.md +66 -0
  8. package/src/components/UiAccordion/UiAccordion.stories.ts +131 -139
  9. package/src/components/UiAlert/UiAlert.guidance.md +66 -0
  10. package/src/components/UiAlert/UiAlert.stories.ts +167 -143
  11. package/src/components/UiAlertDialog/UiAlertDialog.guidance.md +66 -0
  12. package/src/components/UiAlertDialog/UiAlertDialog.stories.ts +136 -112
  13. package/src/components/UiAutocomplete/UiAutocomplete.guidance.md +66 -0
  14. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +123 -99
  15. package/src/components/UiAvatar/UiAvatar.guidance.md +63 -0
  16. package/src/components/UiAvatar/UiAvatar.stories.ts +340 -0
  17. package/src/components/UiAvatar/UiAvatarImage.vue +5 -1
  18. package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +14 -0
  19. package/src/components/UiBadge/UiBadge.guidance.md +65 -0
  20. package/src/components/UiBadge/UiBadge.stories.ts +325 -0
  21. package/src/components/UiBreadcrumb/UiBreadcrumb.guidance.md +67 -0
  22. package/src/components/UiBreadcrumb/UiBreadcrumb.stories.ts +165 -141
  23. package/src/components/UiButton/UiButton.stories.ts +5 -2
  24. package/src/components/UiButtonGroup/UiButtonGroup.guidance.md +63 -0
  25. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +91 -67
  26. package/src/components/UiCalendar/UiCalendar.guidance.md +65 -0
  27. package/src/components/UiCalendar/UiCalendar.stories.ts +103 -110
  28. package/src/components/UiCard/UiCard.guidance.md +65 -0
  29. package/src/components/UiCard/UiCard.stories.ts +393 -0
  30. package/src/components/UiCheckbox/UiCheckbox.guidance.md +62 -0
  31. package/src/components/UiCheckbox/UiCheckbox.stories.ts +18 -56
  32. package/src/components/UiChip/UiChip.guidance.md +64 -0
  33. package/src/components/UiChip/UiChip.stories.ts +162 -138
  34. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +291 -0
  35. package/src/components/UiCodeBlock/UiCodeBlock.vue +2 -1
  36. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +18 -0
  37. package/src/components/UiDialog/UiDialog.guidance.md +66 -0
  38. package/src/components/UiDialog/UiDialog.stories.ts +90 -66
  39. package/src/components/UiDrawer/UiDrawer.guidance.md +66 -0
  40. package/src/components/UiDrawer/UiDrawer.stories.ts +186 -162
  41. package/src/components/UiDropdownMenu/UiDropdownMenu.guidance.md +68 -0
  42. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +332 -85
  43. package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +134 -0
  44. package/src/components/UiDropdownMenu/useMobileSubmenuPlacement.ts +23 -2
  45. package/src/components/UiEmpty/UiEmpty.guidance.md +66 -0
  46. package/src/components/UiEmpty/UiEmpty.stories.ts +370 -15
  47. package/src/components/UiFadeMask/UiFadeMask.stories.ts +66 -0
  48. package/src/components/UiField/UiField.guidance.md +63 -0
  49. package/src/components/UiField/UiField.stories.ts +90 -113
  50. package/src/components/UiFileType/UiFileType.stories.ts +254 -0
  51. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +74 -72
  52. package/src/components/UiIcon/UiIcon.stories.ts +256 -1
  53. package/src/components/UiInput/UiInput.guidance.md +64 -0
  54. package/src/components/UiInput/UiInput.stories.ts +132 -80
  55. package/src/components/UiInputGroup/UiInputGroup.guidance.md +66 -0
  56. package/src/components/UiInputGroup/UiInputGroup.stories.ts +127 -103
  57. package/src/components/UiItem/UiItem.guidance.md +66 -0
  58. package/src/components/UiItem/UiItem.stories.ts +81 -28
  59. package/src/components/UiKbd/UiKbd.guidance.md +65 -0
  60. package/src/components/UiKbd/UiKbd.stories.ts +373 -3
  61. package/src/components/UiLabel/UiLabel.guidance.md +65 -0
  62. package/src/components/UiLabel/UiLabel.stories.ts +163 -139
  63. package/src/components/UiListbox/UiListbox.stories.ts +197 -195
  64. package/src/components/UiNavigationMenu/UiNavigationMenu.guidance.md +66 -0
  65. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +169 -169
  66. package/src/components/UiPopover/UiPopover.guidance.md +65 -0
  67. package/src/components/UiPopover/UiPopover.stories.ts +115 -91
  68. package/src/components/UiProgress/UiProgress.guidance.md +65 -0
  69. package/src/components/UiProgress/UiProgress.stories.ts +300 -0
  70. package/src/components/UiRadioGroup/UiRadioGroup.guidance.md +66 -0
  71. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +163 -139
  72. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +128 -127
  73. package/src/components/UiResizable/UiResizable.guidance.md +65 -0
  74. package/src/components/UiResizable/UiResizable.stories.ts +176 -152
  75. package/src/components/UiSelect/UiSelect.guidance.md +66 -0
  76. package/src/components/UiSelect/UiSelect.stories.ts +150 -126
  77. package/src/components/UiSeparator/UiSeparator.guidance.md +64 -0
  78. package/src/components/UiSeparator/UiSeparator.stories.ts +350 -0
  79. package/src/components/UiSheet/UiSheet.guidance.md +66 -0
  80. package/src/components/UiSheet/UiSheet.stories.ts +194 -170
  81. package/src/components/UiSkeleton/UiSkeleton.guidance.md +65 -0
  82. package/src/components/UiSkeleton/UiSkeleton.stories.ts +253 -0
  83. package/src/components/UiSlider/UiSlider.guidance.md +66 -0
  84. package/src/components/UiSlider/UiSlider.stories.ts +150 -126
  85. package/src/components/UiSnackbar/UiSnackbar.guidance.md +66 -0
  86. package/src/components/UiSnackbar/UiSnackbar.stories.ts +106 -96
  87. package/src/components/UiSpinner/UiSpinner.guidance.md +65 -0
  88. package/src/components/UiSpinner/UiSpinner.stories.ts +249 -0
  89. package/src/components/UiStepper/UiStepper.guidance.md +66 -0
  90. package/src/components/UiStepper/UiStepper.stories.ts +142 -124
  91. package/src/components/UiSwitch/UiSwitch.guidance.md +66 -0
  92. package/src/components/UiSwitch/UiSwitch.stories.ts +170 -146
  93. package/src/components/UiTable/UiTable.guidance.md +66 -0
  94. package/src/components/UiTable/UiTable.stories.ts +530 -12
  95. package/src/components/UiTabs/UiTabs.guidance.md +66 -0
  96. package/src/components/UiTabs/UiTabs.stories.ts +174 -150
  97. package/src/components/UiTagsInput/UiTagsInput.stories.ts +154 -152
  98. package/src/components/UiTextarea/UiTextarea.guidance.md +66 -0
  99. package/src/components/UiTextarea/UiTextarea.stories.ts +86 -62
  100. package/src/components/UiToggle/UiToggle.guidance.md +66 -0
  101. package/src/components/UiToggle/UiToggle.stories.ts +183 -159
  102. package/src/components/UiToggleGroup/UiToggleGroup.guidance.md +64 -0
  103. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +222 -200
  104. package/src/components/UiTooltip/UiTooltip.guidance.md +66 -0
  105. package/src/components/UiTooltip/UiTooltip.stories.ts +90 -66
  106. package/src/patterns/UiDataTable/UiDataTable.guidance.md +66 -0
  107. package/src/patterns/UiDataTable/UiDataTable.stories.ts +177 -155
  108. package/src/patterns/UiDatePicker/UiDatePicker.guidance.md +66 -0
  109. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +136 -112
  110. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +77 -75
  111. package/src/patterns/UiFileUpload/UiFileUpload.guidance.md +68 -0
  112. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +169 -145
  113. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +103 -101
  114. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +14 -13
  115. package/src/patterns/UiLayout/UiLayoutMobile.stories.ts +65 -65
  116. package/src/patterns/UiPlaceholder/types.ts +1 -0
  117. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +74 -72
  118. package/src/patterns/UiTopBar/UiTopBar.stories.ts +84 -82
@@ -0,0 +1,65 @@
1
+ ---
2
+ figma: '29203:71075'
3
+ ---
4
+
5
+ <!-- Synced from Figma by scripts/sync-figma-docs.mjs. Edit the copy in Figma: changes made here are overwritten. -->
6
+
7
+ ## Usage
8
+
9
+ The Progress component shows how far along a task is, as a proportion of the whole. The bar exists so a user can decide whether to wait, which makes it honest only when the end point is actually known.
10
+
11
+ Use it for determinate work — an upload, an import, a multi-step setup. When the duration is unknown, Spinner says so without pretending to measure.
12
+
13
+ ### Only promise what you know
14
+
15
+ A bar that misreports is worse than no bar:
16
+
17
+ - The proportion reflects real progress, not elapsed time
18
+ - The bar never goes backwards
19
+ - 0% and 100% are both visibly distinct states
20
+ - The bar is paired with a number or label where precision matters
21
+
22
+ ### Say what is progressing
23
+
24
+ A bar on its own leaves the user guessing:
25
+
26
+ 1. A label names the task
27
+ 2. The bar shows the proportion
28
+ 3. A value or count gives precision where it helps
29
+ 4. Completion is stated, not just implied by a full bar
30
+
31
+ ### Consistency
32
+
33
+ Every progress bar is built from the same parts:
34
+
35
+ - Progress bar, from 0% to 100%
36
+ - A label naming the task
37
+ - An optional value or count
38
+ - One bar height and one length rule per context
39
+
40
+ ## Do
41
+
42
+ - Use progress only when the end point is known
43
+ - Name the task beside the bar
44
+ - Show a value or count where precision helps the user decide
45
+ - Keep the bar's height and length consistent within a context
46
+ - Make 0% visibly a bar at zero, not an absent bar
47
+ - State completion in words as well as showing a full bar
48
+
49
+ ## Don't
50
+
51
+ - Use a progress bar for work of unknown duration — use Spinner
52
+ - Base the proportion on elapsed time rather than real progress
53
+ - Let the bar move backwards
54
+ - Show a bar with no indication of what is progressing
55
+ - Use progress for something the user is not waiting on
56
+ - Rely on the fill colour alone to distinguish progress from track
57
+
58
+ ## Accessibility
59
+
60
+ - Fill and track differ in more than colour, so the proportion reads in greyscale
61
+ - The bar is tall enough that a small proportion is still visible just above zero
62
+ - A value or label states the progress in words, so the bar is not the only indication
63
+ - The label names what is progressing and sits beside the bar
64
+ - Completion is stated in text, not signalled only by the bar filling
65
+ - The bar's position and length stay stable, so the page does not shift as it fills
@@ -1,5 +1,16 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
+ import { expect, userEvent, within } from 'storybook/test';
3
+ import { ref } from 'vue';
2
4
  import UiProgress from './UiProgress.vue';
5
+ import {
6
+ accessibilityStory,
7
+ designNotesStory,
8
+ guidanceLinks,
9
+ parseGuidance,
10
+ } from '../../../.storybook/guidance';
11
+ import guidanceMarkdown from './UiProgress.guidance.md?raw';
12
+
13
+ const guidance = parseGuidance(guidanceMarkdown);
3
14
 
4
15
  /**
5
16
  * UiProgress is a horizontal bar that visualizes the progress of a determinate task.
@@ -22,6 +33,9 @@ const meta: Meta<typeof UiProgress> = {
22
33
  args: {
23
34
  modelValue: 33,
24
35
  },
36
+ parameters: {
37
+ docs: { links: guidanceLinks(guidance) },
38
+ },
25
39
  };
26
40
 
27
41
  export default meta;
@@ -58,6 +72,45 @@ export const Default: Story = {
58
72
  },
59
73
  },
60
74
  },
75
+ play: async ({ canvasElement, step }) => {
76
+ // Scenario (UiProgress): the bar exposes its current value against the
77
+ // default maximum of 100.
78
+ const progress = within(canvasElement).getByRole('progressbar');
79
+
80
+ await step(
81
+ 'interaction: exposes a progressbar with its value and range',
82
+ async () => {
83
+ await expect(progress).toHaveAttribute('aria-valuenow', '33');
84
+ await expect(progress).toHaveAttribute('aria-valuemin', '0');
85
+ await expect(progress).toHaveAttribute('aria-valuemax', '100');
86
+ },
87
+ );
88
+ },
89
+ };
90
+
91
+ /**
92
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
93
+ */
94
+ export const DesignNotes: Story = {
95
+ ...designNotesStory(guidance),
96
+ tags: ['!autodocs'],
97
+ };
98
+
99
+ /**
100
+ * Accessibility guidance from the Figma documentation, with the component in
101
+ * the default and accessible themes.
102
+ */
103
+ export const Accessibility: Story = {
104
+ ...accessibilityStory({
105
+ requirements: guidance.accessibility,
106
+ example: {
107
+ components: { UiProgress },
108
+ template: `
109
+ <UiProgress aria-label="File upload progress" :model-value="60" class="w-40" />
110
+ `,
111
+ },
112
+ }),
113
+ tags: ['!autodocs'],
61
114
  };
62
115
 
63
116
  const customMaxTemplateSource = `<script setup lang="ts">
@@ -95,4 +148,251 @@ export const CustomMax: Story = {
95
148
  },
96
149
  },
97
150
  },
151
+ play: async ({ canvasElement, step }) => {
152
+ // Scenario (UiProgress): with a custom maximum, the value is reported
153
+ // against that maximum rather than 100.
154
+ const progress = within(canvasElement).getByRole('progressbar');
155
+
156
+ await step(
157
+ 'interaction: reports the value against a custom max',
158
+ async () => {
159
+ await expect(progress).toHaveAttribute('aria-valuenow', '75');
160
+ await expect(progress).toHaveAttribute('aria-valuemax', '200');
161
+ },
162
+ );
163
+ },
164
+ };
165
+
166
+ const renderTestProgress = () => ({
167
+ components: { UiProgress },
168
+ setup() {
169
+ const upload = ref(60);
170
+ const advance = () => {
171
+ upload.value = Math.min(upload.value + 10, 100);
172
+ };
173
+ return { advance, upload };
174
+ },
175
+ template: `
176
+ <div class="flex w-full max-w-sm flex-col gap-4">
177
+ <div class="flex flex-col gap-2">
178
+ <span id="upload-progress-label" class="body-s-medium">Uploading report.pdf</span>
179
+ <UiProgress v-model="upload" aria-labelledby="upload-progress-label" />
180
+ </div>
181
+ <UiProgress aria-label="Storage used" :model-value="150" :max="100" />
182
+ <button type="button" class="body-s-medium self-start rounded border px-3 py-1" @click="advance">
183
+ Add 10%
184
+ </button>
185
+ </div>
186
+ `,
187
+ });
188
+
189
+ /**
190
+ * A progress bar reports status but takes no input, so it is never a tab
191
+ * stop. Hidden test-only story.
192
+ */
193
+ export const KeyboardNavigation: Story = {
194
+ name: 'test - Keyboard Navigation',
195
+ tags: ['!dev', '!autodocs'],
196
+ parameters: {
197
+ // Focus moves during the play function.
198
+ chromatic: { disableSnapshot: true },
199
+ docs: {
200
+ description: {
201
+ story:
202
+ 'Press `Tab`: focus skips the progress bars and lands on the only control.',
203
+ },
204
+ },
205
+ },
206
+ render: renderTestProgress,
207
+ play: async ({ canvasElement, step }) => {
208
+ // Scenario (UiProgress): a keyboard user tabs through the page; the bars
209
+ // are skipped and focus goes straight to the button that drives them.
210
+ const canvas = within(canvasElement);
211
+
212
+ await step(
213
+ 'keyboard: progress bars are not tab stops; Tab lands on the control',
214
+ async () => {
215
+ await userEvent.tab();
216
+ await expect(
217
+ canvas.getByRole('button', { name: 'Add 10%' }),
218
+ ).toHaveFocus();
219
+ },
220
+ );
221
+
222
+ await step('keyboard: no progress bar carries a tabindex', async () => {
223
+ for (const progress of canvas.getAllByRole('progressbar')) {
224
+ await expect(progress).not.toHaveAttribute('tabindex');
225
+ }
226
+ });
227
+ },
228
+ };
229
+
230
+ /**
231
+ * What assistive technology announces: a named progressbar with its value,
232
+ * range, and updates (WCAG 4.1.2). Hidden test-only story.
233
+ */
234
+ export const ScreenReader: Story = {
235
+ name: 'test - Screen Reader',
236
+ tags: ['!dev', '!autodocs'],
237
+ parameters: {
238
+ // The value changes during the play function.
239
+ chromatic: { disableSnapshot: true },
240
+ docs: {
241
+ description: {
242
+ story:
243
+ 'Verifies the name, value, and range that assistive technology announces for each progress bar.',
244
+ },
245
+ },
246
+ },
247
+ render: renderTestProgress,
248
+ play: async ({ canvasElement, step }) => {
249
+ // Scenario (UiProgress): each bar is announced by what it measures, not by
250
+ // a bare percentage, and its value stays within range as it changes.
251
+ const canvas = within(canvasElement);
252
+
253
+ await step(
254
+ 'screen-reader: a visible label names the progress bar (WCAG 4.1.2)',
255
+ async () => {
256
+ await expect(
257
+ canvas.getByRole('progressbar', { name: 'Uploading report.pdf' }),
258
+ ).toHaveAttribute('aria-valuenow', '60');
259
+ },
260
+ );
261
+
262
+ await step(
263
+ 'screen-reader: aria-label replaces the default percentage name',
264
+ async () => {
265
+ await expect(
266
+ canvas.getByRole('progressbar', { name: 'Storage used' }),
267
+ ).toHaveAccessibleName('Storage used');
268
+ },
269
+ );
270
+
271
+ await step(
272
+ 'screen-reader: a value above max is announced as the max',
273
+ async () => {
274
+ await expect(
275
+ canvas.getByRole('progressbar', { name: 'Storage used' }),
276
+ ).toHaveAttribute('aria-valuenow', '100');
277
+ },
278
+ );
279
+
280
+ await step(
281
+ 'screen-reader: value changes update aria-valuenow',
282
+ async () => {
283
+ await userEvent.click(canvas.getByRole('button', { name: 'Add 10%' }));
284
+ await expect(
285
+ canvas.getByRole('progressbar', { name: 'Uploading report.pdf' }),
286
+ ).toHaveAttribute('aria-valuenow', '70');
287
+ },
288
+ );
289
+ },
290
+ };
291
+
292
+ /**
293
+ * Rendered at 200% page zoom (WCAG 1.4.4 Resize Text). Use the Zoom toolbar to
294
+ * try 400% reflow (WCAG 1.4.10). Hidden test-only story.
295
+ */
296
+ export const ZoomMagnification: Story = {
297
+ name: 'test - Zoom Magnification',
298
+ tags: ['!dev', '!autodocs'],
299
+ globals: { zoom: '200' },
300
+ parameters: {
301
+ // Zoom changes the layout scale; the accessible-reflow Chromatic mode
302
+ // already covers magnified snapshots, so skip this one.
303
+ chromatic: { disableSnapshot: true },
304
+ docs: {
305
+ description: {
306
+ story:
307
+ 'Use the Zoom toolbar (200% resize text, 400% reflow) to magnify the preview.',
308
+ },
309
+ },
310
+ },
311
+ render: renderTestProgress,
312
+ play: async ({ canvasElement, step }) => {
313
+ // Scenario (UiProgress): at 200% page zoom the label stays readable and
314
+ // each bar stays inside the viewport.
315
+ const canvas = within(canvasElement);
316
+
317
+ await step(
318
+ 'zoom: preview is magnified to 200% (WCAG 1.4.4 Resize Text)',
319
+ async () => {
320
+ await expect(document.documentElement.style.zoom).toBe('200%');
321
+ },
322
+ );
323
+
324
+ await step('zoom: the label stays readable', async () => {
325
+ await expect(canvas.getByText('Uploading report.pdf')).toBeVisible();
326
+ });
327
+
328
+ await step(
329
+ 'zoom: progress bars stay visible inside the viewport',
330
+ async () => {
331
+ for (const progress of canvas.getAllByRole('progressbar')) {
332
+ await expect(progress).toBeVisible();
333
+ const { left, right } = progress.getBoundingClientRect();
334
+ await expect(left).toBeGreaterThanOrEqual(0);
335
+ await expect(right).toBeLessThanOrEqual(window.innerWidth + 1);
336
+ }
337
+ },
338
+ );
339
+ },
340
+ };
341
+
342
+ /**
343
+ * Rendered at the mobile (320px reflow) breakpoint via the Media breakpoint
344
+ * toolbar. Hidden test-only story.
345
+ */
346
+ export const MobileBreakpoint: Story = {
347
+ name: 'test - Mobile Breakpoint',
348
+ tags: ['!dev', '!autodocs'],
349
+ globals: { mediaBreakpoint: 'reflow' },
350
+ parameters: {
351
+ // Reflow snapshots are already covered by the accessible-reflow mode.
352
+ chromatic: { disableSnapshot: true },
353
+ docs: {
354
+ description: {
355
+ story:
356
+ 'Switch the Media breakpoint toolbar to Mobile to preview the 320px layout.',
357
+ },
358
+ },
359
+ },
360
+ render: renderTestProgress,
361
+ play: async ({ canvasElement, step }) => {
362
+ // Scenario (UiProgress): at the 320px mobile breakpoint the bars shrink to
363
+ // fit rather than pushing the page sideways.
364
+ const canvas = within(canvasElement);
365
+
366
+ await step(
367
+ 'mobile: progress bars render at the 320px breakpoint',
368
+ async () => {
369
+ for (const progress of canvas.getAllByRole('progressbar')) {
370
+ await expect(progress).toBeVisible();
371
+ }
372
+ },
373
+ );
374
+
375
+ await step(
376
+ 'mobile: the layout fits without sideways scrolling (WCAG 1.4.10 Reflow)',
377
+ async () => {
378
+ const { scrollWidth, clientWidth } = document.documentElement;
379
+ await expect(scrollWidth).toBeLessThanOrEqual(clientWidth + 1);
380
+ },
381
+ );
382
+
383
+ await step(
384
+ 'mobile: progress bars add no touch targets of their own',
385
+ async () => {
386
+ // A progress bar takes no input, so 2.5.8 doesn't apply to it; only
387
+ // the control that drives it needs a target size.
388
+ for (const progress of canvas.getAllByRole('progressbar')) {
389
+ await expect(progress).not.toHaveAttribute('tabindex');
390
+ }
391
+ const { height } = canvas
392
+ .getByRole('button', { name: 'Add 10%' })
393
+ .getBoundingClientRect();
394
+ await expect(height).toBeGreaterThanOrEqual(24);
395
+ },
396
+ );
397
+ },
98
398
  };
@@ -0,0 +1,66 @@
1
+ ---
2
+ figma: '29205:153'
3
+ ---
4
+
5
+ <!-- Synced from Figma by scripts/sync-figma-docs.mjs. Edit the copy in Figma: changes made here are overwritten. -->
6
+
7
+ ## Usage
8
+
9
+ The Radio Group component offers a set of options where exactly one can be chosen. Because every option is visible at once, the user compares them rather than remembering them.
10
+
11
+ Use it when the options benefit from being seen side by side and there are few enough to show. When the list is long, Select is the right control; when the options are independent, use Checkbox.
12
+
13
+ ### One choice, all visible
14
+
15
+ The value of a radio group is the comparison it allows:
16
+
17
+ - Exactly one option can be selected at a time
18
+ - Every option is visible without opening anything
19
+ - Options are phrased in parallel, so they can be compared
20
+ - A default is preselected only where one is genuinely safer
21
+
22
+ ### Label, then description
23
+
24
+ Each option is read as a unit, in a fixed order:
25
+
26
+ 1. Label names the option
27
+ 2. Description adds the consequence of choosing it
28
+ 3. Control placement puts the button at the start, or the end for list rows
29
+ 4. The whole row is the target, label included
30
+
31
+ ### Consistency
32
+
33
+ Every radio group is built from the same parts:
34
+
35
+ - Radio group, holding up to six options
36
+ - Radio button, default or box type
37
+ - Control placement, at the start or the end
38
+ - Label, always present; description, where it helps
39
+ - States: default and focus, active on or off
40
+
41
+ ## Do
42
+
43
+ - Keep the options few enough that all can be shown
44
+ - Phrase options in parallel, so they compare cleanly
45
+ - Preselect a default only when one option is genuinely safer
46
+ - Use the box type when each option needs more than a line
47
+ - Make the whole row the target, label included
48
+ - Use one control placement throughout a form
49
+
50
+ ## Don't
51
+
52
+ - Use a radio group where more than one option may apply — use Checkbox
53
+ - Offer a long list of options — use Select
54
+ - Leave a group with no way to express no preference, where that is valid
55
+ - Preselect an option that costs the user something
56
+ - Mix control placement within one form
57
+ - Rely on the dot's colour alone to show which option is selected
58
+
59
+ ## Accessibility
60
+
61
+ - The selected option differs from the unselected ones by the mark itself, not colour alone
62
+ - Focus is visible on the option, and distinguishable from the selected state
63
+ - The whole row is a comfortable target, including on touch
64
+ - Descriptions stay visually attached to their own option, not to the next one
65
+ - Spacing between options is wide enough that the grouping is unambiguous
66
+ - Every option carries a visible label, and the group itself is named above it