@slashsuite/ui-react 0.12.0 → 0.13.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 (388) hide show
  1. package/MIGRATING.md +386 -8
  2. package/README.md +101 -44
  3. package/agent-docs/components/app-shell.md +139 -0
  4. package/agent-docs/components/article-layout.md +140 -0
  5. package/agent-docs/components/audio.md +42 -0
  6. package/agent-docs/components/avatar-stack.md +64 -0
  7. package/agent-docs/components/avatar.md +76 -0
  8. package/agent-docs/components/badge.md +62 -0
  9. package/agent-docs/components/body-text.md +169 -0
  10. package/agent-docs/components/bottom-sheet.md +105 -0
  11. package/agent-docs/components/breadcrumbs.md +66 -0
  12. package/agent-docs/components/bullet-list.md +54 -0
  13. package/agent-docs/components/button.md +135 -0
  14. package/agent-docs/components/call-to-action.md +59 -0
  15. package/agent-docs/components/callout.md +87 -0
  16. package/agent-docs/components/card-grid.md +116 -0
  17. package/agent-docs/components/card.md +128 -0
  18. package/agent-docs/components/cart-button.md +63 -0
  19. package/agent-docs/components/centered-layout.md +90 -0
  20. package/agent-docs/components/chat-composer.md +49 -0
  21. package/agent-docs/components/chat-message.md +61 -0
  22. package/agent-docs/components/chat-thread.md +49 -0
  23. package/agent-docs/components/checkbox.md +81 -0
  24. package/agent-docs/components/cluster.md +108 -0
  25. package/agent-docs/components/code-example.md +48 -0
  26. package/agent-docs/components/code.md +72 -0
  27. package/agent-docs/components/colour-scheme-toggle.md +98 -0
  28. package/agent-docs/components/colour-swatch.md +41 -0
  29. package/agent-docs/components/combobox.md +88 -0
  30. package/agent-docs/components/confirm-dialog.md +98 -0
  31. package/agent-docs/components/container.md +51 -0
  32. package/agent-docs/components/copy-button.md +63 -0
  33. package/agent-docs/components/copy-line.md +55 -0
  34. package/agent-docs/components/date-field.md +106 -0
  35. package/agent-docs/components/date-range-picker.md +108 -0
  36. package/agent-docs/components/date-time-field.md +73 -0
  37. package/agent-docs/components/detail-layout.md +147 -0
  38. package/agent-docs/components/dialog.md +132 -0
  39. package/agent-docs/components/disclosure.md +70 -0
  40. package/agent-docs/components/divider.md +62 -0
  41. package/agent-docs/components/docs-layout.md +164 -0
  42. package/agent-docs/components/drawer.md +137 -0
  43. package/agent-docs/components/embed-frame.md +48 -0
  44. package/agent-docs/components/empty-state.md +70 -0
  45. package/agent-docs/components/field-dialog.md +98 -0
  46. package/agent-docs/components/field.md +71 -0
  47. package/agent-docs/components/fieldset.md +82 -0
  48. package/agent-docs/components/file-drop.md +52 -0
  49. package/agent-docs/components/flow-diagram.md +87 -0
  50. package/agent-docs/components/form-layout.md +144 -0
  51. package/agent-docs/components/form-row.md +93 -0
  52. package/agent-docs/components/full-bleed-layout.md +114 -0
  53. package/agent-docs/components/headings.md +107 -0
  54. package/agent-docs/components/hero.md +68 -0
  55. package/agent-docs/components/icon-button.md +90 -0
  56. package/agent-docs/components/icon.md +59 -0
  57. package/agent-docs/components/image.md +74 -0
  58. package/agent-docs/components/input.md +84 -0
  59. package/agent-docs/components/kbd.md +38 -0
  60. package/agent-docs/components/key-value-list.md +84 -0
  61. package/agent-docs/components/lightbox.md +97 -0
  62. package/agent-docs/components/list-layout.md +152 -0
  63. package/agent-docs/components/list-row.md +119 -0
  64. package/agent-docs/components/loading.md +69 -0
  65. package/agent-docs/components/markdown.md +51 -0
  66. package/agent-docs/components/media-tile.md +101 -0
  67. package/agent-docs/components/menu.md +110 -0
  68. package/agent-docs/components/meta-list.md +69 -0
  69. package/agent-docs/components/morph.md +134 -0
  70. package/agent-docs/components/navigation-progress.md +56 -0
  71. package/agent-docs/components/number-field.md +75 -0
  72. package/agent-docs/components/outline-region.md +74 -0
  73. package/agent-docs/components/page-fade.md +117 -0
  74. package/agent-docs/components/page-header.md +93 -0
  75. package/agent-docs/components/pagination.md +64 -0
  76. package/agent-docs/components/pill.md +105 -0
  77. package/agent-docs/components/popover.md +63 -0
  78. package/agent-docs/components/price.md +49 -0
  79. package/agent-docs/components/product-tile.md +78 -0
  80. package/agent-docs/components/progress-bar.md +66 -0
  81. package/agent-docs/components/promo-banner.md +46 -0
  82. package/agent-docs/components/prose-layout.md +87 -0
  83. package/agent-docs/components/prose.md +41 -0
  84. package/agent-docs/components/radio-group.md +77 -0
  85. package/agent-docs/components/scroll-strip.md +48 -0
  86. package/agent-docs/components/segmented-control.md +135 -0
  87. package/agent-docs/components/select.md +70 -0
  88. package/agent-docs/components/show.md +120 -0
  89. package/agent-docs/components/side-column.md +74 -0
  90. package/agent-docs/components/sidebar-layout.md +134 -0
  91. package/agent-docs/components/site-footer.md +63 -0
  92. package/agent-docs/components/site-search.md +79 -0
  93. package/agent-docs/components/slider.md +59 -0
  94. package/agent-docs/components/sortable-list.md +112 -0
  95. package/agent-docs/components/split-bar.md +54 -0
  96. package/agent-docs/components/stack.md +197 -0
  97. package/agent-docs/components/stacked-bar.md +91 -0
  98. package/agent-docs/components/stat-tile.md +69 -0
  99. package/agent-docs/components/state-machine.md +95 -0
  100. package/agent-docs/components/status-pages.md +112 -0
  101. package/agent-docs/components/stepper.md +54 -0
  102. package/agent-docs/components/steps.md +74 -0
  103. package/agent-docs/components/sticky-bar.md +51 -0
  104. package/agent-docs/components/switch.md +79 -0
  105. package/agent-docs/components/table-of-contents.md +78 -0
  106. package/agent-docs/components/table.md +384 -0
  107. package/agent-docs/components/tabs.md +178 -0
  108. package/agent-docs/components/text-link.md +110 -0
  109. package/agent-docs/components/textarea.md +53 -0
  110. package/agent-docs/components/timeline.md +79 -0
  111. package/agent-docs/components/toast.md +91 -0
  112. package/agent-docs/components/trend-chart.md +61 -0
  113. package/agent-docs/components/video.md +49 -0
  114. package/agent-docs/llms.txt +174 -0
  115. package/dist/AppShell.d.ts +25 -9
  116. package/dist/AppShell.js +67 -33
  117. package/dist/AppShellMenu.d.ts +31 -18
  118. package/dist/AppShellMenu.js +72 -45
  119. package/dist/ArticleLayout.d.ts +36 -0
  120. package/dist/ArticleLayout.js +27 -0
  121. package/dist/Audio.d.ts +16 -0
  122. package/dist/Audio.js +11 -0
  123. package/dist/Badge.d.ts +2 -1
  124. package/dist/Badge.js +3 -2
  125. package/dist/BottomSheet.d.ts +17 -6
  126. package/dist/BottomSheet.js +62 -11
  127. package/dist/Breadcrumbs.d.ts +8 -6
  128. package/dist/Breadcrumbs.js +17 -7
  129. package/dist/Button.d.ts +1 -0
  130. package/dist/Button.js +4 -3
  131. package/dist/CallToAction.d.ts +25 -0
  132. package/dist/CallToAction.js +17 -0
  133. package/dist/Callout.d.ts +2 -2
  134. package/dist/Callout.js +2 -2
  135. package/dist/Card.d.ts +88 -31
  136. package/dist/Card.js +55 -92
  137. package/dist/CardBody.d.ts +2 -0
  138. package/dist/CardBody.js +33 -3
  139. package/dist/CardGrid.d.ts +32 -4
  140. package/dist/CardGrid.js +42 -8
  141. package/dist/CardParts.d.ts +7 -1
  142. package/dist/CardParts.js +7 -2
  143. package/dist/CartButton.d.ts +33 -0
  144. package/dist/CartButton.js +18 -0
  145. package/dist/ChatComposer.d.ts +10 -4
  146. package/dist/ChatComposer.js +35 -13
  147. package/dist/Checkbox.d.ts +21 -3
  148. package/dist/Checkbox.js +66 -20
  149. package/dist/Chevron.js +1 -1
  150. package/dist/Cluster.d.ts +28 -15
  151. package/dist/Cluster.js +21 -4
  152. package/dist/Code.d.ts +15 -3
  153. package/dist/Code.js +23 -3
  154. package/dist/CodeBlock.d.ts +4 -4
  155. package/dist/CodeBlock.js +2 -2
  156. package/dist/CodeBody.d.ts +1 -1
  157. package/dist/CodeBody.js +4 -10
  158. package/dist/CodeExample.d.ts +1 -1
  159. package/dist/CodeExample.js +3 -2
  160. package/dist/ColourSchemeToggle.d.ts +21 -5
  161. package/dist/ColourSchemeToggle.js +15 -9
  162. package/dist/ColourSwatch.d.ts +15 -0
  163. package/dist/ColourSwatch.js +14 -0
  164. package/dist/Combobox.d.ts +42 -0
  165. package/dist/Combobox.js +43 -0
  166. package/dist/ConfirmDialog.d.ts +40 -0
  167. package/dist/ConfirmDialog.js +36 -0
  168. package/dist/Container.d.ts +3 -3
  169. package/dist/Container.js +1 -1
  170. package/dist/CopyButton.d.ts +8 -2
  171. package/dist/CopyButton.js +38 -28
  172. package/dist/CopyLine.d.ts +4 -2
  173. package/dist/CopyLine.js +4 -4
  174. package/dist/DateCalendar.d.ts +2 -0
  175. package/dist/DateCalendar.js +11 -9
  176. package/dist/DateField.d.ts +52 -21
  177. package/dist/DateField.js +73 -37
  178. package/dist/DateFieldCalendar.d.ts +12 -8
  179. package/dist/DateFieldCalendar.js +37 -18
  180. package/dist/DateRangePicker.d.ts +23 -3
  181. package/dist/DateRangePicker.js +10 -8
  182. package/dist/DateTimeField.d.ts +31 -0
  183. package/dist/DateTimeField.js +19 -0
  184. package/dist/Dialog.d.ts +42 -6
  185. package/dist/Dialog.js +50 -12
  186. package/dist/Disclosure.js +9 -1
  187. package/dist/DocsLayout.d.ts +13 -5
  188. package/dist/DocsLayout.js +11 -9
  189. package/dist/Drawer.d.ts +22 -7
  190. package/dist/Drawer.js +89 -8
  191. package/dist/EmbedFrame.d.ts +36 -0
  192. package/dist/EmbedFrame.js +18 -0
  193. package/dist/Field.d.ts +41 -4
  194. package/dist/Field.js +61 -25
  195. package/dist/FieldDialog.d.ts +8 -3
  196. package/dist/FieldDialog.js +19 -9
  197. package/dist/Fieldset.d.ts +3 -3
  198. package/dist/Fieldset.js +7 -9
  199. package/dist/FileDrop.js +2 -1
  200. package/dist/FlowDiagram.d.ts +92 -0
  201. package/dist/FlowDiagram.js +100 -0
  202. package/dist/FormRow.d.ts +6 -4
  203. package/dist/FormRow.js +11 -9
  204. package/dist/Hero.d.ts +30 -7
  205. package/dist/Hero.js +23 -9
  206. package/dist/Icon.d.ts +1 -1
  207. package/dist/Icon.js +1 -1
  208. package/dist/IconButton.js +1 -1
  209. package/dist/Image.d.ts +33 -9
  210. package/dist/Image.js +61 -16
  211. package/dist/Input.d.ts +1 -1
  212. package/dist/Input.js +4 -4
  213. package/dist/InputShell.d.ts +7 -0
  214. package/dist/InputShell.js +18 -3
  215. package/dist/KeyValueList.d.ts +2 -2
  216. package/dist/Lightbox.js +5 -3
  217. package/dist/ListRow.d.ts +4 -5
  218. package/dist/ListRow.js +36 -26
  219. package/dist/Mark.d.ts +10 -0
  220. package/dist/Mark.js +9 -0
  221. package/dist/Markdown.d.ts +18 -4
  222. package/dist/Markdown.js +176 -37
  223. package/dist/MediaTile.d.ts +9 -3
  224. package/dist/MediaTile.js +8 -4
  225. package/dist/Menu.d.ts +19 -8
  226. package/dist/Menu.js +13 -11
  227. package/dist/MetaList.d.ts +4 -3
  228. package/dist/MetaList.js +12 -4
  229. package/dist/Morph.d.ts +15 -1
  230. package/dist/Morph.js +70 -22
  231. package/dist/NavigationProgress.d.ts +2 -2
  232. package/dist/NavigationProgress.js +7 -5
  233. package/dist/NumberField.d.ts +66 -0
  234. package/dist/NumberField.js +68 -0
  235. package/dist/OutlineRegion.d.ts +41 -10
  236. package/dist/OutlineRegion.js +31 -6
  237. package/dist/PageFade.d.ts +9 -5
  238. package/dist/PageFade.js +39 -8
  239. package/dist/PageLayouts.d.ts +15 -5
  240. package/dist/PageLayouts.js +3 -3
  241. package/dist/Pill.d.ts +9 -4
  242. package/dist/Pill.js +15 -6
  243. package/dist/Popover.d.ts +31 -0
  244. package/dist/Popover.js +43 -0
  245. package/dist/Price.d.ts +21 -0
  246. package/dist/Price.js +34 -0
  247. package/dist/ProductTile.d.ts +36 -0
  248. package/dist/ProductTile.js +31 -0
  249. package/dist/ProgressBar.js +4 -2
  250. package/dist/PromoBanner.d.ts +25 -0
  251. package/dist/PromoBanner.js +16 -0
  252. package/dist/RadioGroup.d.ts +18 -8
  253. package/dist/RadioGroup.js +42 -18
  254. package/dist/ScrollStrip.d.ts +1 -1
  255. package/dist/ScrollStrip.js +1 -1
  256. package/dist/SearchInput.d.ts +17 -2
  257. package/dist/SearchInput.js +72 -13
  258. package/dist/SegmentedField.d.ts +15 -0
  259. package/dist/SegmentedField.js +15 -0
  260. package/dist/Select.js +5 -4
  261. package/dist/Show.d.ts +1 -1
  262. package/dist/Show.js +1 -1
  263. package/dist/SideColumn.d.ts +42 -15
  264. package/dist/SideColumn.js +45 -19
  265. package/dist/SiteFooter.d.ts +3 -3
  266. package/dist/SiteFooter.js +4 -3
  267. package/dist/SiteSearch.d.ts +57 -27
  268. package/dist/SiteSearch.js +13 -93
  269. package/dist/Slider.d.ts +27 -0
  270. package/dist/Slider.js +58 -0
  271. package/dist/SortableList.d.ts +19 -35
  272. package/dist/SortableList.js +36 -88
  273. package/dist/Stack.d.ts +4 -4
  274. package/dist/StackedBar.d.ts +13 -4
  275. package/dist/StackedBar.js +12 -7
  276. package/dist/StateMachine.d.ts +65 -0
  277. package/dist/StateMachine.js +113 -0
  278. package/dist/StatusPages.d.ts +28 -10
  279. package/dist/StatusPages.js +10 -10
  280. package/dist/Stepper.d.ts +21 -0
  281. package/dist/Stepper.js +33 -0
  282. package/dist/Steps.js +4 -3
  283. package/dist/Switch.d.ts +3 -3
  284. package/dist/Switch.js +18 -14
  285. package/dist/Table.d.ts +32 -9
  286. package/dist/Table.js +50 -20
  287. package/dist/TableCells.d.ts +24 -21
  288. package/dist/TableCells.js +68 -27
  289. package/dist/TableEditCell.d.ts +1 -1
  290. package/dist/TableOfContents.d.ts +34 -0
  291. package/dist/TableOfContents.js +23 -0
  292. package/dist/Tabs.d.ts +31 -16
  293. package/dist/Tabs.js +97 -22
  294. package/dist/TextLink.d.ts +18 -5
  295. package/dist/TextLink.js +19 -6
  296. package/dist/Textarea.d.ts +12 -1
  297. package/dist/Textarea.js +15 -2
  298. package/dist/ToastRegion.d.ts +17 -9
  299. package/dist/ToastRegion.js +70 -13
  300. package/dist/Tooltip.d.ts +10 -2
  301. package/dist/Tooltip.js +32 -11
  302. package/dist/Video.d.ts +19 -4
  303. package/dist/Video.js +15 -5
  304. package/dist/cardContext.d.ts +7 -0
  305. package/dist/cardContext.js +14 -0
  306. package/dist/cardControl.d.ts +15 -0
  307. package/dist/cardControl.js +32 -0
  308. package/dist/cardForm.d.ts +39 -0
  309. package/dist/cardForm.js +81 -0
  310. package/dist/cardWait.js +2 -1
  311. package/dist/colourScheme.d.ts +12 -2
  312. package/dist/colourScheme.js +32 -6
  313. package/dist/control.d.ts +30 -8
  314. package/dist/control.js +74 -7
  315. package/dist/copyScript.d.ts +7 -8
  316. package/dist/copyScript.js +8 -9
  317. package/dist/cx.d.ts +22 -3
  318. package/dist/cx.js +22 -3
  319. package/dist/dateLocale.d.ts +17 -0
  320. package/dist/dateLocale.js +30 -0
  321. package/dist/density.d.ts +15 -1
  322. package/dist/density.js +27 -8
  323. package/dist/emptySlot.d.ts +1 -0
  324. package/dist/fieldAnnounce.d.ts +11 -0
  325. package/dist/fieldAnnounce.js +36 -0
  326. package/dist/fieldControl.d.ts +7 -2
  327. package/dist/fieldControl.js +6 -2
  328. package/dist/fieldWait.d.ts +3 -3
  329. package/dist/fieldWait.js +3 -4
  330. package/dist/flowLayout.d.ts +68 -0
  331. package/dist/flowLayout.js +105 -0
  332. package/dist/fromXState.d.ts +73 -0
  333. package/dist/fromXState.js +110 -0
  334. package/dist/icons.d.ts +1 -1
  335. package/dist/icons.js +15 -0
  336. package/dist/index.d.ts +37 -11
  337. package/dist/index.js +24 -2
  338. package/dist/isoDate.d.ts +8 -1
  339. package/dist/isoDate.js +20 -1
  340. package/dist/labelWords.d.ts +16 -7
  341. package/dist/labelWords.js +14 -12
  342. package/dist/listRowProps.d.ts +17 -15
  343. package/dist/modal.d.ts +5 -0
  344. package/dist/modal.js +21 -1
  345. package/dist/navFold.js +6 -3
  346. package/dist/optionCard.d.ts +18 -0
  347. package/dist/optionCard.js +16 -0
  348. package/dist/scrollBody.d.ts +16 -0
  349. package/dist/scrollBody.js +15 -0
  350. package/dist/scrollEdges.d.ts +7 -0
  351. package/dist/scrollEdges.js +39 -5
  352. package/dist/scrollStop.d.ts +6 -2
  353. package/dist/scrollStop.js +24 -8
  354. package/dist/shownDate.d.ts +28 -10
  355. package/dist/shownDate.js +41 -22
  356. package/dist/siteSearchBody.d.ts +34 -0
  357. package/dist/siteSearchBody.js +117 -0
  358. package/dist/size.d.ts +7 -1
  359. package/dist/sortableDrop.d.ts +44 -0
  360. package/dist/sortableDrop.js +78 -0
  361. package/dist/sortableSlide.d.ts +9 -0
  362. package/dist/sortableSlide.js +70 -0
  363. package/dist/sortableTitle.d.ts +10 -0
  364. package/dist/sortableTitle.js +48 -0
  365. package/dist/stateMachineDots.d.ts +45 -0
  366. package/dist/stateMachineDots.js +162 -0
  367. package/dist/stickyColumn.d.ts +2 -2
  368. package/dist/stickyColumn.js +2 -2
  369. package/dist/switcher.d.ts +10 -5
  370. package/dist/switcher.js +7 -5
  371. package/dist/tableColumns.d.ts +17 -0
  372. package/dist/tableColumns.js +30 -2
  373. package/dist/tableEmpty.js +5 -5
  374. package/dist/tableRow.d.ts +26 -2
  375. package/dist/tableRow.js +23 -1
  376. package/dist/tableSort.d.ts +10 -5
  377. package/dist/tableSort.js +15 -4
  378. package/dist/target.d.ts +12 -0
  379. package/dist/target.js +12 -0
  380. package/dist/textBox.js +1 -1
  381. package/dist/truncated.d.ts +31 -0
  382. package/dist/truncated.js +51 -0
  383. package/dist/typography.d.ts +19 -11
  384. package/dist/typography.js +11 -13
  385. package/dist/useFlowLayout.d.ts +27 -0
  386. package/dist/useFlowLayout.js +119 -0
  387. package/package.json +7 -3
  388. package/skills/uislash/SKILL.md +20 -0
