@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
@@ -14,6 +14,16 @@ import { UiButton } from '../UiButton';
14
14
  import { UiInput } from '../UiInput';
15
15
  import { UiLabel } from '../UiLabel';
16
16
  import { ref, watch } from 'vue';
17
+ import {
18
+ accessibilityRequirementsTemplate,
19
+ designNotesStory,
20
+ guidanceLinks,
21
+ guidanceSectionClass,
22
+ parseGuidance,
23
+ } from '../../../.storybook/guidance';
24
+ import guidanceMarkdown from './UiSheet.guidance.md?raw';
25
+
26
+ const guidance = parseGuidance(guidanceMarkdown);
17
27
 
18
28
  /**
19
29
  * UiSheet slides a panel in from the edge of the screen.
@@ -40,6 +50,9 @@ const meta: Meta<typeof UiSheet> = {
40
50
  open: false,
41
51
  modal: true,
42
52
  },
53
+ parameters: {
54
+ docs: { links: guidanceLinks(guidance) },
55
+ },
43
56
  };
44
57
 
45
58
  export default meta;
@@ -180,6 +193,187 @@ export const Default: Story = {
180
193
  },
181
194
  };
182
195
 
196
+ /**
197
+ * Usage, guidelines, and do's and don'ts from the Figma documentation.
198
+ */
199
+ export const DesignNotes: Story = {
200
+ ...designNotesStory(guidance),
201
+ tags: ['!autodocs'],
202
+ };
203
+
204
+ /**
205
+ * Accessibility guidance for naming the sheet, describing it, labelling the
206
+ * built-in close control, and contrast.
207
+ */
208
+ export const Accessibility: Story = {
209
+ render: () => ({
210
+ components: {
211
+ UiSheet,
212
+ UiSheetClose,
213
+ UiSheetContent,
214
+ UiSheetDescription,
215
+ UiSheetFooter,
216
+ UiSheetHeader,
217
+ UiSheetTitle,
218
+ UiSheetTrigger,
219
+ UiButton,
220
+ },
221
+ setup() {
222
+ const defaultOpen = ref(false);
223
+ const accessibleOpen = ref(false);
224
+ return { defaultOpen, accessibleOpen };
225
+ },
226
+ template: `
227
+ <section class="${guidanceSectionClass}">
228
+ <div>
229
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
230
+ Accessibility
231
+ </h2>
232
+ </div>
233
+
234
+ ${accessibilityRequirementsTemplate(guidance.accessibility, 'Requirements')}
235
+
236
+ <div class="flex flex-col gap-6">
237
+ <div class="flex flex-col gap-2">
238
+ <h3 class="body-m-medium text-content-on-surface-primary">
239
+ Always include a title
240
+ </h3>
241
+ <p class="body-m-regular text-content-on-surface-primary">
242
+ <code>UiSheetTitle</code> becomes the sheet's accessible name via
243
+ <code>aria-labelledby</code>. Without it the panel is announced as
244
+ an unnamed dialog, and a screen-reader user has no idea what just
245
+ slid in.
246
+ </p>
247
+ </div>
248
+
249
+ <div class="flex flex-col gap-2">
250
+ <h3 class="body-m-medium text-content-on-surface-primary">
251
+ Describe what the sheet is for
252
+ </h3>
253
+ <p class="body-m-regular text-content-on-surface-primary">
254
+ <code>UiSheetDescription</code> is wired up as
255
+ <code>aria-describedby</code>, so it is read straight after the
256
+ title. Keep it to one sentence that explains the purpose rather
257
+ than repeating the title.
258
+ </p>
259
+ </div>
260
+
261
+ <div class="flex flex-col gap-2">
262
+ <h3 class="body-m-medium text-content-on-surface-primary">
263
+ Don't duplicate the built-in close
264
+ </h3>
265
+ <p class="body-m-regular text-content-on-surface-primary">
266
+ <code>UiSheetContent</code> already renders an X close control
267
+ labelled <code>Close</code>. If you also add a footer
268
+ <code>UiSheetClose</code>, give it a distinct label such as
269
+ <code>Done</code> or <code>Cancel</code> — otherwise a
270
+ screen-reader user hears two identical "Close" buttons and cannot
271
+ tell them apart. Use <code>closeLabel</code> to translate or
272
+ sharpen the built-in one.
273
+ </p>
274
+ </div>
275
+
276
+ <div class="flex flex-col gap-2">
277
+ <h3 class="body-m-medium text-content-on-surface-primary">
278
+ Keep every exit available
279
+ </h3>
280
+ <p class="body-m-regular text-content-on-surface-primary">
281
+ A modal sheet traps focus, so it must always offer a way out. It
282
+ can be dismissed with <code>Escape</code>, by clicking the
283
+ overlay, or with either close control — and focus returns to the
284
+ trigger every time.
285
+ </p>
286
+ </div>
287
+
288
+ <div class="flex flex-col gap-2">
289
+ <h3 class="body-m-medium text-content-on-surface-primary">
290
+ Enable accessibility theme
291
+ </h3>
292
+ <p class="body-m-regular text-content-on-surface-primary">
293
+ When accessibility is required, enable our accessibility theme.
294
+ This increases contrast and makes sure there are no color
295
+ contrast issues.
296
+ </p>
297
+ </div>
298
+ </div>
299
+
300
+ <div class="grid gap-4 md:grid-cols-2">
301
+ <div class="flex flex-col gap-3">
302
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
303
+ Default
304
+ </h3>
305
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
306
+ <UiSheet v-model:open="defaultOpen">
307
+ <UiSheetTrigger as-child>
308
+ <UiButton variant="outline">Open Sheet</UiButton>
309
+ </UiSheetTrigger>
310
+ <UiSheetContent close-label="Close sheet">
311
+ <UiSheetHeader>
312
+ <UiSheetTitle>Sheet title</UiSheetTitle>
313
+ <UiSheetDescription>
314
+ A slide-out panel for supplementary content.
315
+ </UiSheetDescription>
316
+ </UiSheetHeader>
317
+ <div class="flex-1 overflow-auto px-4 py-4 body-s-regular">
318
+ Put any content here.
319
+ </div>
320
+ <UiSheetFooter>
321
+ <UiSheetClose as-child>
322
+ <UiButton>Done</UiButton>
323
+ </UiSheetClose>
324
+ </UiSheetFooter>
325
+ </UiSheetContent>
326
+ </UiSheet>
327
+ </div>
328
+ </div>
329
+
330
+ <div class="accessible-theme flex flex-col gap-3">
331
+ <h3 class="label-m-medium text-center text-content-on-surface-primary">
332
+ Accessible
333
+ </h3>
334
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
335
+ <UiSheet v-model:open="accessibleOpen">
336
+ <UiSheetTrigger as-child>
337
+ <UiButton variant="outline">Open Sheet</UiButton>
338
+ </UiSheetTrigger>
339
+ <UiSheetContent close-label="Close sheet">
340
+ <UiSheetHeader>
341
+ <UiSheetTitle>Sheet title</UiSheetTitle>
342
+ <UiSheetDescription>
343
+ A slide-out panel for supplementary content.
344
+ </UiSheetDescription>
345
+ </UiSheetHeader>
346
+ <div class="flex-1 overflow-auto px-4 py-4 body-s-regular">
347
+ Put any content here.
348
+ </div>
349
+ <UiSheetFooter>
350
+ <UiSheetClose as-child>
351
+ <UiButton>Done</UiButton>
352
+ </UiSheetClose>
353
+ </UiSheetFooter>
354
+ </UiSheetContent>
355
+ </UiSheet>
356
+ </div>
357
+ </div>
358
+ </div>
359
+ </section>
360
+ `,
361
+ }),
362
+ tags: ['!autodocs'],
363
+ parameters: {
364
+ surface: 'primary',
365
+ a11y: { test: 'off' },
366
+ chromatic: {
367
+ disableSnapshot: true,
368
+ },
369
+ docs: {
370
+ canvas: {
371
+ sourceState: 'none',
372
+ },
373
+ },
374
+ },
375
+ };
376
+
183
377
  const controlledTemplateSource = `<script setup lang="ts">
184
378
  import {
185
379
  UiSheet,
@@ -790,176 +984,6 @@ export const OpenByDefault: Story = {
790
984
  },
791
985
  };
792
986
 
793
- /**
794
- * Accessibility guidance for naming the sheet, describing it, labelling the
795
- * built-in close control, and contrast.
796
- */
797
- export const Accessibility: Story = {
798
- render: () => ({
799
- components: {
800
- UiSheet,
801
- UiSheetClose,
802
- UiSheetContent,
803
- UiSheetDescription,
804
- UiSheetFooter,
805
- UiSheetHeader,
806
- UiSheetTitle,
807
- UiSheetTrigger,
808
- UiButton,
809
- },
810
- setup() {
811
- const defaultOpen = ref(false);
812
- const accessibleOpen = ref(false);
813
- return { defaultOpen, accessibleOpen };
814
- },
815
- template: `
816
- <section class="flex flex-col gap-6 p-4">
817
- <div>
818
- <h2 class="heading-m font-bold text-content-on-surface-primary">
819
- Accessibility
820
- </h2>
821
- </div>
822
-
823
- <div class="flex flex-col gap-6">
824
- <div class="flex flex-col gap-2">
825
- <h3 class="body-m-medium text-content-on-surface-primary">
826
- Always include a title
827
- </h3>
828
- <p class="body-m-regular text-content-on-surface-primary">
829
- <code>UiSheetTitle</code> becomes the sheet's accessible name via
830
- <code>aria-labelledby</code>. Without it the panel is announced as
831
- an unnamed dialog, and a screen-reader user has no idea what just
832
- slid in.
833
- </p>
834
- </div>
835
-
836
- <div class="flex flex-col gap-2">
837
- <h3 class="body-m-medium text-content-on-surface-primary">
838
- Describe what the sheet is for
839
- </h3>
840
- <p class="body-m-regular text-content-on-surface-primary">
841
- <code>UiSheetDescription</code> is wired up as
842
- <code>aria-describedby</code>, so it is read straight after the
843
- title. Keep it to one sentence that explains the purpose rather
844
- than repeating the title.
845
- </p>
846
- </div>
847
-
848
- <div class="flex flex-col gap-2">
849
- <h3 class="body-m-medium text-content-on-surface-primary">
850
- Don't duplicate the built-in close
851
- </h3>
852
- <p class="body-m-regular text-content-on-surface-primary">
853
- <code>UiSheetContent</code> already renders an X close control
854
- labelled <code>Close</code>. If you also add a footer
855
- <code>UiSheetClose</code>, give it a distinct label such as
856
- <code>Done</code> or <code>Cancel</code> — otherwise a
857
- screen-reader user hears two identical "Close" buttons and cannot
858
- tell them apart. Use <code>closeLabel</code> to translate or
859
- sharpen the built-in one.
860
- </p>
861
- </div>
862
-
863
- <div class="flex flex-col gap-2">
864
- <h3 class="body-m-medium text-content-on-surface-primary">
865
- Keep every exit available
866
- </h3>
867
- <p class="body-m-regular text-content-on-surface-primary">
868
- A modal sheet traps focus, so it must always offer a way out. It
869
- can be dismissed with <code>Escape</code>, by clicking the
870
- overlay, or with either close control — and focus returns to the
871
- trigger every time.
872
- </p>
873
- </div>
874
-
875
- <div class="flex flex-col gap-2">
876
- <h3 class="body-m-medium text-content-on-surface-primary">
877
- Enable accessibility theme
878
- </h3>
879
- <p class="body-m-regular text-content-on-surface-primary">
880
- When accessibility is required, enable our accessibility theme.
881
- This increases contrast and makes sure there are no color
882
- contrast issues.
883
- </p>
884
- </div>
885
- </div>
886
-
887
- <div class="grid gap-4 md:grid-cols-2">
888
- <div class="flex flex-col gap-3">
889
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
890
- Default
891
- </h3>
892
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
893
- <UiSheet v-model:open="defaultOpen">
894
- <UiSheetTrigger as-child>
895
- <UiButton variant="outline">Open Sheet</UiButton>
896
- </UiSheetTrigger>
897
- <UiSheetContent close-label="Close sheet">
898
- <UiSheetHeader>
899
- <UiSheetTitle>Sheet title</UiSheetTitle>
900
- <UiSheetDescription>
901
- A slide-out panel for supplementary content.
902
- </UiSheetDescription>
903
- </UiSheetHeader>
904
- <div class="flex-1 overflow-auto px-4 py-4 body-s-regular">
905
- Put any content here.
906
- </div>
907
- <UiSheetFooter>
908
- <UiSheetClose as-child>
909
- <UiButton>Done</UiButton>
910
- </UiSheetClose>
911
- </UiSheetFooter>
912
- </UiSheetContent>
913
- </UiSheet>
914
- </div>
915
- </div>
916
-
917
- <div class="accessible-theme flex flex-col gap-3">
918
- <h3 class="label-m-medium text-center text-content-on-surface-primary">
919
- Accessible
920
- </h3>
921
- <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
922
- <UiSheet v-model:open="accessibleOpen">
923
- <UiSheetTrigger as-child>
924
- <UiButton variant="outline">Open Sheet</UiButton>
925
- </UiSheetTrigger>
926
- <UiSheetContent close-label="Close sheet">
927
- <UiSheetHeader>
928
- <UiSheetTitle>Sheet title</UiSheetTitle>
929
- <UiSheetDescription>
930
- A slide-out panel for supplementary content.
931
- </UiSheetDescription>
932
- </UiSheetHeader>
933
- <div class="flex-1 overflow-auto px-4 py-4 body-s-regular">
934
- Put any content here.
935
- </div>
936
- <UiSheetFooter>
937
- <UiSheetClose as-child>
938
- <UiButton>Done</UiButton>
939
- </UiSheetClose>
940
- </UiSheetFooter>
941
- </UiSheetContent>
942
- </UiSheet>
943
- </div>
944
- </div>
945
- </div>
946
- </section>
947
- `,
948
- }),
949
- tags: ['!autodocs'],
950
- parameters: {
951
- a11y: { test: 'off' },
952
- chromatic: {
953
- disableSnapshot: true,
954
- },
955
- docs: {
956
- canvas: {
957
- sourceState: 'none',
958
- },
959
- },
960
- },
961
- };
962
-
963
987
  /*
964
988
  * ─────────────────────────────────────────────────────────────────────────────
965
989
  * Interaction & accessibility tests (play functions)
@@ -0,0 +1,65 @@
1
+ ---
2
+ figma: '29207:71275'
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 Skeleton component occupies the shape of content that has not arrived yet. Its job is to keep the layout still: what appears is the same size as what will replace it, so nothing moves when the real content lands.
10
+
11
+ Use it where the shape of the incoming content is known — a list of rows, a card, a paragraph. Where the shape is unknown or the wait is brief, Spinner says less but says it honestly.
12
+
13
+ ### Match the shape, not the content
14
+
15
+ A skeleton is a placeholder for layout, not a preview:
16
+
17
+ - Each block matches the size and position of what will replace it
18
+ - Text skeletons use a few lines of varying length, not a solid block
19
+ - The number of blocks matches the expected number of items
20
+ - Nothing in a skeleton suggests specific content
21
+
22
+ ### Only while it helps
23
+
24
+ A skeleton is a promise that content is coming:
25
+
26
+ 1. Shown as soon as the wait becomes noticeable
27
+ 2. Held for the whole wait, without flickering in and out
28
+ 3. Replaced by real content in place, with no reflow
29
+ 4. Replaced by an empty state, not left in place, when nothing arrives
30
+
31
+ ### Consistency
32
+
33
+ Every skeleton is built from the same parts:
34
+
35
+ - Skeleton, in default, card and text variants
36
+ - One block per element it stands in for
37
+ - The same corner radius as the content it replaces
38
+ - One shimmer treatment, or none, across a product
39
+
40
+ ## Do
41
+
42
+ - Match each block to the size and position of what will replace it
43
+ - Use a few lines of varying length for text
44
+ - Show as many blocks as items you expect
45
+ - Replace the skeleton in place, so nothing reflows
46
+ - Show an empty state when nothing arrives
47
+ - Keep the same corner radius as the real content
48
+
49
+ ## Don't
50
+
51
+ - Use a skeleton whose shape does not match the content
52
+ - Show a solid block where text will appear
53
+ - Flicker the skeleton in and out on a fast response
54
+ - Leave a skeleton on screen after a failure
55
+ - Use a skeleton where the shape of the content is unknown
56
+ - Animate the shimmer so strongly it draws the eye
57
+
58
+ ## Accessibility
59
+
60
+ - The skeleton is distinguishable from real content, so it is never mistaken for empty data
61
+ - Its contrast against the page is enough to be visible without competing with real content nearby
62
+ - Any shimmer is subtle and slow, so it does not distract or discomfort
63
+ - Blocks match the real layout, so the page does not shift when content lands
64
+ - A failure ends in a visible message, never in a skeleton left in place
65
+ - The wait is also communicated in text where it may be long