@@ -0,0 +1,139 @@
1
+ ## AppShell
2
+
3
+ Group: Layout
4
+
5
+ When to use: Every page of an app sits in one `AppShell`; it is the only place the page canvas, the font and the header live.
6
+
7
+ ### The one right way
8
+ `AppShellBrand` makes the logo and the label one link, so the whole brand is the way home; `collapse` leaves only the logo below `sm`.
9
+ ```tsx
10
+ import { Avatar, AppShellBrand } from "@slashsuite/ui-react";
11
+
12
+ <AppShellBrand href="#" logo={<Avatar name="Quotes" size="sm" />} label="Quotes" collapse />
13
+ ```
14
+
15
+ ### Do
16
+ - Fill the slots and write no wrapper: `brand`, `nav` (`Tabs` of links), `controls` (a picker, a `ColourSchemeToggle`), then an optional `subnav` row and `footer`.
17
+ - `brand` is an `AppShellBrand`: logo and label in one link. `collapse` leaves only the logo below `sm`. `logoSize` is `sm` (20px), `md` (24px, the default, an `Avatar size="sm"`) or `lg` (32px); an `<img>` or `<svg>` logo fills it.
18
+ - A header control that only matters on a wide screen, such as the viewer's name, goes in a `Show from="sm"` (or `md`, `lg`) in `controls`; put a `Cluster` inside it to keep an avatar and a name together.
19
+ - Header, main and footer each sit in a `Container`, so a page never sets its own width or padding.
20
+ - `controls` stay in the row at every width, so keep them few (a theme toggle, the viewer's avatar). Pickers and actions that do not fit a phone row go in `menuControls`: from `md` they sit at the row's end before `controls` and fold into the Menu with the `nav`, and below `md` they are at the foot of the Menu.
21
+ - `nav` and `subnav` fold into one Menu button below `md`, and the `nav` also from `md` whenever it does not fit the row, so a nav of any length stays reachable with no sideways scroll; `menuLabel` renames the button (`Menu` by default), for a translated app.
22
+ - Put `appShellRootClassFor(scheme)` on the app's own `<html>`. `AppShell` never touches `<html>`.
23
+ - A theme sets the canvas colour and the font, and the shell turns on font smoothing (`antialiased`); the app writes no page background, font or smoothing rule.
24
+
25
+ ### Don't
26
+ - Do not add a `Container` inside the shell.
27
+
28
+ A logo and a name as two separate links are two targets, and the logo link has no name. Put both in `AppShellBrand`.
29
+ ```tsx
30
+ import { Avatar, Cluster, TextLink } from "@slashsuite/ui-react";
31
+
32
+ <Cluster gap="xs">
33
+ <a href="#">
34
+ <Avatar name="Quotes" size="sm" />
35
+ </a>
36
+ <TextLink href="#">Quotes</TextLink>
37
+ </Cluster>
38
+ ```
39
+
40
+ A link written by hand round the logo and the label, navigating in its own click handler, is a wrapper per link with no brand focus ring. Set the router once on `LinkProvider` and give `AppShellBrand` its `href`.
41
+ ```tsx
42
+ import { Avatar, Cluster, Text } from "@slashsuite/ui-react";
43
+
44
+ <a
45
+ href="#/"
46
+ onClick={(event) => {
47
+ event.preventDefault();
48
+ history.pushState(null, "", "#/");
49
+ }}
50
+ >
51
+ <Cluster gap="xs">
52
+ <Avatar name="Quotes" size="sm" />
53
+ <Text as="span">Quotes</Text>
54
+ </Cluster>
55
+ </a>
56
+ ```
57
+
58
+ Shown at every width, the name pushes the nav and the toggle off a phone's header row.
59
+ ```tsx
60
+ import { Avatar, Cluster, Text } from "@slashsuite/ui-react";
61
+
62
+ <Cluster gap="xs">
63
+ <Avatar name="Ada Lovelace" size="sm" />
64
+ <Text>Ada Lovelace</Text>
65
+ </Cluster>
66
+ ```
67
+
68
+ A hand-written `scroll-margin` guesses the header's height and goes stale when a subnav or the notch changes it. Leave the offset to the shell.
69
+ ```tsx
70
+ import { Stack, Text, TextLink } from "@slashsuite/ui-react";
71
+
72
+ <Stack gap="sm">
73
+ <TextLink href="#plans">See pricing</TextLink>
74
+ <section id="plans" style={{ scrollMarginTop: 80 }}>
75
+ <Text strong>Pricing</Text>
76
+ <Text>Pay for what you review.</Text>
77
+ </section>
78
+ </Stack>
79
+ ```
80
+
81
+ ### Accessibility
82
+ - The header is a `<header>` (the banner landmark), main is `<main>` and the footer is `<footer>`.
83
+ - `AppShellBrand` is one link named by its `label`; the logo is `aria-hidden`. With `collapse` the label is visually hidden below `sm` and still names the link.
84
+ - On a phone `nav` and `subnav` sit behind one Menu button that opens the browser's own popover: it opens with no JavaScript, from the keyboard (Enter or Space) and for a screen reader, Escape or a click outside closes it and returns focus to the button, and following a link closes it. The panel is not in the header's flow, so the header is the same height on every page.
85
+ - `menuControls` render once, in the Menu below `md` and in the row from `md`, so a field keeps its value and its label names one control. The header's markup is in the order it shows, so Tab moves through it as the eye does. A crowded `controls` clips beside the Menu button, never over it, so the nav stays reachable.
86
+ - From `md` a `nav` too wide for the header row folds into the Menu instead of scrolling, and comes back when the screen is wide enough. A `subnav` row that is wider than the screen scrolls sideways and never wraps; a link that takes focus scrolls into view, and the side with more to reach fades out.
87
+ - Give `nav` and `subnav` `Tabs` of links, so each is a labelled `<nav>`.
88
+
89
+ ### Props
90
+ ### AppShell
91
+ The page frame: it paints the page canvas and sets the type face, ink and font smoothing (`antialiased`), so an app writes no page-background or font rule of its own (a theme remaps the canvas and the font stacks). A sticky one-row header, an optional second `subnav` row, the main area and an optional footer. Header, main and footer each sit in a `Container`, so pages never set their own width or padding. `bleed` drops main's Container (the header keeps its own), for a layout that needs the whole width (`FullBleedLayout`). Main is a flex column. `SidebarLayout` needs no `bleed`: its rail and canvas share the header's Container. The header row is laid out by its slots, left to right: `brand`, `nav`, then `header` (anything the slots do not cover), then `controls`, pushed to the end. An app writes no wrapper or styling for any of them: an item that only fits a wide screen goes in a `Show from`. A bar that sticks under the header as the page scrolls is a `StickyBar`. On a phone (below `md`) the header is one 56px row at every page: `brand`, `header`, `controls` and a "Menu" button (`menuLabel`), and `nav` and `subnav` move into that menu, so every link is reachable and nothing scrolls sideways. The menu is the browser's popover (`popovertarget`), so it works with the keyboard, closes on Escape and a click outside, hands focus back to the button, and opens on a page that never hydrates. From `md` the header is the row, and the `subnav` row, as they are, except that a `nav` too wide for the row folds into the Menu and comes back when the screen is wide enough (measured, with script; a `subnav` never folds, it scrolls sideways with a fade). The edges need nothing from the app: with `viewport-fit=cover` every Container clears the safe-area insets at the sides, the header the top one and the shell the bottom one; and an element with an `id` anywhere inside lands below the sticky header when a link or focus scrolls to it. `controls` stay in the row at every width, so keep them few (a theme toggle, the viewer's avatar); on a phone a crowded `controls` clips, and the Menu button is never the part cut off. Pickers and actions that do not fit a phone row go in `menuControls`: rendered once, from `md` they sit at the row's end, before `header` and `controls`, and fold into the Menu with a `nav` that does not fit; below `md` they are at the foot of the Menu, after `nav` and `subnav`. The markup is in the order the row shows, so the focus moves as the eye does.
92
+ - bleed: boolean (default false). Main without a Container, for a full-bleed layout.
93
+
94
+ For a layout that needs the whole width, such as `FullBleedLayout`; `SidebarLayout` needs no
95
+ `bleed`.
96
+ - brand: ReactNode. The brand: a logo and a name, in the header's brand type, with the gap between them. `AppShellBrand` makes both one link.
97
+ - controls: ReactNode. The end of the row: a picker, a theme toggle. Gap-2, vertically centred; no child shrinks, and a full-width control (a `Select` at its default) sizes to its content.
98
+ - density: "compact". The app's type step, set once here and nowhere else: `compact` sets text, headings and controls
99
+ one step down everywhere inside, for an app's dense chrome. Left out, text is 16px, as a site's.
100
+ - footer: ReactNode. The page footer: small muted text in a `Container`, under a hairline. Hidden in print with `printChrome={false}`.
101
+ - header: ReactNode. The escape hatch: a free node in the header row, after `brand` and `nav`.
102
+
103
+ Only for a node no other slot covers: prefer `brand`, `nav` and `controls`.
104
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
105
+ - menuControls: ReactNode. Pickers and actions that do not fit a phone row, such as a project `Select` and a Sign out
106
+ `Button`. From `md` they sit at the row's end, before `header` and `controls`, and fold into the
107
+ Menu with the `nav`; below `md` they are at the foot of the Menu, after `nav` and `subnav`.
108
+ Rendered once, so a field keeps its state and ids stay unique.
109
+ `controls` stay in the row at every width, so keep those few.
110
+ - menuLabel: string (default Menu). The phone menu button's name, for an app in another language. Only drawn below `md`, and only
111
+ when `nav`, `subnav` or `menuControls` is given.
112
+ - nav: ReactNode. The main navigation, e.g. a `Tabs` of links (it is already a `<nav>`). Below `md` it is in the menu.
113
+ - printChrome: boolean (default true). Whether a print shows the header and footer. `false` prints only the page: the header and
114
+ footer are hidden, and main's Container drops its padding (the page margin is then `@page`'s).
115
+
116
+ The screen is unchanged.
117
+ - skipLabel: string (default Skip to content). The skip link's words, for an app in another language. The link is the page's first tab stop,
118
+ hidden until it has the focus, and moves the focus past the header to the main area.
119
+ - subnav: ReactNode. A second fixed-height row under the header from `md`, e.g. a `Tabs` of links. Below `md` it is in the menu with `nav`.
120
+
121
+ ### AppShellBrand
122
+ The `brand` slot as one link: a logo and a label inside the same `<a>`, so the whole brand is the way home. The label names the link; the logo is decoration and hidden from assistive tech. `collapse` shows only the logo below `sm`, the label staying in the accessible name. An in-app `href` is drawn by the app's router link through `LinkProvider`.
123
+ - collapse: boolean (default false). Below `sm` only the logo shows; the label is visually hidden and still names the link. Needs a `logo`.
124
+ - href: string (required). Where the brand links, usually the app's home (`/`).
125
+
126
+ With a router it goes through the app's `LinkProvider`, like every link.
127
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
128
+ - label: ReactNode (required). The name beside the logo. It is the link's accessible name.
129
+ - logo: ReactNode. The mark before the label, e.g. an `Avatar` or an `<img>`.
130
+ - logoSize: "sm" | "md" | "lg" (default md). The logo slot's box: sm 20px, md 24px (the default, an `Avatar size="sm"`), lg 32px. An `<img>` or `<svg>` logo fills it.
131
+
132
+ ### Types
133
+ - AppShellDensity: `"compact"`. The type step an app sets once on its `AppShell`: `compact` is one step down for the whole app.
134
+
135
+ ### Functions
136
+ - appShellRootClassFor: `appShellRootClassFor(scheme: ColourScheme, schemes?: ColourSchemeClasses): string`. Everything the app's `<html>` takes from the scheme the server knows: that scheme's class and the class that always reserves the scrollbar, so centred content does not shift between a short page and a long one.
137
+ ```tsx
138
+ <html className={appShellRootClassFor(scheme, schemes)}>
139
+ ```
@@ -0,0 +1,140 @@
1
+ ## ArticleLayout
2
+
3
+ Group: Page layouts
4
+
5
+ When to use: A blog post, a news item or a recipe: writing with an author and a date.
6
+
7
+ ### The one right way
8
+ A blog post is an `ArticleLayout`: the byline, the picture and the related posts each have their place.
9
+ ```tsx
10
+ import { ArticleLayout, Card, Image, SectionHeading, Text } from "@slashsuite/ui-react";
11
+
12
+ <ArticleLayout
13
+ title="Brewing a pale ale at home"
14
+ description="Everything you need for a first brew, and what to do on the day."
15
+ author="Sam Mokoena"
16
+ date="12 November 2026"
17
+ dateTime="2026-11-12"
18
+ readingTime="6 min read"
19
+ image={
20
+ <Image
21
+ src={sampleScenes[0]?.src}
22
+ alt="A brew kettle on the stove"
23
+ aspect="16:9"
24
+ width="full"
25
+ />
26
+ }
27
+ related={["Stout in a weekend", "Dry hopping, step by step", "Your first lager"].map(
28
+ (title) => (
29
+ <Card key={title} title={title}>
30
+ <Text>A recipe and the kit that brews it.</Text>
31
+ </Card>
32
+ ),
33
+ )}
34
+ >
35
+ <SectionHeading>What you need</SectionHeading>
36
+ <Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
37
+ <SectionHeading>On the day</SectionHeading>
38
+ <Text>Heat the water to 67°C, stir in the grain and hold it there for an hour.</Text>
39
+ </ArticleLayout>
40
+ ```
41
+
42
+ ### Full page
43
+ A whole blog post: the shell with its brand and nav, then the article and its related posts.
44
+ ```tsx
45
+ import {
46
+ AppShell,
47
+ ArticleLayout,
48
+ Card,
49
+ Image,
50
+ SectionHeading,
51
+ Tabs,
52
+ Text,
53
+ } from "@slashsuite/ui-react";
54
+
55
+ <AppShell
56
+ brand={<a href="#">Hack Cove</a>}
57
+ nav={
58
+ <Tabs
59
+ label="Main"
60
+ items={[
61
+ { label: "Shop", href: "#shop" },
62
+ { label: "Blog", href: "#blog", selected: true },
63
+ ]}
64
+ />
65
+ }
66
+ >
67
+ <ArticleLayout
68
+ title="Brewing a pale ale at home"
69
+ description="Everything you need for a first brew, and what to do on the day."
70
+ author="Sam Mokoena"
71
+ date="12 November 2026"
72
+ dateTime="2026-11-12"
73
+ readingTime="6 min read"
74
+ image={
75
+ <Image
76
+ src={sampleScenes[0]?.src}
77
+ alt="A brew kettle on the stove"
78
+ aspect="16:9"
79
+ width="full"
80
+ />
81
+ }
82
+ related={["Stout in a weekend", "Dry hopping, step by step", "Your first lager"].map(
83
+ (title) => (
84
+ <Card key={title} title={title}>
85
+ <Text>A recipe and the kit that brews it.</Text>
86
+ </Card>
87
+ ),
88
+ )}
89
+ >
90
+ <SectionHeading>What you need</SectionHeading>
91
+ <Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
92
+ <SectionHeading>On the day</SectionHeading>
93
+ <Text>Heat the water to 67°C, stir in the grain and hold it there for an hour.</Text>
94
+ </ArticleLayout>
95
+ </AppShell>
96
+ ```
97
+
98
+ ### Do
99
+ - The body is the `children`: `Prose`, or `SectionHeading`s and `Text` paragraphs, spaced `md` apart.
100
+ - `author`, `date` and `readingTime` make the byline under the lede. Pass `dateTime` (`2026-11-12`) with `date` so it is a `<time>`; the app works out the reading time.
101
+ - `image` is the lead picture: an `Image` at `width="full"`.
102
+ - `related` is a `.map` of `Card`s or `ProductTile`s, three to a row under "More like this"; `relatedTitle` names it another way.
103
+ - A page of text with no author or date (privacy, terms, help) is a `ProseLayout`.
104
+
105
+ ### Don't
106
+ A `ProseLayout` with a hand-made byline and no related posts: the date is a loose caption, nobody wrote it, and the reader is left at a dead end.
107
+ ```tsx
108
+ import { Caption, ProseLayout, SectionHeading, Text } from "@slashsuite/ui-react";
109
+
110
+ <ProseLayout title="Brewing a pale ale at home">
111
+ <Caption>12 November 2026</Caption>
112
+ <SectionHeading>What you need</SectionHeading>
113
+ <Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
114
+ </ProseLayout>
115
+ ```
116
+
117
+ ### Accessibility
118
+ - The article is an `<article>` and its title the page's `h1`.
119
+ - The related posts are a `section` named by their heading, and a list of cards.
120
+ - `data-*` and `aria-*` go on the page's wrapper.
121
+
122
+ ### Props
123
+ ### ArticleLayout
124
+ A blog article: the title (the page's `h1`) and its lede, a byline of the author, the date and the reading time in muted text, the lead picture, the body, and a "More like this" row of cards at the foot. The article sits in the reading column (`max-w-3xl`) at the Container's start edge, and the related cards take the Container's whole width under it. The date is a `<time>` when `dateTime` says which day it is. Every part but the title is optional. While `loading` it owns the wait and passes it to everything inside, the header too.
125
+ - author: ReactNode. Who wrote it: a name, or a `TextLink` to their page.
126
+ - breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
127
+ - children: ReactNode. The article itself: `Prose`, or `SectionHeading`s and `Text` paragraphs, spaced `md` apart.
128
+ - date: string. When it was published, as the reader reads it: "12 November 2026".
129
+ - dateTime: string. The same day as an ISO date (`2026-11-12`), for the `<time>` a machine reads.
130
+ - description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
131
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
132
+ - image: ReactNode. The lead picture under the byline: an `Image` at `width="full"`.
133
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
134
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
135
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
136
+ - readingTime: string. How long it takes to read, worked out by the app: "6 min read".
137
+ - related: ReactNode. The cards at the foot under "More like this", three to a row from `lg`: a `.map` of `Card`s or
138
+ `ProductTile`s. Left out, there is no foot.
139
+ - relatedTitle: string (default More like this). The heading over `related`, for an app in another language or another word ("Recipes for this kit").
140
+ - title: ReactNode (required). The page's `h1`.
@@ -0,0 +1,42 @@
1
+ ## Audio
2
+
3
+ Group: Content
4
+
5
+ When to use: Playing a voice note, a recording or a clip that your app serves.
6
+
7
+ ### Use instead
8
+ - Video (video.md): The recording has pictures: the video player.
9
+
10
+ ### The one right way
11
+ `label` names the player, since a voice note has no visible title; `children` is the text for a browser that cannot play it.
12
+ ```tsx
13
+ import { Audio } from "@slashsuite/ui-react";
14
+
15
+ <Audio src="/media/voice-note.ogg" label="Voice note from Anna, 0:14">
16
+ Your browser cannot play audio.
17
+ </Audio>
18
+ ```
19
+
20
+ ### Do
21
+ - `src` is your own audio file. It loads only the metadata until it is played, and lazily where the browser can.
22
+ - `label` names the player, as "Voice note from Anna, 0:14": a clip has no visible title, so say what it is and how long.
23
+ - The player is full width up to 20rem, one size everywhere: set it in a `Stack` or a `Card`.
24
+ - The children are the text for a browser that cannot play the file.
25
+
26
+ ### Don't
27
+ A bare `<audio>` has no name, loads the whole file up front and takes whatever size the browser picks.
28
+ ```tsx
29
+ <audio src="/media/voice-note.ogg" controls />
30
+
31
+ ```
32
+
33
+ ### Accessibility
34
+ - A native `<audio controls>` named by `label`: play, seek and volume work by keyboard through the browser's controls.
35
+ - Speech in a clip that matters needs a transcript beside it, in the text of the page.
36
+
37
+ ### Props
38
+ ### Audio
39
+ An `<audio>` with the browser's own controls, at one fixed size: 20rem wide, narrower only when its column is. It loads metadata only, and lazily where the browser can, so the page does not pull the file until it is played. A voice note or a clip has no visible title, so `label` names the player. `src` is the app's own file; `children` is the fallback for a browser that cannot play it.
40
+ - children: ReactNode. The text for a browser that cannot play it.
41
+ - label: string (required). Names the player for a screen reader, as "Voice note from Anna": audio has no visible title.
42
+ - src: string (required). The audio file, the app's own.
@@ -0,0 +1,64 @@
1
+ ## AvatarStack
2
+
3
+ Group: Content
4
+
5
+ When to use: Who is in something (a team, the reviewers, the people on a page) where one row says it.
6
+
7
+ ### The one right way
8
+ With many people, `max` keeps the row short and the "+N" says how many more there are.
9
+ ```tsx
10
+ import { AvatarStack } from "@slashsuite/ui-react";
11
+
12
+ <AvatarStack
13
+ items={[
14
+ { name: "Ada Lovelace" },
15
+ { name: "Grace Hopper" },
16
+ { name: "Linus Torvalds" },
17
+ { name: "Margaret Hamilton" },
18
+ { name: "Dennis Ritchie" },
19
+ { name: "Ken Thompson" },
20
+ ]}
21
+ max={4}
22
+ />
23
+ ```
24
+
25
+ ### Do
26
+ - Pass `items`, each with the full `name` and an optional local `src`, as for `Avatar`.
27
+ - Each avatar overlaps the one before it, in a ring in the page colour that keeps them apart. Draw no ring or overlap of your own.
28
+ - `max` shows the first `max` and a "+N" chip of the same size and shape for the rest; leave it off to show everyone.
29
+ - `size` and `shape` are `Avatar`'s and apply to every avatar and the chip: `square` for a stack of orgs or teams.
30
+
31
+ ### Don't
32
+ Avatars side by side are a row of separate marks: they take the width of the whole team and read as a list, not a group.
33
+ ```tsx
34
+ import { Avatar, Cluster } from "@slashsuite/ui-react";
35
+
36
+ <Cluster gap="xs">
37
+ <Avatar name="Ada Lovelace" />
38
+ <Avatar name="Grace Hopper" />
39
+ <Avatar name="Linus Torvalds" />
40
+ <Avatar name="Margaret Hamilton" />
41
+ <Avatar name="Dennis Ritchie" />
42
+ <Avatar name="Ken Thompson" />
43
+ </Cluster>
44
+ ```
45
+
46
+ ### Accessibility
47
+ - The stack is one `role="img"` named by the people in it ("Ada Lovelace, Grace Hopper and 3 more"); the avatars inside are hidden from a screen reader.
48
+ - The +N chip is hidden from a screen reader (the name already counts the rest) and its `title` lists who it stands for.
49
+ - `aria-*` and `data-*` props go on the root element.
50
+
51
+ ### Props
52
+ ### AvatarStack
53
+ Members as a row of overlapping avatars, each in a ring in the page colour that separates it from the next. With `max`, the first `max` show and a "+N" chip of the same size and shape stands for the rest. The row is one image to assistive tech, named by the people in it. While `loading` with no `items` yet it draws three avatar bones.
54
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
55
+ - items: readonly AvatarStackPerson[] (required). Who is in the stack, in order. Give each person's full name, as for `Avatar`.
56
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
57
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
58
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
59
+ - max: number. How many avatars show before a "+N" chip takes the rest. Without it every person shows.
60
+ - shape: "round" | "square" (default round). `square` for a stack of orgs or teams, as `Avatar`'s `shape`.
61
+ - size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | "3xl" (default md). The size of every avatar and of the chip, as `Avatar`'s `size`.
62
+
63
+ ### Types
64
+ - AvatarStackPerson: `{ name: string; src?: string }`. One member of an `AvatarStack`: the same `name` and optional local `src` an `Avatar` takes.
@@ -0,0 +1,76 @@
1
+ ## Avatar
2
+
3
+ Group: Content
4
+
5
+ When to use: Marking who did something or who owns something, next to their name.
6
+
7
+ ### Use instead
8
+ - Image (image.md): The picture is not a person: a photo, a screenshot or an illustration.
9
+
10
+ ### The one right way
11
+ Give the person's full name every time: the same name gets the same colour and initials in every list and header.
12
+ ```tsx
13
+ import { Avatar, Cluster } from "@slashsuite/ui-react";
14
+
15
+ <Cluster>
16
+ <Avatar name="Ada Lovelace" />
17
+ <Avatar name="Ada Lovelace" size="lg" />
18
+ <Avatar name="Grace Hopper" />
19
+ </Cluster>
20
+ ```
21
+
22
+ ### Do
23
+ - Pass the person's full `name`, the same string everywhere: the colour and the initials are worked out from it, so one person looks the same in every list and header.
24
+ - `size` is `xs` (16px, for an inline mention in a line of text), `sm`, `md` (default), `lg`, `xl`, `2xl` (64px) or `3xl` (96px); use `sm` or `md` in a row and a larger one at the head of a profile.
25
+ - `src` is the person's photo, as a path your app serves. It replaces the initials, and the Avatar never loads an image from another server on its own, so use your own local image. If the photo fails to load, the initials show instead.
26
+ - `shape="square"` is for an org, a team or a project, not a person: rounded corners that scale with the size. Round (the default) is a person.
27
+ - `onClick` makes the whole Avatar one button, for a profile or an account menu: it is named by `name`, keeps its shape and takes the focus ring. Without it the Avatar is a mark, and a click handler on it would be one no keyboard can reach.
28
+ - Several people as one group is an `AvatarStack`, not a row of Avatars.
29
+ - Put the person's name beside the Avatar as text; the Avatar is a mark, not a label.
30
+
31
+ ### Don't
32
+ The colour comes from the name, so "Ada" in one place and "A. Lovelace" in another read as two different people.
33
+ ```tsx
34
+ import { Avatar, Cluster } from "@slashsuite/ui-react";
35
+
36
+ <Cluster>
37
+ <Avatar name="Ada" />
38
+ <Avatar name="A. Lovelace" />
39
+ </Cluster>
40
+ ```
41
+
42
+ An initials Avatar on its own is `aria-hidden`: it names no one to a screen reader. Put the name beside it.
43
+ ```tsx
44
+ import { Avatar } from "@slashsuite/ui-react";
45
+
46
+ <Avatar name="Ada Lovelace" />
47
+
48
+ ```
49
+
50
+ ### Accessibility
51
+ - Initials are drawn in a `<span>` with `aria-hidden="true"` and a `title` of the name, so a screen reader skips them: the name has to be on the page as text.
52
+ - With `src` the Avatar is an `<img>` whose `alt` and `title` are the name.
53
+ - With `onClick` the Avatar is a `<button type="button">` whose `aria-label` is the name, so the initials need no text beside them to name the button. `onError` still reports a photo that fails to load while the page is live, and the initials take its place; a photo that already failed before the page hydrated shows the initials too, without calling `onError`.
54
+ - `aria-*` and `data-*` props go on the root element.
55
+
56
+ ### Props
57
+ ### Avatar
58
+ A person as a round badge of initials, or as their photo when `src` is given; `shape="square"` marks an org or a team instead. It never loads a remote image on its own: that is a request to another server for decoration, and it makes a screenshot depend on the network. `src` is the app's own local path. With `onClick` the whole Avatar is one button, with `href` one link. A row of overlapping avatars is an `AvatarStack`. While `loading` with an empty `name` it is a bone of its size and shape.
59
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
60
+ - href: string. Makes the Avatar one link, named by `name`; an in-app path goes through `LinkProvider`.
61
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
62
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
63
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
64
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
65
+ - name: string (required). Whose avatar: its initials, its colour (a hash of the name) and its title or `alt`.
66
+ - onClick: MouseEventHandler<HTMLButtonElement>. Makes the Avatar one button, named by `name`: a person who opens their profile or a menu.
67
+ Without it (or `href`) the Avatar is a plain mark.
68
+ - shape: "round" | "square" (default round). `round` for a person; `square` (rounded corners) for an org or a team, so the two never read
69
+ as each other.
70
+ - size: "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | "3xl" (default md). `xs` 16px, `sm` 24px, `md` 32px, `lg` 40px, `xl` 56px, `2xl` 64px or `3xl` 96px.
71
+ - src: string. The person's photo, a local path. It replaces the initials and is announced as `name`. If it
72
+ fails to load, the initials show instead.
73
+
74
+ ### Types
75
+ - AvatarShape: `"round" | "square"`. `round` for a person, `square` (rounded corners that grow with the size) for an org or a team.
76
+ - AvatarSize: `"sm" | "md" | "lg" | "xs" | "xl" | "2xl" | "3xl"`. An Avatar's size: `xs` 16px, `sm` 24px, `md` 32px, `lg` 40px, `xl` 56px, `2xl` 64px, `3xl` 96px.
@@ -0,0 +1,62 @@
1
+ ## Badge
2
+
3
+ Group: Content
4
+
5
+ When to use: A count of unread or pending things that sits on an icon button.
6
+
7
+ ### Use instead
8
+ - Pill (pill.md): The label is words, such as a status.
9
+
10
+ ### The one right way
11
+ `count` on an `IconButton` pins the count to the corner and adds it to the button's name ("Alerts, 3").
12
+ ```tsx
13
+ import { IconButton } from "@slashsuite/ui-react";
14
+
15
+ <IconButton label="Alerts" count={3} icon="bell" />
16
+
17
+ ```
18
+
19
+ ### Do
20
+ - On an icon, give the `IconButton` a `count`; it pins the Badge to the corner and puts the count in the button's name.
21
+ - A `count` above 99 reads `99+`.
22
+ - Show a Badge only when there is something to count: a `count` of 0 still draws a `0`, so leave it out instead.
23
+ - A tinted label with words in it is a `Pill`, not a Badge.
24
+
25
+ ### Don't
26
+ A Pill beside the button is not pinned to it and a screen reader never hears it as part of the button. Use `count`.
27
+ ```tsx
28
+ import { Cluster, IconButton, Pill } from "@slashsuite/ui-react";
29
+
30
+ <Cluster>
31
+ <IconButton label="Alerts" icon="bell" />
32
+ <Pill tone="danger" round>
33
+ 3
34
+ </Pill>
35
+ </Cluster>
36
+ ```
37
+
38
+ A count is not a `Pill`: a Pill is a status label, and it prints `120` where a Badge caps at `99+`.
39
+ ```tsx
40
+ import { Cluster, Pill } from "@slashsuite/ui-react";
41
+
42
+ <Cluster>
43
+ <Pill>7</Pill>
44
+ <Pill>120</Pill>
45
+ </Cluster>
46
+ ```
47
+
48
+ ### Accessibility
49
+ - A Badge is a `<span>` with the number as its text.
50
+ - Inside an `IconButton`, the Badge is `aria-hidden` and the count is part of the button's `aria-label` and `title` ("Alerts, 3"), so it is announced once.
51
+ - `corner` pins the Badge to its nearest positioned parent; `IconButton` already provides one.
52
+ - It is sized in `rem` with a minimum height, so it grows with the reader's text size and the number never spills out.
53
+
54
+ ### Props
55
+ ### Badge
56
+ A small red count, 10px, for sitting on an icon. Its size is in rem and its height grows with its line, so it scales with the reader's text size instead of clipping. An icon with a count is an `IconButton` with its `count`, which pins the Badge to its corner and puts the count in the button's name. A count above 99 reads `99+`. While `loading` it is a bone of its size: a count is a number, so 0 is a value and not a gap.
57
+ - corner: boolean (default false). Pin it to the top corner at the end edge of its `relative` parent, over the icon.
58
+ - count: number (required). The number shown; above 99 it reads `99+`.
59
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
60
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
61
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
62
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.