@primecoderin/fast-ui-react 0.0.0-stage → 0.1.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 (354) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE +21 -0
  3. package/README.md +180 -3
  4. package/dist/_virtual/_rolldown/runtime.js +12 -0
  5. package/dist/charts.d.ts +7 -0
  6. package/dist/charts.js +7 -0
  7. package/dist/components/Avatar/Avatar.d.ts +12 -0
  8. package/dist/components/Avatar/Avatar.js +92 -0
  9. package/dist/components/Button/Button.d.ts +44 -0
  10. package/dist/components/Button/Button.js +221 -0
  11. package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
  12. package/dist/components/Checkbox/CheckboxBox.js +148 -0
  13. package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
  14. package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
  15. package/dist/components/Collapsible/Collapsible.d.ts +20 -0
  16. package/dist/components/Collapsible/Collapsible.js +97 -0
  17. package/dist/components/Container/Container.d.ts +301 -0
  18. package/dist/components/Container/Container.js +20 -0
  19. package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
  20. package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
  21. package/dist/components/Grid/Grid.d.ts +311 -0
  22. package/dist/components/Grid/Grid.js +30 -0
  23. package/dist/components/IconTile/IconTile.d.ts +12 -0
  24. package/dist/components/IconTile/IconTile.js +70 -0
  25. package/dist/components/InlineError/InlineError.d.ts +9 -0
  26. package/dist/components/InlineError/InlineError.js +62 -0
  27. package/dist/components/Kbd/Kbd.d.ts +11 -0
  28. package/dist/components/Kbd/Kbd.js +31 -0
  29. package/dist/components/Link/Link.d.ts +18 -0
  30. package/dist/components/Link/Link.js +68 -0
  31. package/dist/components/Menu/ContextMenu.d.ts +18 -0
  32. package/dist/components/Menu/ContextMenu.js +68 -0
  33. package/dist/components/Menu/Menu.d.ts +86 -0
  34. package/dist/components/Menu/Menu.js +394 -0
  35. package/dist/components/OtpInput/OtpInput.d.ts +32 -0
  36. package/dist/components/OtpInput/OtpInput.js +177 -0
  37. package/dist/components/Popover/HoverPopover.d.ts +22 -0
  38. package/dist/components/Popover/HoverPopover.js +74 -0
  39. package/dist/components/Popover/Popover.d.ts +21 -0
  40. package/dist/components/Popover/Popover.js +64 -0
  41. package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
  42. package/dist/components/ProgressBar/ProgressBar.js +44 -0
  43. package/dist/components/Rating/Rating.d.ts +49 -0
  44. package/dist/components/Rating/Rating.js +241 -0
  45. package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
  46. package/dist/components/ScrollArea/ScrollArea.js +90 -0
  47. package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
  48. package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
  49. package/dist/components/Separator/Separator.d.ts +9 -0
  50. package/dist/components/Separator/Separator.js +34 -0
  51. package/dist/components/Skeleton/Skeleton.d.ts +31 -0
  52. package/dist/components/Skeleton/Skeleton.js +152 -0
  53. package/dist/components/Slider/Slider.d.ts +54 -0
  54. package/dist/components/Slider/Slider.js +178 -0
  55. package/dist/components/Spinner/Spinner.d.ts +17 -0
  56. package/dist/components/Spinner/Spinner.js +118 -0
  57. package/dist/components/Stack/Stack.d.ts +302 -0
  58. package/dist/components/Stack/Stack.js +14 -0
  59. package/dist/components/StateIcon/StateIcon.d.ts +11 -0
  60. package/dist/components/StateIcon/StateIcon.js +65 -0
  61. package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
  62. package/dist/components/StatusBadge/StatusBadge.js +82 -0
  63. package/dist/components/Tabs/Tabs.d.ts +28 -0
  64. package/dist/components/Tabs/Tabs.js +109 -0
  65. package/dist/components/Tag/Tag.d.ts +11 -0
  66. package/dist/components/Tag/Tag.js +66 -0
  67. package/dist/components/Toast/AppToaster.d.ts +8 -0
  68. package/dist/components/Toast/AppToaster.js +135 -0
  69. package/dist/components/Toast/toast-manager.d.ts +28 -0
  70. package/dist/components/Toast/toast-manager.js +47 -0
  71. package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
  72. package/dist/components/ToggleButton/ToggleButton.js +106 -0
  73. package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
  74. package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
  75. package/dist/components/Tooltip/Tooltip.d.ts +16 -0
  76. package/dist/components/Tooltip/Tooltip.js +58 -0
  77. package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
  78. package/dist/components/Tooltip/TooltipGroup.js +65 -0
  79. package/dist/components/Typography/Typography.d.ts +17 -0
  80. package/dist/components/Typography/Typography.js +100 -0
  81. package/dist/editor-forms.d.ts +1 -0
  82. package/dist/editor-forms.js +1 -0
  83. package/dist/editor.d.ts +1 -0
  84. package/dist/editor.js +1 -0
  85. package/dist/fonts/LICENSE +93 -0
  86. package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
  87. package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
  88. package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
  89. package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
  90. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  91. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  92. package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
  93. package/dist/fonts.css +69 -0
  94. package/dist/forms.d.ts +22 -0
  95. package/dist/forms.js +23 -0
  96. package/dist/foundation.css +23 -0
  97. package/dist/global.css +116 -0
  98. package/dist/hooks/useAppToast.d.ts +12 -0
  99. package/dist/hooks/useAppToast.js +29 -0
  100. package/dist/icons/icons.d.ts +43 -0
  101. package/dist/icons/icons.js +44 -0
  102. package/dist/index.d.ts +106 -0
  103. package/dist/index.js +101 -0
  104. package/dist/patterns/Accordion/Accordion.d.ts +35 -0
  105. package/dist/patterns/Accordion/Accordion.js +139 -0
  106. package/dist/patterns/Alert/Alert.d.ts +38 -0
  107. package/dist/patterns/Alert/Alert.js +151 -0
  108. package/dist/patterns/AppShell/AppShell.d.ts +39 -0
  109. package/dist/patterns/AppShell/AppShell.js +218 -0
  110. package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
  111. package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
  112. package/dist/patterns/Calendar/Calendar.d.ts +59 -0
  113. package/dist/patterns/Calendar/Calendar.js +283 -0
  114. package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
  115. package/dist/patterns/Calendar/DateRangePicker.js +266 -0
  116. package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
  117. package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
  118. package/dist/patterns/Card/Card.d.ts +26 -0
  119. package/dist/patterns/Card/Card.js +125 -0
  120. package/dist/patterns/Carousel/Carousel.d.ts +33 -0
  121. package/dist/patterns/Carousel/Carousel.js +127 -0
  122. package/dist/patterns/Cascader/Cascader.d.ts +53 -0
  123. package/dist/patterns/Cascader/Cascader.js +371 -0
  124. package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
  125. package/dist/patterns/Cascader/FormCascaderField.js +130 -0
  126. package/dist/patterns/Charts/AreaChart.d.ts +13 -0
  127. package/dist/patterns/Charts/AreaChart.js +220 -0
  128. package/dist/patterns/Charts/BarChart.d.ts +11 -0
  129. package/dist/patterns/Charts/BarChart.js +220 -0
  130. package/dist/patterns/Charts/DonutChart.d.ts +37 -0
  131. package/dist/patterns/Charts/DonutChart.js +215 -0
  132. package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
  133. package/dist/patterns/Charts/GaugeChart.js +210 -0
  134. package/dist/patterns/Charts/LineChart.d.ts +14 -0
  135. package/dist/patterns/Charts/LineChart.js +222 -0
  136. package/dist/patterns/Charts/Sparkline.d.ts +24 -0
  137. package/dist/patterns/Charts/Sparkline.js +81 -0
  138. package/dist/patterns/Charts/chart-parts.d.ts +139 -0
  139. package/dist/patterns/Charts/chart-parts.js +385 -0
  140. package/dist/patterns/Charts/gauge-math.d.ts +20 -0
  141. package/dist/patterns/Charts/gauge-math.js +21 -0
  142. package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
  143. package/dist/patterns/Charts/sparkline-path.js +24 -0
  144. package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
  145. package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
  146. package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
  147. package/dist/patterns/ColorPicker/FormColorField.js +130 -0
  148. package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
  149. package/dist/patterns/ColorPicker/color-value.js +72 -0
  150. package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
  151. package/dist/patterns/Combobox/Autocomplete.js +158 -0
  152. package/dist/patterns/Combobox/Combobox.d.ts +52 -0
  153. package/dist/patterns/Combobox/Combobox.js +195 -0
  154. package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
  155. package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
  156. package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
  157. package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
  158. package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
  159. package/dist/patterns/Combobox/FormComboboxField.js +119 -0
  160. package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
  161. package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
  162. package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
  163. package/dist/patterns/Combobox/MultiSelect.js +175 -0
  164. package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
  165. package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
  166. package/dist/patterns/DataTable/DataTable.d.ts +107 -0
  167. package/dist/patterns/DataTable/DataTable.js +364 -0
  168. package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
  169. package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
  170. package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
  171. package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
  172. package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
  173. package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
  174. package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
  175. package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
  176. package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
  177. package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
  178. package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
  179. package/dist/patterns/DateTimePicker/picker-values.js +194 -0
  180. package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
  181. package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
  182. package/dist/patterns/Dialog/Dialog.d.ts +26 -0
  183. package/dist/patterns/Dialog/Dialog.js +212 -0
  184. package/dist/patterns/Drawer/Drawer.d.ts +33 -0
  185. package/dist/patterns/Drawer/Drawer.js +153 -0
  186. package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
  187. package/dist/patterns/EmptyState/EmptyState.js +44 -0
  188. package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
  189. package/dist/patterns/FileUpload/FileUpload.js +417 -0
  190. package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
  191. package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
  192. package/dist/patterns/FileUpload/add-files.d.ts +26 -0
  193. package/dist/patterns/FileUpload/add-files.js +35 -0
  194. package/dist/patterns/FileUpload/file-size.d.ts +14 -0
  195. package/dist/patterns/FileUpload/file-size.js +44 -0
  196. package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
  197. package/dist/patterns/FormField/CheckboxField.js +97 -0
  198. package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
  199. package/dist/patterns/FormField/FieldFrame.js +257 -0
  200. package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
  201. package/dist/patterns/FormField/FormCheckboxField.js +92 -0
  202. package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
  203. package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
  204. package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
  205. package/dist/patterns/FormField/FormRatingField.js +119 -0
  206. package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
  207. package/dist/patterns/FormField/FormSelectField.js +91 -0
  208. package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
  209. package/dist/patterns/FormField/FormSliderField.js +128 -0
  210. package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
  211. package/dist/patterns/FormField/FormSwitchField.js +88 -0
  212. package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
  213. package/dist/patterns/FormField/FormTextAreaField.js +91 -0
  214. package/dist/patterns/FormField/FormTextField.d.ts +23 -0
  215. package/dist/patterns/FormField/FormTextField.js +103 -0
  216. package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
  217. package/dist/patterns/FormField/RadioGroupField.js +201 -0
  218. package/dist/patterns/FormField/SelectField.d.ts +43 -0
  219. package/dist/patterns/FormField/SelectField.js +211 -0
  220. package/dist/patterns/FormField/SwitchField.d.ts +27 -0
  221. package/dist/patterns/FormField/SwitchField.js +105 -0
  222. package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
  223. package/dist/patterns/FormField/TextAreaField.js +134 -0
  224. package/dist/patterns/FormField/TextField.d.ts +51 -0
  225. package/dist/patterns/FormField/TextField.js +256 -0
  226. package/dist/patterns/FormField/error-message.d.ts +6 -0
  227. package/dist/patterns/FormField/error-message.js +8 -0
  228. package/dist/patterns/FormField/field-styles.d.ts +44 -0
  229. package/dist/patterns/FormField/field-styles.js +89 -0
  230. package/dist/patterns/FormField/field-types.d.ts +4 -0
  231. package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
  232. package/dist/patterns/FormField/use-field-ids.js +53 -0
  233. package/dist/patterns/List/List.d.ts +38 -0
  234. package/dist/patterns/List/List.js +174 -0
  235. package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
  236. package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
  237. package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
  238. package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
  239. package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
  240. package/dist/patterns/MentionsInput/mention-text.js +31 -0
  241. package/dist/patterns/Menubar/Menubar.d.ts +22 -0
  242. package/dist/patterns/Menubar/Menubar.js +79 -0
  243. package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
  244. package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
  245. package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
  246. package/dist/patterns/NumberField/FormNumberField.js +119 -0
  247. package/dist/patterns/NumberField/NumberField.d.ts +57 -0
  248. package/dist/patterns/NumberField/NumberField.js +242 -0
  249. package/dist/patterns/Pagination/Pagination.d.ts +31 -0
  250. package/dist/patterns/Pagination/Pagination.js +275 -0
  251. package/dist/patterns/Pagination/page-items.d.ts +18 -0
  252. package/dist/patterns/Pagination/page-items.js +40 -0
  253. package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
  254. package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
  255. package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
  256. package/dist/patterns/PhoneField/PhoneField.js +448 -0
  257. package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
  258. package/dist/patterns/PhoneField/phone-value.js +38 -0
  259. package/dist/patterns/QRCode/QRCode.d.ts +37 -0
  260. package/dist/patterns/QRCode/QRCode.js +120 -0
  261. package/dist/patterns/QRCode/qr-path.d.ts +7 -0
  262. package/dist/patterns/QRCode/qr-path.js +25 -0
  263. package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
  264. package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
  265. package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
  266. package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
  267. package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
  268. package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
  269. package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
  270. package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
  271. package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
  272. package/dist/patterns/SearchInput/SearchInput.js +98 -0
  273. package/dist/patterns/SideNav/SideNav.d.ts +50 -0
  274. package/dist/patterns/SideNav/SideNav.js +269 -0
  275. package/dist/patterns/Stat/Stat.d.ts +51 -0
  276. package/dist/patterns/Stat/Stat.js +292 -0
  277. package/dist/patterns/Stepper/Stepper.d.ts +35 -0
  278. package/dist/patterns/Stepper/Stepper.js +110 -0
  279. package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
  280. package/dist/patterns/TagGroup/TagGroup.js +151 -0
  281. package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
  282. package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
  283. package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
  284. package/dist/patterns/TagsInput/TagsInput.js +97 -0
  285. package/dist/patterns/Timeline/Timeline.d.ts +29 -0
  286. package/dist/patterns/Timeline/Timeline.js +85 -0
  287. package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
  288. package/dist/patterns/Toolbar/Toolbar.js +105 -0
  289. package/dist/patterns/Tour/Tour.d.ts +38 -0
  290. package/dist/patterns/Tour/Tour.js +333 -0
  291. package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
  292. package/dist/patterns/TransferList/FormTransferListField.js +117 -0
  293. package/dist/patterns/TransferList/TransferList.d.ts +53 -0
  294. package/dist/patterns/TransferList/TransferList.js +441 -0
  295. package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
  296. package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
  297. package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
  298. package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
  299. package/dist/patterns/TreeView/TreeView.d.ts +40 -0
  300. package/dist/patterns/TreeView/TreeView.js +296 -0
  301. package/dist/provider/DesignSystemProvider.d.ts +54 -0
  302. package/dist/provider/DesignSystemProvider.js +270 -0
  303. package/dist/provider/nonce.d.ts +7 -0
  304. package/dist/provider/nonce.js +13 -0
  305. package/dist/styles.css +2 -0
  306. package/dist/theme/chart-palette.d.ts +51 -0
  307. package/dist/theme/chart-palette.js +112 -0
  308. package/dist/theme/create-theme.d.ts +52 -0
  309. package/dist/theme/create-theme.js +75 -0
  310. package/dist/theme/style-element.d.ts +28 -0
  311. package/dist/theme/style-element.js +79 -0
  312. package/dist/theme/tenant-branding.d.ts +48 -0
  313. package/dist/theme/tenant-branding.js +65 -0
  314. package/dist/theme/theme-switch.d.ts +25 -0
  315. package/dist/theme/theme-switch.js +90 -0
  316. package/dist/theme/token-names.d.ts +3 -0
  317. package/dist/theme/token-names.js +166 -0
  318. package/dist/theme.css +241 -0
  319. package/dist/tokens.css +383 -0
  320. package/dist/types/direction.d.ts +4 -0
  321. package/dist/types/tone.d.ts +7 -0
  322. package/dist/utils/cn.d.ts +7 -0
  323. package/dist/utils/cn.js +50 -0
  324. package/dist/utils/first-field.d.ts +8 -0
  325. package/dist/utils/first-field.js +10 -0
  326. package/dist/utils/layout.d.ts +33 -0
  327. package/dist/utils/layout.js +30 -0
  328. package/dist/utils/popup.d.ts +12 -0
  329. package/dist/utils/popup.js +27 -0
  330. package/docs/accessibility.md +61 -0
  331. package/docs/advanced-components.md +38 -0
  332. package/docs/ai-assistants.md +44 -0
  333. package/docs/architecture.md +65 -0
  334. package/docs/browser-support.md +30 -0
  335. package/docs/charts.md +56 -0
  336. package/docs/components.md +2928 -0
  337. package/docs/conventions.md +19 -0
  338. package/docs/customization.md +79 -0
  339. package/docs/dates-files-data.md +48 -0
  340. package/docs/design-principles.md +50 -0
  341. package/docs/faq.md +68 -0
  342. package/docs/forms.md +114 -0
  343. package/docs/getting-started.md +64 -0
  344. package/docs/icons.md +48 -0
  345. package/docs/internationalization.md +64 -0
  346. package/docs/layout-and-navigation.md +51 -0
  347. package/docs/nextjs.md +69 -0
  348. package/docs/releasing.md +41 -0
  349. package/docs/testing.md +242 -0
  350. package/docs/theming.md +118 -0
  351. package/docs/typescript.md +62 -0
  352. package/llms-full.txt +4574 -0
  353. package/llms.txt +52 -0
  354. package/package.json +166 -6
@@ -0,0 +1,2928 @@
1
+ # Components
2
+
3
+ <!-- Generated by scripts/generate-docs.mjs (npm run docs) from the source's doc comments. Do not edit by hand. -->
4
+
5
+ Every component of @primecoderin/fast-ui-react 0.1.0: 128 of them, with the import and the props. A star after a prop's name means it is required. Every component that renders an element also accepts `ref`, forwarded to it, and the props of the element it renders where its description says so. Text a user reads always arrives through props (see [Prop conventions](conventions.md)).
6
+
7
+ **Main entry: `@primecoderin/fast-ui-react`**
8
+
9
+ [Accordion](#accordion) · [Alert](#alert) · [AppShell](#appshell) · [Autocomplete](#autocomplete) · [Avatar](#avatar) · [Breadcrumbs](#breadcrumbs) · [Button](#button) · [Calendar](#calendar) · [Card](#card) · [Carousel](#carousel) · [Cascader](#cascader) · [CheckboxBox](#checkboxbox) · [CheckboxField](#checkboxfield) · [CodeSnippet](#codesnippet) · [Collapsible](#collapsible) · [ColorPicker](#colorpicker) · [Combobox](#combobox) · [CommandPalette](#commandpalette) · [Container](#container) · [ContextMenu](#contextmenu) · [DataTable](#datatable) · [DateRangePicker](#daterangepicker) · [DateTimePicker](#datetimepicker) · [DescriptionList](#descriptionlist) · [DesignSystemProvider](#designsystemprovider) · [Dialog](#dialog) · [Drawer](#drawer) · [EmptyState](#emptystate) · [FieldFrame](#fieldframe) · [FileUpload](#fileupload) · [FloatingActionButton](#floatingactionbutton) · [Grid](#grid) · [HoverPopover](#hoverpopover) · [IconTile](#icontile) · [InlineError](#inlineerror) · [Kbd](#kbd) · [Link](#link) · [List](#list) · [MentionsInput](#mentionsinput) · [Menu](#menu) · [Menubar](#menubar) · [MenubarMenu](#menubarmenu) · [MenuCheckboxItem](#menucheckboxitem) · [MenuGroup](#menugroup) · [MenuItem](#menuitem) · [MenuLinkItem](#menulinkitem) · [MenuRadioGroup](#menuradiogroup) · [MenuRadioItem](#menuradioitem) · [MenuSeparator](#menuseparator) · [MenuSubmenu](#menusubmenu) · [MultiSelect](#multiselect) · [NavigationMenu](#navigationmenu) · [NumberField](#numberfield) · [OtpInput](#otpinput) · [Pagination](#pagination) · [PhoneField](#phonefield) · [Popover](#popover) · [ProgressBar](#progressbar) · [RadioGroupField](#radiogroupfield) · [Rating](#rating) · [ResizablePanels](#resizablepanels) · [ScrollArea](#scrollarea) · [SearchInput](#searchinput) · [SegmentedControl](#segmentedcontrol) · [SelectField](#selectfield) · [Separator](#separator) · [SideNav](#sidenav) · [SkeletonCard](#skeletoncard) · [SkeletonItem](#skeletonitem) · [SkeletonTable](#skeletontable) · [SkeletonText](#skeletontext) · [Slider](#slider) · [Spinner](#spinner) · [Stack](#stack) · [Stat](#stat) · [StateIcon](#stateicon) · [StatGroup](#statgroup) · [StatusBadge](#statusbadge) · [Stepper](#stepper) · [SwitchField](#switchfield) · [Tabs](#tabs) · [Tag](#tag) · [TagGroup](#taggroup) · [TagsInput](#tagsinput) · [TextAreaField](#textareafield) · [TextField](#textfield) · [Timeline](#timeline) · [ToggleButton](#togglebutton) · [ToggleGroup](#togglegroup) · [Toolbar](#toolbar) · [ToolbarButton](#toolbarbutton) · [ToolbarSeparator](#toolbarseparator) · [Tooltip](#tooltip) · [Tour](#tour) · [TransferList](#transferlist) · [TreeSelect](#treeselect) · [TreeView](#treeview) · [Typography](#typography)
10
+
11
+ **Form fields bound to react-hook-form: `@primecoderin/fast-ui-react/forms`**
12
+
13
+ [FormAutocompleteField](#formautocompletefield) · [FormCascaderField](#formcascaderfield) · [FormCheckboxField](#formcheckboxfield) · [FormColorField](#formcolorfield) · [FormComboboxField](#formcomboboxfield) · [FormDateRangeField](#formdaterangefield) · [FormDateTimeField](#formdatetimefield) · [FormFileUploadField](#formfileuploadfield) · [FormMentionsField](#formmentionsfield) · [FormMultiSelectField](#formmultiselectfield) · [FormNumberField](#formnumberfield) · [FormPhoneField](#formphonefield) · [FormRadioGroupField](#formradiogroupfield) · [FormRatingField](#formratingfield) · [FormSelectField](#formselectfield) · [FormSliderField](#formsliderfield) · [FormSwitchField](#formswitchfield) · [FormTagsInputField](#formtagsinputfield) · [FormTextAreaField](#formtextareafield) · [FormTextField](#formtextfield) · [FormTransferListField](#formtransferlistfield) · [FormTreeSelectField](#formtreeselectfield)
14
+
15
+ **Charts: `@primecoderin/fast-ui-react/charts`**
16
+
17
+ [AreaChart](#areachart) · [BarChart](#barchart) · [DonutChart](#donutchart) · [GaugeChart](#gaugechart) · [LineChart](#linechart) · [Sparkline](#sparkline)
18
+
19
+ **Rich text editor: `@primecoderin/fast-ui-react/editor`**
20
+
21
+ [RichTextEditor](#richtexteditor)
22
+
23
+ **Rich text form field: `@primecoderin/fast-ui-react/editor-forms`**
24
+
25
+ [FormRichTextField](#formrichtextfield)
26
+
27
+ ## Main entry: `@primecoderin/fast-ui-react`
28
+
29
+ ### Components
30
+
31
+ #### Avatar
32
+
33
+ A round badge with a person's initials, or a generic person when there is no name. Decorative.
34
+
35
+ ```ts
36
+ import { Avatar } from "@primecoderin/fast-ui-react";
37
+ ```
38
+
39
+ | Prop | Type | Default | Description |
40
+ | --- | --- | --- | --- |
41
+ | `name` | `string` | `""` | The person's name; the initials of its first and last word are shown. |
42
+ | `size` | `AvatarSize` | `32` | |
43
+ | `tone` | `"solid" \| "soft"` | `"solid"` | |
44
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
45
+
46
+ Tested examples: `stories/components/avatar.stories.tsx`, `stories/foundations/branding.stories.tsx`
47
+
48
+ #### Button
49
+
50
+ A native button in one of the variants: primary for the one main action of a view, secondary (the default) for the rest, subtle in a toolbar, destructive to delete, icon for a lone glyph. Its type is "button" unless another is given, so it never submits a form by accident.
51
+
52
+ ```ts
53
+ import { Button } from "@primecoderin/fast-ui-react";
54
+ ```
55
+
56
+ | Prop | Type | Default | Description |
57
+ | --- | --- | --- | --- |
58
+ | `icon` | `ReactNode` | | An icon sized by the button's size. Decorative: give an icon-only button an `aria-label`. |
59
+ | `iconPosition` | `"before" \| "after"` | `"before"` | |
60
+ | `disabledFocusable` | `boolean` | `false` | Looks disabled and ignores clicks, but stays in the tab order. |
61
+ | `isLoading` | `boolean` | `false` | Shows a spinner and blocks clicks while keeping the button focusable. |
62
+ | `size` | `"small" \| "medium" \| "large" \| null` | | |
63
+ | `variant` | `"destructive" \| "primary" \| "secondary" \| "outline" \| "tertiary" \| "subtle" \| "icon" \| null` | | |
64
+
65
+ Tested examples: `stories/components/button.stories.tsx`, `stories/components/toast.stories.tsx`, `stories/foundations/branding.stories.tsx`, `stories/foundations/theming.stories.tsx`
66
+
67
+ #### CheckboxBox
68
+
69
+ The checkbox square on its own, for form fields (inside a label) and table selection. It is the one place the foundation's checkbox look is defined.
70
+
71
+ ```ts
72
+ import { CheckboxBox } from "@primecoderin/fast-ui-react";
73
+ ```
74
+
75
+ | Prop | Type | Default | Description |
76
+ | --- | --- | --- | --- |
77
+ | `checked` * | `boolean` | | Whether the box is ticked. |
78
+ | `onCheckedChange` * | `(checked: boolean) => void` | | Called with the new state when the person ticks or clears the box (a click or Space). |
79
+ | `indeterminate` | `boolean` | `false` | The mixed state, e.g. a table header when only some rows are selected. |
80
+ | `size` | `"medium" \| "large"` | `"medium"` | "large" is a 20px box (the default is 17px). |
81
+ | `disabled` | `boolean` | | Greys the box out; it cannot be ticked or focused. |
82
+ | `aria-label` | `string` | | For a box with no visible label beside it. |
83
+ | `aria-labelledby` | `string` | | The id of the element that names the box. Inside a form field Base UI names every control after the field's label; this gives a box its own name (a row of a list, one of several boxes in one field). |
84
+ | `name` | `string` | | The field's name in a submitted form: the box's hidden input submits "on" while ticked. |
85
+ | `inputRef` | `Ref<HTMLInputElement>` | | The box's hidden `<input type="checkbox">`, e.g. for a form library to focus the first invalid field. |
86
+ | `onBlur` | `FocusEventHandler<HTMLElement>` | | The box lost focus. |
87
+ | `stopClickPropagation` | `boolean` | `false` | Keeps a click on the box from also reaching the row or card around it. |
88
+
89
+ Tested examples: `stories/components/checkbox-box.stories.tsx`, `stories/foundations/branding.stories.tsx`
90
+
91
+ #### CodeSnippet
92
+
93
+ Code or a command in the system's monospace, with a button that copies it. A long line scrolls sideways (the box takes the keyboard focus then, so the keys scroll it); the text is plain, for the app to colour if it wants. Inline, it is a `<code>` in a sentence.
94
+
95
+ ```ts
96
+ import { CodeSnippet } from "@primecoderin/fast-ui-react";
97
+ ```
98
+
99
+ | Prop | Type | Default | Description |
100
+ | --- | --- | --- | --- |
101
+ | `code` * | `string` | | The code or command, as text. Line breaks are kept. |
102
+ | `labels` | `CodeSnippetLabels` | | Needed for the copy button; leave it out for a snippet with no button. |
103
+ | `variant` | `"inline" \| "block"` | `"block"` | "block" (default) is a box of its own; "inline" sits in a line of text, with no copy button. |
104
+ | `language` | `string` | | The language, e.g. "tsx": it is written on the element as `data-language` for the app's own highlighter. |
105
+ | `copiedDuration` | `number` | `2000` | How long "Copied" shows, in milliseconds. Default 2000. |
106
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
107
+
108
+ Tested examples: `stories/components/code-snippet.stories.tsx`
109
+
110
+ #### Collapsible
111
+
112
+ One section that opens and closes under a button: "Advanced options", "Show details". The button carries `aria-expanded`. For several in a stack, see Accordion.
113
+
114
+ ```ts
115
+ import { Collapsible } from "@primecoderin/fast-ui-react";
116
+ ```
117
+
118
+ | Prop | Type | Default | Description |
119
+ | --- | --- | --- | --- |
120
+ | `trigger` * | `ReactNode` | | The button's content: the section's name. |
121
+ | `children` * | `ReactNode` | | What shows while the section is open. |
122
+ | `open` | `boolean` | | Whether the section is open. Leave it out to let the section keep its own. |
123
+ | `defaultOpen` | `boolean` | `false` | Whether the section starts open, when it keeps its own state. |
124
+ | `onOpenChange` | `((open: boolean) => void)` | | Called with the new state when the person opens or closes the section. |
125
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
126
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
127
+
128
+ Tested examples: `stories/components/collapsible.stories.tsx`
129
+
130
+ #### Container
131
+
132
+ A page's content, centred, no wider than `size`, with room at both edges on a narrow screen.
133
+
134
+ ```ts
135
+ import { Container } from "@primecoderin/fast-ui-react";
136
+ ```
137
+
138
+ | Prop | Type | Default | Description |
139
+ | --- | --- | --- | --- |
140
+ | `size` | `"default" \| "narrow" \| "wide" \| "full"` | `"default"` | |
141
+ | `as` | `LayoutElement` | `"div"` | The element: a `div` (default), or a landmark where the container is one. |
142
+
143
+ Tested examples: `stories/components/container.stories.tsx`
144
+
145
+ #### ContextMenu
146
+
147
+ A menu that opens where the pointer is, from a right click or a long press on its area, or from the keyboard's Menu key or Shift and F10 while the area (or something in it) has the focus. The area is a tab stop for that, and the browser sends those keys to it as a `contextmenu` event. Its items are the same as Menu's, and closing the menu puts the focus back. A context menu is a shortcut, never the only way: whatever it does must be reachable another way too.
148
+
149
+ ```ts
150
+ import { ContextMenu } from "@primecoderin/fast-ui-react";
151
+ ```
152
+
153
+ | Prop | Type | Default | Description |
154
+ | --- | --- | --- | --- |
155
+ | `menu` * | `ReactNode` | | The menu's items: MenuItem, MenuSeparator, MenuSubmenu and the rest of Menu's parts. |
156
+ | `children` * | `ReactNode` | | The area that opens the menu when it is right-clicked or long-pressed. |
157
+ | `aria-label` | `string` | | Names the area, for a screen reader to say what has a menu: with it, the area is a named group. |
158
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
159
+
160
+ Tested examples: `stories/components/context-menu.stories.tsx`
161
+
162
+ #### FloatingActionButton
163
+
164
+ The page's main action as a round button fixed to a corner: "New order", "Compose". With `actions` it opens a menu of several above it. It sits on the sticky layer (`--fast-z-sticky`), below popups and dialogs. Use one per screen, for the action people come to the screen for.
165
+
166
+ ```ts
167
+ import { FloatingActionButton } from "@primecoderin/fast-ui-react";
168
+ ```
169
+
170
+ | Prop | Type | Default | Description |
171
+ | --- | --- | --- | --- |
172
+ | `icon` * | `ReactNode` | | The button's glyph, e.g. a plus. |
173
+ | `aria-label` | `string` | | The accessible name, e.g. "New order". An extended button (with `children`) is named by its text instead. |
174
+ | `children` | `ReactNode` | | A label beside the glyph, making an extended button. |
175
+ | `onClick` | `(() => void)` | | What the button does. Leave it out when `actions` is given: the button then opens a menu. |
176
+ | `actions` | `ReactNode` | | Menu items (MenuItem and the rest of Menu's parts) the button opens above it, for several actions. |
177
+ | `position` | `"bottom-end" \| "bottom-start"` | `"bottom-end"` | The corner: the end edge (default; the right, in left to right) or the start edge. |
178
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
179
+
180
+ Tested examples: `stories/components/floating-action-button.stories.tsx`
181
+
182
+ #### Grid
183
+
184
+ Children in equal columns: a set number (`columns`) or as many as fit (`minColumnWidth`, for cards that should wrap). A child that must span columns or rows is the app's own CSS to say.
185
+
186
+ ```ts
187
+ import { Grid } from "@primecoderin/fast-ui-react";
188
+ ```
189
+
190
+ | Prop | Type | Default | Description |
191
+ | --- | --- | --- | --- |
192
+ | `columns` | `1 \| 6 \| 12 \| 5 \| 4 \| 3 \| 2` | `1` | A fixed number of equal columns. Give this or `minColumnWidth`. |
193
+ | `minColumnWidth` | `string` | | As many equal columns as fit, none narrower than this CSS length (`"16rem"`, `"240px"`): the grid wraps by itself on a narrow screen, with no breakpoints. Wins over `columns`. |
194
+ | `gap` | `0 \| 1 \| 6 \| 12 \| 5 \| 4 \| 3 \| 2 \| 8 \| 10` | `4` | The space between cells, in steps of 4px: 4 is 16px. Default 4. |
195
+ | `as` | `LayoutElement` | `"div"` | The element: a `div` (default), or a landmark or list where the grid is one. |
196
+
197
+ Tested examples: `stories/components/grid.stories.tsx`
198
+
199
+ #### HoverPopover
200
+
201
+ A panel that opens while the pointer is over its trigger, and stays open while it is over the panel. The trigger is a button, so Enter or Space opens it from the keyboard and Escape closes it. Focus is not moved into it, so a keyboard user stays on the trigger; for a panel that should take focus, use a menu or dialog instead.
202
+
203
+ ```ts
204
+ import { HoverPopover } from "@primecoderin/fast-ui-react";
205
+ ```
206
+
207
+ | Prop | Type | Default | Description |
208
+ | --- | --- | --- | --- |
209
+ | `trigger` * | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | The element that opens the popover. It is the trigger itself, so it keeps its own props. |
210
+ | `children` * | `ReactNode` | | The content. |
211
+ | `aria-label` * | `string` | | Accessible name of the popover. |
212
+ | `side` | `"top" \| "bottom" \| "left" \| "right" \| "inline-start" \| "inline-end"` | `"bottom"` | `inline-end` follows the text direction. |
213
+ | `align` | `"center" \| "start" \| "end"` | `"center"` | |
214
+ | `nativeButton` | `boolean` | `true` | Set to false when the trigger is not a `<button>`, e.g. a `<span>`; Base UI then adds the button role itself. |
215
+
216
+ Tested examples: `stories/components/hover-popover.stories.tsx`
217
+
218
+ #### IconTile
219
+
220
+ An icon on a rounded tinted square, to head a card, a section or a row.
221
+
222
+ ```ts
223
+ import { IconTile } from "@primecoderin/fast-ui-react";
224
+ ```
225
+
226
+ | Prop | Type | Default | Description |
227
+ | --- | --- | --- | --- |
228
+ | `icon` * | `ReactNode` | | An icon sized by font-size. Decorative: hidden from assistive technology. |
229
+ | `tone` | `IconTileTone` | `"brand"` | |
230
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | |
231
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
232
+
233
+ Tested examples: `stories/components/icon-tile.stories.tsx`
234
+
235
+ #### InlineError
236
+
237
+ A failure that belongs to a part of a page, in one line: icon, message, optional retry.
238
+
239
+ ```ts
240
+ import { InlineError } from "@primecoderin/fast-ui-react";
241
+ ```
242
+
243
+ | Prop | Type | Default | Description |
244
+ | --- | --- | --- | --- |
245
+ | `message` * | `string` | | |
246
+ | `retryLabel` | `string` | | With `onRetry`, adds a retry button after the message. |
247
+ | `onRetry` | `(() => void)` | | |
248
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
249
+
250
+ Tested examples: `stories/components/inline-error.stories.tsx`
251
+
252
+ #### Kbd
253
+
254
+ A keyboard key, drawn as a small key cap: "Press <Kbd>Esc</Kbd> to close". It is a `<kbd>`, so a screen reader knows it is a key. For a combination write one per key, `<Kbd>Ctrl</Kbd> + <Kbd>K</Kbd>`.
255
+
256
+ ```ts
257
+ import { Kbd } from "@primecoderin/fast-ui-react";
258
+ ```
259
+
260
+ | Prop | Type | Default | Description |
261
+ | --- | --- | --- | --- |
262
+ | `children` * | `ReactNode` | | The key as the person reads it: "Ctrl", "Esc", "K", "⌘". |
263
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
264
+
265
+ Tested examples: `stories/components/kbd.stories.tsx`
266
+
267
+ #### Link
268
+
269
+ Text that goes somewhere. A plain `<a>` by default; with `render` it is the app's router link, so navigation stays on the router and the look stays here. Its text, not colour alone, says it is a link: it is underlined on hover and focus.
270
+
271
+ ```ts
272
+ import { Link } from "@primecoderin/fast-ui-react";
273
+ ```
274
+
275
+ | Prop | Type | Default | Description |
276
+ | --- | --- | --- | --- |
277
+ | `tone` | `"brand" \| "inherit"` | `"brand"` | "brand" (default) is teal text; "inherit" takes the colour of the text around it. |
278
+ | `underline` | `"hover" \| "always"` | `"hover"` | When the underline shows: on hover and focus (default), or always. Links inside a paragraph should always. |
279
+ | `render` | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | Render another element in place of the `<a>`, with this link's look and props: the app's router link, `render={<RouterLink to="/orders" />}`. The element keeps its own `href` or `to`. |
280
+
281
+ Tested examples: `stories/components/link.stories.tsx`
282
+
283
+ #### Menu
284
+
285
+ A menu that opens from a button: items, radio choices, separators.
286
+
287
+ ```ts
288
+ import { Menu } from "@primecoderin/fast-ui-react";
289
+ ```
290
+
291
+ | Prop | Type | Default | Description |
292
+ | --- | --- | --- | --- |
293
+ | `trigger` * | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | The button that opens the menu. It is the trigger itself, so it keeps its own look and props. |
294
+ | `children` * | `ReactNode` | | The content. |
295
+ | `align` | `"center" \| "start" \| "end"` | `"end"` | Which edge of the trigger the menu lines up with. |
296
+ | `size` | `"large" \| "default"` | `"default"` | "large" is the roomier menu: 40px rows and 16px text. |
297
+
298
+ Tested examples: `stories/components/menu.stories.tsx`
299
+
300
+ #### MenuCheckboxItem
301
+
302
+ An option that is on or off, with a check at the end edge while it is on ("Show grid", "Word wrap").
303
+
304
+ ```ts
305
+ import { MenuCheckboxItem } from "@primecoderin/fast-ui-react";
306
+ ```
307
+
308
+ | Prop | Type | Default | Description |
309
+ | --- | --- | --- | --- |
310
+ | `checked` * | `boolean` | | Whether the option is on. |
311
+ | `onCheckedChange` * | `(checked: boolean) => void` | | Called with the new state when the person chooses the item. |
312
+ | `children` * | `ReactNode` | | The content. |
313
+ | `disabled` | `boolean` | | Not interactive, and shown as disabled. |
314
+ | `closeOnClick` | `boolean` | `false` | Close the menu when the item is chosen. Default false: a person often sets several options in one visit. |
315
+
316
+
317
+ #### MenuGroup
318
+
319
+ Items under a small heading: "Sort by", "View".
320
+
321
+ ```ts
322
+ import { MenuGroup } from "@primecoderin/fast-ui-react";
323
+ ```
324
+
325
+ | Prop | Type | Default | Description |
326
+ | --- | --- | --- | --- |
327
+ | `label` * | `string` | | The group's name: shown above its items in small type, and its accessible name. |
328
+ | `children` * | `ReactNode` | | The content. |
329
+
330
+
331
+ #### MenuItem
332
+
333
+ One command of a `Menu`: a label with an optional icon. `tone="danger"` marks one that deletes or removes.
334
+
335
+ ```ts
336
+ import { MenuItem } from "@primecoderin/fast-ui-react";
337
+ ```
338
+
339
+ | Prop | Type | Default | Description |
340
+ | --- | --- | --- | --- |
341
+ | `children` * | `ReactNode` | | The content. |
342
+ | `icon` | `ReactNode` | | An icon sized by font-size, before the label. It takes the row's colour. |
343
+ | `onClick` | `(() => void)` | | |
344
+ | `disabled` | `boolean` | | Not interactive, and shown as disabled. |
345
+ | `tone` | `"default" \| "danger"` | `"default"` | "danger" for an action that deletes or removes. |
346
+
347
+
348
+ #### MenuLinkItem
349
+
350
+ An item that goes to a page: a real link, so it can be opened in a new tab and a screen reader announces it as one.
351
+
352
+ ```ts
353
+ import { MenuLinkItem } from "@primecoderin/fast-ui-react";
354
+ ```
355
+
356
+ | Prop | Type | Default | Description |
357
+ | --- | --- | --- | --- |
358
+ | `children` * | `ReactNode` | | The content. |
359
+ | `href` | `string` | | |
360
+ | `icon` | `ReactNode` | | An icon sized by font-size, before the label. |
361
+ | `render` | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | The app's router link, `<RouterLink to="/settings" />`, to render in place of the plain `<a>`. |
362
+
363
+
364
+ #### MenuRadioGroup
365
+
366
+ A set of mutually exclusive choices; the one in force is ticked.
367
+
368
+ ```ts
369
+ import { MenuRadioGroup } from "@primecoderin/fast-ui-react";
370
+ ```
371
+
372
+ | Prop | Type | Default | Description |
373
+ | --- | --- | --- | --- |
374
+ | `value` * | `TValue` | | The current value. Controlled: the caller keeps this state. |
375
+ | `onValueChange` * | `(value: TValue) => void` | | Called with the new value when the user picks one; set `value` from it. |
376
+ | `aria-label` * | `string` | | Accessible name of the group, e.g. "Language". |
377
+ | `children` * | `ReactNode` | | The content. |
378
+
379
+
380
+ #### MenuRadioItem
381
+
382
+ A radio choice: the label, with a check at the end edge when it is the one in force.
383
+
384
+ ```ts
385
+ import { MenuRadioItem } from "@primecoderin/fast-ui-react";
386
+ ```
387
+
388
+ | Prop | Type | Default | Description |
389
+ | --- | --- | --- | --- |
390
+ | `value` * | `string` | | The current value. Controlled: the caller keeps this state. |
391
+ | `children` * | `ReactNode` | | The content. |
392
+
393
+
394
+ #### MenuSeparator
395
+
396
+ A rule between groups of items, e.g. before a destructive one.
397
+
398
+ ```ts
399
+ import { MenuSeparator } from "@primecoderin/fast-ui-react";
400
+ ```
401
+
402
+ This component takes no props.
403
+
404
+
405
+ #### MenuSubmenu
406
+
407
+ An item that opens a menu of its own beside it, with a chevron that points the way the page reads. The arrow keys open it (toward the end edge) and close it (toward the start edge).
408
+
409
+ ```ts
410
+ import { MenuSubmenu } from "@primecoderin/fast-ui-react";
411
+ ```
412
+
413
+ | Prop | Type | Default | Description |
414
+ | --- | --- | --- | --- |
415
+ | `label` * | `string` | | The item that opens the submenu. |
416
+ | `children` * | `ReactNode` | | The submenu's items. |
417
+ | `icon` | `ReactNode` | | An icon sized by font-size, before the label. |
418
+ | `disabled` | `boolean` | | Not interactive, and shown as disabled. |
419
+
420
+
421
+ #### OtpInput
422
+
423
+ A code entered one digit per box, for the codes emailed to a user. Typing moves on to the next box, Backspace on an empty box steps back, the arrow keys move between boxes. A pasted code (Ctrl/Cmd+V, the context menu, a long press on a phone) or one the browser fills in from a message fills all the boxes at once, wherever it lands, with anything that is not a digit left out. Copy and cut take the whole code, not one box of it. The boxes read left to right in every language, as the digits of a number do.
424
+
425
+ ```ts
426
+ import { OtpInput } from "@primecoderin/fast-ui-react";
427
+ ```
428
+
429
+ | Prop | Type | Default | Description |
430
+ | --- | --- | --- | --- |
431
+ | `value` * | `string` | | The digits typed so far, as text: "" up to a full code. Never holds a gap, so "12" is the first two boxes. |
432
+ | `onValueChange` * | `(value: string) => void` | | Called with the new digits as the person types, deletes, pastes or cuts. |
433
+ | `label` * | `string` | | Names the whole code for assistive technology, such as "Verification code". |
434
+ | `getDigitLabel` * | `(position: number, total: number) => string` | | Names one box (`position` counts from 1), such as "Digit 3 of 6". |
435
+ | `length` | `number` | `DEFAULT_LENGTH` | How many boxes; the code's length. |
436
+ | `invalid` | `boolean` | `false` | Marks every box as holding a rejected code. Say why in text next to the input and point `aria-describedby` at it. |
437
+ | `disabled` | `boolean` | `false` | Dims the boxes and takes them out of the tab order. |
438
+ | `readOnly` | `boolean` | `false` | The code cannot be edited (typing, Backspace, paste and cut do nothing), but is still shown and read (a check is under way). |
439
+ | `autoFocus` | `boolean` | `false` | Puts the cursor in the first box when the input appears. |
440
+ | `aria-describedby` | `string` | | The ids of the text that describes the code, such as why it was rejected; given to every box. |
441
+ | `className` | `string` | | Classes for the row of boxes, merged last. |
442
+
443
+ Tested examples: `stories/components/otp-input.stories.tsx`
444
+
445
+ #### Popover
446
+
447
+ A panel that opens from a button and holds controls the person works in, such as a column chooser: a heading, a few rows of checkboxes, a link. Focus moves into it when it opens, Escape or a click outside closes it, and focus returns to the button. For a list of actions use Menu; for a panel that only explains, HoverPopover.
448
+
449
+ ```ts
450
+ import { Popover } from "@primecoderin/fast-ui-react";
451
+ ```
452
+
453
+ | Prop | Type | Default | Description |
454
+ | --- | --- | --- | --- |
455
+ | `trigger` * | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | The button that opens the panel. It is the trigger itself, so it keeps its own look and props. |
456
+ | `children` * | `ReactNode` | | The content. |
457
+ | `aria-label` * | `string` | | Accessible name of the panel. |
458
+ | `align` | `"center" \| "start" \| "end"` | `"end"` | Which edge of the trigger the panel lines up with. |
459
+ | `className` | `string` | | Extra classes for the panel, e.g. its width. |
460
+
461
+ Tested examples: `stories/components/popover.stories.tsx`
462
+
463
+ #### ProgressBar
464
+
465
+ A thin bar with a block sliding across it: something is loading, with no way to say how far. For a visitor who asks for reduced motion the block does not move: the whole bar shows, faded.
466
+
467
+ ```ts
468
+ import { ProgressBar } from "@primecoderin/fast-ui-react";
469
+ ```
470
+
471
+ | Prop | Type | Default | Description |
472
+ | --- | --- | --- | --- |
473
+ | `label` * | `string` | | What is in progress, e.g. "Loading". |
474
+ | `valueText` | `string` | | What a screen reader says in place of a value, after the label, e.g. "Loading the list". The bar has no value (it cannot say how far), so without this it has no value text at all and a screen reader announces the label and the progress bar. |
475
+ | `className` | `string` | | Classes for the bar, e.g. a margin. |
476
+
477
+ Tested examples: `stories/components/progress-bar.stories.tsx`
478
+
479
+ #### Rating
480
+
481
+ A rating of stars. Each star is a radio button, so the arrow keys move and choose, Tab enters the group once, and a screen reader announces each star by `getValueLabel`. The stars under the pointer preview the choice. With `readOnly` it is an image that shows the rating. Whole stars only.
482
+
483
+ ```ts
484
+ import { Rating } from "@primecoderin/fast-ui-react";
485
+ ```
486
+
487
+ | Prop | Type | Default | Description |
488
+ | --- | --- | --- | --- |
489
+ | `value` * | `number` | | The rating, from 0 (none) to `max`. |
490
+ | `getValueLabel` * | `(value: number, max: number) => string` | | What a rating of `value` out of `max` is called, e.g. `(n, max) => "3 of 5 stars"`. It names each star and the shown rating. |
491
+ | `onValueChange` | `((value: number) => void)` | | Called with the new rating. Leave it out, or set `readOnly`, to only show a rating. |
492
+ | `max` | `number` | `5` | How many stars. Default 5. |
493
+ | `readOnly` | `boolean` | `false` | Show the rating without letting it change: the stars are an image, not controls. |
494
+ | `disabled` | `boolean` | `false` | Dims the stars, which cannot be chosen or focused. |
495
+ | `clearable` | `boolean` | `false` | Pressing the chosen star again sets the rating back to 0. |
496
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | The stars' size: small 16px, medium 20px (the default), large 26px. Small and medium stars that can be chosen each sit in a 24px box, the least size of a target, so they stand further apart than read-only ones. |
497
+ | `invalid` | `boolean` | `false` | Marks the group invalid for assistive technology. |
498
+ | `required` | `boolean` | `false` | Marks the group required for assistive technology; a field's label shows the asterisk. |
499
+ | `name` | `string` | | The field's name in a submitted form. |
500
+ | `aria-label` | `string` | | Accessible name of the group, e.g. "Rate this order". |
501
+ | `aria-labelledby` | `string` | | The id of the element that names the group, such as a field's label. A read-only rating adds the rating shown to that name. |
502
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
503
+ | `onBlur` | `(() => void)` | | The group was left. |
504
+ | `inputRef` | `Ref<HTMLInputElement>` | | The first star's radio input, for a form library to focus the first invalid field. |
505
+ | `className` | `string` | | Classes for the row of stars, merged last. |
506
+
507
+ Tested examples: `stories/components/rating.stories.tsx`
508
+
509
+ #### ScrollArea
510
+
511
+ A region that scrolls with the design system's own slim scrollbars, which show while the pointer is over it or it scrolls. The browser's scrolling still does the work (wheel, touch, keys), so it feels native. Give it a height or width through `style`.
512
+
513
+ ```ts
514
+ import { ScrollArea } from "@primecoderin/fast-ui-react";
515
+ ```
516
+
517
+ | Prop | Type | Default | Description |
518
+ | --- | --- | --- | --- |
519
+ | `children` * | `ReactNode` | | The content. |
520
+ | `aria-label` * | `string` | | Accessible name of the scrolling region, e.g. "Activity log". The region takes the keyboard focus, so the arrow keys, Page Up and Page Down scroll it for a person who cannot use a pointer. |
521
+ | `orientation` | `"vertical" \| "horizontal" \| "both"` | `"vertical"` | Which way it scrolls: up and down (default), sideways, or both. |
522
+ | `style` | `CSSProperties` | | The size that makes it scroll: `{ maxHeight: 320 }`. Without one the area is as tall as its content and has nothing to scroll. A number is pixels. |
523
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
524
+
525
+ Tested examples: `stories/components/scroll-area.stories.tsx`
526
+
527
+ #### SegmentedControl
528
+
529
+ A few mutually exclusive choices in a grey pill, the chosen one raised on white in teal text. For a view filter that applies at once (All, Active, Inactive); the arrow keys move and choose, like a radio group, which it is.
530
+
531
+ ```ts
532
+ import { SegmentedControl } from "@primecoderin/fast-ui-react";
533
+ ```
534
+
535
+ | Prop | Type | Default | Description |
536
+ | --- | --- | --- | --- |
537
+ | `items` * | `readonly SegmentedItem[]` | | The choices, in order. Each `value` must be unique: it is the choice's key and what `onValueChange` reports. |
538
+ | `value` * | `string` | | The `value` of the chosen item. |
539
+ | `onValueChange` * | `(value: string) => void` | | Called with the `value` of the item chosen, by a click or by the arrow keys. |
540
+ | `aria-label` * | `string` | | Accessible name of the group, e.g. "Filter by status". |
541
+ | `fill` | `boolean` | `false` | Stretch to the width of the container and share it equally; a long label may wrap onto a second line. |
542
+ | `className` | `string` | | Classes for the grey pill around the choices, merged last. |
543
+
544
+ Tested examples: `stories/components/segmented-control.stories.tsx`, `stories/foundations/branding.stories.tsx`
545
+
546
+ #### Separator
547
+
548
+ A thin rule between groups. It is `role="separator"`, so a screen reader announces the break.
549
+
550
+ ```ts
551
+ import { Separator } from "@primecoderin/fast-ui-react";
552
+ ```
553
+
554
+ | Prop | Type | Default | Description |
555
+ | --- | --- | --- | --- |
556
+ | `orientation` | `"vertical" \| "horizontal"` | `"horizontal"` | A horizontal rule (default) or a vertical one, which fills the height of a row. |
557
+ | `tone` | `"strong" \| "default"` | `"default"` | "strong" is darker, for a rule that must be seen on a tinted surface. |
558
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
559
+
560
+ Tested examples: `stories/components/separator.stories.tsx`
561
+
562
+ #### SkeletonCard
563
+
564
+ Placeholder for a card: a heading line and two lines of text.
565
+
566
+ ```ts
567
+ import { SkeletonCard } from "@primecoderin/fast-ui-react";
568
+ ```
569
+
570
+ | Prop | Type | Default | Description |
571
+ | --- | --- | --- | --- |
572
+ | `label` * | `string` | | What is loading, for assistive technology, e.g. "Loading results". |
573
+
574
+
575
+ #### SkeletonItem
576
+
577
+ One placeholder bar. Decorative: the region around it carries the label.
578
+
579
+ ```ts
580
+ import { SkeletonItem } from "@primecoderin/fast-ui-react";
581
+ ```
582
+
583
+ | Prop | Type | Default | Description |
584
+ | --- | --- | --- | --- |
585
+ | `size` | `12 \| 16` | `12` | The bar's height in pixels: 12 (default) for a line of text, 16 for a heading. |
586
+ | `width` | `string` | | The bar's width as a CSS length, e.g. "60%". Without it the bar is as wide as its container. |
587
+ | `className` | `string` | | Classes for the bar, e.g. `flex-1` in a row. |
588
+
589
+
590
+ #### SkeletonTable
591
+
592
+ Placeholder rows for a table that is loading.
593
+
594
+ ```ts
595
+ import { SkeletonTable } from "@primecoderin/fast-ui-react";
596
+ ```
597
+
598
+ | Prop | Type | Default | Description |
599
+ | --- | --- | --- | --- |
600
+ | `label` * | `string` | | What is loading, for assistive technology, e.g. "Loading results". |
601
+ | `rows` | `number` | `5` | How many rows. Default 5. |
602
+ | `columns` | `number` | `4` | How many columns in each row. Default 4. |
603
+
604
+
605
+ #### SkeletonText
606
+
607
+ Placeholder lines for text that has not arrived.
608
+
609
+ ```ts
610
+ import { SkeletonText } from "@primecoderin/fast-ui-react";
611
+ ```
612
+
613
+ | Prop | Type | Default | Description |
614
+ | --- | --- | --- | --- |
615
+ | `label` * | `string` | | What is loading, for assistive technology, e.g. "Loading results". |
616
+ | `lines` | `number` | `3` | How many lines; the last is shorter, as a paragraph's is. Default 3. |
617
+
618
+ Tested examples: `stories/components/skeleton.stories.tsx`
619
+
620
+ #### Slider
621
+
622
+ A slider for a number between `min` and `max`, or for a range of two. The arrow keys move a thumb by `step`, Page Up and Page Down by `largeStep`, Home and End to the ends; dragging the track moves the nearest thumb. It follows the page's direction: in right to left the minimum is at the right.
623
+
624
+ ```ts
625
+ import { Slider } from "@primecoderin/fast-ui-react";
626
+ ```
627
+
628
+ | Prop | Type | Default | Description |
629
+ | --- | --- | --- | --- |
630
+ | `value` * | `TValue` | | One number for one thumb, an array for a range (a thumb for each number, kept in order). |
631
+ | `onValueChange` * | `(value: TValue extends number ? number : number[]) => void` | | Called while the thumb moves, with a number (one thumb) or an array (a range). |
632
+ | `onValueCommitted` | `((value: TValue extends number ? number : number[]) => void)` | | Called once a drag or key press ends: the moment to save, where `onValueChange` would be too often. |
633
+ | `min` | `number` | `0` | The least value, at the start of the track (Home goes there). Default 0. |
634
+ | `max` | `number` | `100` | The greatest value, at the end of the track (End goes there). Default 100. |
635
+ | `step` | `number` | `1` | What one arrow key press changes. Default 1. |
636
+ | `largeStep` | `number` | | What Page Up and Page Down (or Shift and an arrow) change. Default 10. |
637
+ | `minStepsBetweenValues` | `number` | | The least distance between two thumbs of a range, in steps. |
638
+ | `disabled` | `boolean` | `false` | Greys the slider out; its thumbs cannot be moved or focused. |
639
+ | `invalid` | `boolean` | `false` | Marks each thumb's range input invalid (`aria-invalid`) for assistive technology. |
640
+ | `getValueText` | `((formattedValue: string, value: number, index: number) => string)` | | Writes a value as text for a screen reader, e.g. `(text) => `${text} km``. The number as formatted if omitted. |
641
+ | `aria-label` | `string` | | The thumb's name, for one thumb with no label element of its own. A range names each thumb with `thumbLabels`. |
642
+ | `aria-labelledby` | `string` | | The id of the element that names the slider, such as a field's label. |
643
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. Given to each thumb's range input. |
644
+ | `thumbLabels` | `readonly string[]` | | Names the thumbs of a range in order, e.g. ["Minimum price", "Maximum price"]. |
645
+ | `name` | `string` | | The field's name in a submitted form. |
646
+ | `onBlur` | `(() => void)` | | The slider was left. |
647
+ | `id` | `string` | | The id of the first thumb's element: the `<div>` drawn on the track, not the range input inside it, whose id Base UI sets. So a `<label htmlFor>` cannot name the slider; name it with `aria-labelledby` or `aria-label`. |
648
+ | `className` | `string` | | Classes for the slider's outer element (the full-width group around the track), merged last. |
649
+
650
+ Tested examples: `stories/components/slider.stories.tsx`
651
+
652
+ #### Spinner
653
+
654
+ A spinning arc on a faint ring.
655
+
656
+ ```ts
657
+ import { Spinner } from "@primecoderin/fast-ui-react";
658
+ ```
659
+
660
+ | Prop | Type | Default | Description |
661
+ | --- | --- | --- | --- |
662
+ | `size` | `"medium" \| "large" \| "tiny"` | | "tiny" (14px) inside a button, "medium" (20px, the default) on its own, "large" (32px) in an empty area. |
663
+ | `label` | `string` | | What is loading, e.g. "Loading results". With a label the spinner is a status region (`role="status"`): it goes on the page empty and the label goes into it a moment later, as visually hidden text, so that it is a change screen readers report rather than a region that arrives with its text, which they often miss. Without a label it is decorative (inside a busy button, say). |
664
+ | `inherit` | `boolean` | `false` | Draw in the colour of the surrounding text instead of the teal on a grey ring. |
665
+ | `className` | `string` | | Classes for the ring itself, e.g. a margin. |
666
+
667
+ Tested examples: `stories/components/spinner.stories.tsx`
668
+
669
+ #### Stack
670
+
671
+ Children in a row or a column with a gap between them: the layout most of a page is. It sets no colour, size or padding of its own. In a right-to-left page a row runs right to left.
672
+
673
+ ```ts
674
+ import { Stack } from "@primecoderin/fast-ui-react";
675
+ ```
676
+
677
+ | Prop | Type | Default | Description |
678
+ | --- | --- | --- | --- |
679
+ | `direction` | `"column" \| "row"` | `"column"` | A column (default) or a row. |
680
+ | `gap` | `0 \| 1 \| 6 \| 12 \| 5 \| 4 \| 3 \| 2 \| 8 \| 10` | `4` | The space between children, in steps of 4px: 4 is 16px. Default 4. |
681
+ | `align` | `"center" \| "start" \| "end" \| "stretch" \| "baseline"` | | Where children sit across the direction. Default `stretch` in a column and `center` in a row. |
682
+ | `justify` | `"center" \| "start" \| "end" \| "between"` | `"start"` | Where children sit along the direction. Default `start`. |
683
+ | `wrap` | `boolean` | `false` | Let a row of children wrap onto more lines. |
684
+ | `as` | `LayoutElement` | `"div"` | The element: a `div` (default), or a landmark or list where the stack is one. |
685
+
686
+ Tested examples: `stories/components/stack.stories.tsx`
687
+
688
+ #### StateIcon
689
+
690
+ An icon on a round tinted disc: the mark of an empty, success, error or confirmation state.
691
+
692
+ ```ts
693
+ import { StateIcon } from "@primecoderin/fast-ui-react";
694
+ ```
695
+
696
+ | Prop | Type | Default | Description |
697
+ | --- | --- | --- | --- |
698
+ | `icon` * | `ReactNode` | | An icon sized by font-size, e.g. a lucide icon. Decorative: hidden from assistive technology. |
699
+ | `tone` | `ToneName` | `"neutral"` | |
700
+ | `size` | `"small" \| "medium"` | `"medium"` | |
701
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
702
+
703
+ Tested examples: `stories/components/state-icon.stories.tsx`
704
+
705
+ #### StatusBadge
706
+
707
+ Maps a status to a consistent pill. The caller decides which status gets which tone.
708
+
709
+ ```ts
710
+ import { StatusBadge } from "@primecoderin/fast-ui-react";
711
+ ```
712
+
713
+ | Prop | Type | Default | Description |
714
+ | --- | --- | --- | --- |
715
+ | `tone` * | `ToneName` | | |
716
+ | `children` * | `ReactNode` | | The content. |
717
+ | `size` | `"small" \| "medium"` | `"medium"` | |
718
+ | `dot` | `boolean` | `false` | Puts a dot in the tone's colour before the label. |
719
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
720
+
721
+ Tested examples: `stories/components/status-badge.stories.tsx`
722
+
723
+ #### Tabs
724
+
725
+ A row of tabs with an underline on the selected one, above the selected tab's panel.
726
+
727
+ ```ts
728
+ import { Tabs } from "@primecoderin/fast-ui-react";
729
+ ```
730
+
731
+ | Prop | Type | Default | Description |
732
+ | --- | --- | --- | --- |
733
+ | `items` * | `readonly TabItem[]` | | |
734
+ | `value` * | `string` | | The current value. Controlled: the caller keeps this state. |
735
+ | `onValueChange` * | `(value: string) => void` | | Called with the new value when the user picks one; set `value` from it. |
736
+ | `aria-label` * | `string` | | Accessible name of the tab list. |
737
+ | `children` * | `ReactNode` | | The selected tab's content, which the caller picks from `value`. It is the tab panel: the selected tab controls it and names it, so a screen reader tells which tab the content belongs to. |
738
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | |
739
+ | `className` | `string` | | Classes for the tab row, e.g. a margin. |
740
+ | `panelClassName` | `string` | | Classes for the panel. |
741
+
742
+ Tested examples: `stories/components/tabs.stories.tsx`, `stories/foundations/branding.stories.tsx`
743
+
744
+ #### Tag
745
+
746
+ A pill that labels: a category (neutral) or a count (brand). A status takes StatusBadge instead.
747
+
748
+ ```ts
749
+ import { Tag } from "@primecoderin/fast-ui-react";
750
+ ```
751
+
752
+ | Prop | Type | Default | Description |
753
+ | --- | --- | --- | --- |
754
+ | `children` * | `ReactNode` | | The content. |
755
+ | `tone` | `"neutral" \| "brand"` | `"neutral"` | |
756
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | |
757
+ | `strong` | `boolean` | `false` | Semibold, for a count that heads a section. |
758
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
759
+
760
+ Tested examples: `stories/components/tag.stories.tsx`, `stories/foundations/branding.stories.tsx`, `stories/foundations/theming.stories.tsx`
761
+
762
+ #### ToggleButton
763
+
764
+ A two-state button (bold, favourite, mute): `aria-pressed` follows `pressed`. For one choice among several, see ToggleGroup.
765
+
766
+ ```ts
767
+ import { ToggleButton } from "@primecoderin/fast-ui-react";
768
+ ```
769
+
770
+ | Prop | Type | Default | Description |
771
+ | --- | --- | --- | --- |
772
+ | `pressed` * | `boolean` | | Whether the button is pressed. |
773
+ | `onPressedChange` * | `(pressed: boolean) => void` | | Called with the new state when the person presses or releases the button. |
774
+ | `children` | `ReactNode` | | The label. Leave it out for a glyph alone, and give `aria-label`. |
775
+ | `icon` | `ReactNode` | | A glyph before the label. |
776
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | |
777
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
778
+ | `aria-label` | `string` | | The accessible name, for a button with no text of its own. |
779
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
780
+
781
+ Tested examples: `stories/components/toggle-button.stories.tsx`
782
+
783
+ #### ToggleGroup
784
+
785
+ Buttons joined in a row, each pressed or not. One at a time by default, any number with `multiple`; pressing the pressed item releases it, so the value can be empty. For a choice that is always one of several, with the arrow keys moving and choosing, see SegmentedControl. The arrow keys move between the items; Space or Enter presses.
786
+
787
+ ```ts
788
+ import { ToggleGroup } from "@primecoderin/fast-ui-react";
789
+ ```
790
+
791
+ | Prop | Type | Default | Description |
792
+ | --- | --- | --- | --- |
793
+ | `items` * | `readonly ToggleGroupItem[]` | | |
794
+ | `value` * | `readonly string[]` | | The `value`s of the pressed items. |
795
+ | `onValueChange` * | `(value: string[]) => void` | | Called with the `value`s of the pressed items. |
796
+ | `aria-label` * | `string` | | Accessible name of the group, e.g. "Text style". |
797
+ | `multiple` | `boolean` | `false` | Let several items be pressed at once (bold and italic). Otherwise pressing one releases the other. |
798
+ | `size` | `"small" \| "medium" \| "large"` | `"medium"` | |
799
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
800
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
801
+
802
+ Tested examples: `stories/components/toggle-group.stories.tsx`
803
+
804
+ #### Tooltip
805
+
806
+ A short label shown on hover and keyboard focus. Supplementary only: it never appears on touch, so the trigger must have its own accessible name.
807
+
808
+ ```ts
809
+ import { Tooltip } from "@primecoderin/fast-ui-react";
810
+ ```
811
+
812
+ | Prop | Type | Default | Description |
813
+ | --- | --- | --- | --- |
814
+ | `content` * | `ReactNode` | | |
815
+ | `children` * | `ReactElement<unknown, string \| JSXElementConstructor<any>>` | | The element the tooltip describes. It is the trigger itself, so it keeps its own props. |
816
+ | `side` | `"top" \| "bottom" \| "left" \| "right" \| "inline-start" \| "inline-end"` | `"top"` | `inline-start` and `inline-end` follow the text direction. |
817
+
818
+ Tested examples: `stories/components/tooltip.stories.tsx`
819
+
820
+ #### Typography
821
+
822
+ Text in one of the type scale's styles. Use it where a heading or paragraph must match the foundation.
823
+
824
+ ```ts
825
+ import { Typography } from "@primecoderin/fast-ui-react";
826
+ ```
827
+
828
+ | Prop | Type | Default | Description |
829
+ | --- | --- | --- | --- |
830
+ | `variant` | `TextStyleName` | `"body"` | A style of the type scale: display, h1 to h4, body large/regular/small, caption, button, label. |
831
+ | `as` | `TypographyElement` | `"span"` | The element to render. Pick for document structure; the look comes from `variant`. |
832
+ | `tone` | `TypographyTone` | `"primary"` | |
833
+ | `truncate` | `boolean` | `false` | One line, cut off with an ellipsis. |
834
+
835
+ Tested examples: `stories/components/typography.stories.tsx`
836
+
837
+ ### Provider
838
+
839
+ #### DesignSystemProvider
840
+
841
+ Applies the theme, text direction and tenant branding, and hosts the app toaster and the shared tooltip delay. The theme is `data-theme` and the direction is `dir`, both on <html>: the CSS variables switch on the first, logical utilities and the font on the second. They go on the root, not a wrapper element, because Base UI portals (menus, dialogs, tooltips, toasts) render into <body> and would otherwise sit outside a wrapper's theme. DirectionProvider only tells Base UI's own behaviour (arrow keys, popup placement) which way the text runs; it does not touch the DOM. CSPProvider gives Base UI's own inline tags the page's nonce, and the provider puts it on the <style> elements it adds itself, so a strict policy allows them all. One provider per page: what it sets lives on <html>. A provider inside another only tells Base UI's behaviour its `direction` (put the same `dir` on that part of the page yourself); the outer one keeps the theme, the branding and the toaster, so the two cannot undo each other. When the provider unmounts, <html> gets back the `dir` and `data-theme` it had before (none, or the server's), and the theme's and branding's <style> elements go.
842
+
843
+ ```ts
844
+ import { DesignSystemProvider } from "@primecoderin/fast-ui-react";
845
+ ```
846
+
847
+ | Prop | Type | Default | Description |
848
+ | --- | --- | --- | --- |
849
+ | `themeMode` * | `ThemePreference` | | `"light"` or `"dark"`, or `"system"` to follow the operating system's setting, and change with it. |
850
+ | `direction` * | `TextDirection` | | The text direction, `"ltr"` or `"rtl"`: the `dir` on <html>, and the way Base UI's keys and popups run. |
851
+ | `children` * | `ReactNode` | | The app. |
852
+ | `branding` | `TenantBranding \| null` | `null` | A tenant's own primary colour. Omit for the default teal. |
853
+ | `theme` | `Theme \| null` | `null` | A theme made with `createTheme`: the primary colour and any other tokens. |
854
+ | `toastLabels` | `ToastLabelsInput` | | The toasts' titles and dismiss label, in the user's language. Any left out are in English. |
855
+ | `nonce` | `string` | | The page's Content-Security-Policy nonce. It goes on every <style> and <script> tag the design system adds: Base UI's own (a ScrollArea's scrollbar style, a Select aligned with its trigger) and the provider's (the theme, the branding, the instant theme switch). Omit where no policy applies. |
856
+
857
+ Tested examples: `stories/foundations/theming.stories.tsx`
858
+
859
+ ### Patterns
860
+
861
+ #### Accordion
862
+
863
+ Sections that open and close: a heading each, the content under it while it is open. One open at a time by default, any number with `multiple`. Each heading is a button, so Enter and Space open it, and the up and down arrow keys move between the headings. The height eases open (and does not move for a visitor who asks for less motion).
864
+
865
+ ```ts
866
+ import { Accordion } from "@primecoderin/fast-ui-react";
867
+ ```
868
+
869
+ | Prop | Type | Default | Description |
870
+ | --- | --- | --- | --- |
871
+ | `items` * | `readonly AccordionItem[]` | | |
872
+ | `value` | `readonly string[]` | | The `value`s of the open sections. Leave it out to let the accordion keep its own. |
873
+ | `defaultValue` | `readonly string[]` | | The `value`s the sections start open with, when the accordion keeps its own. |
874
+ | `onValueChange` | `((value: string[]) => void)` | | Called with the `value`s of the open sections. |
875
+ | `multiple` | `boolean` | `false` | Let several sections be open at once. Otherwise opening one closes the other. |
876
+ | `headingLevel` | `6 \| 5 \| 4 \| 3 \| 2` | `3` | The level of the section headings, 2 to 6 (default 3). Pick the one below the heading the accordion sits under, so the page's outline stays in order. |
877
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
878
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
879
+
880
+ Tested examples: `stories/patterns/accordion.stories.tsx`
881
+
882
+ #### Alert
883
+
884
+ An inline notification: icon, title, description, an optional action and a close button. An error alert is announced when it appears (`role="alert"`). The other tones are status regions (`role="status"`): a change to their text while they are shown is announced at the next pause, but one that appears with its text is often not announced at all. For a message that must be heard as it happens (a save that worked), keep the Alert on the page and change its text, or say it in another region that is already there.
885
+
886
+ ```ts
887
+ import { Alert } from "@primecoderin/fast-ui-react";
888
+ ```
889
+
890
+ | Prop | Type | Default | Description |
891
+ | --- | --- | --- | --- |
892
+ | `tone` * | `AlertTone` | | The colour, the icon and the live region: "error" is an alert (`role="alert"`), announced when it appears; the others are status regions (`role="status"`). |
893
+ | `title` * | `string` | | The message, in a line, e.g. "Changes saved". |
894
+ | `description` | `ReactNode` | | More detail under the title. |
895
+ | `action` | `{ label: string; onClick: () => void; }` | | An optional inline link under the description. |
896
+ | `className` | `string` | | Classes for the outer element, e.g. a margin. |
897
+ | `onClose` | `(() => void)` | | Adds a close button. |
898
+ | `closeLabel` | `string` | | Accessible name of the close button. |
899
+
900
+ Tested examples: `stories/patterns/alert.stories.tsx`
901
+
902
+ #### AppShell
903
+
904
+ The frame of an application: a sticky header, the navigation down the side, and the page. From the `md` breakpoint the navigation is a column beside the page (`--fast-size-sidenav` wide, `--fast-size-sidenav-collapsed` when collapsed); on a narrower screen it is a drawer that the header's menu button opens and its own close button, Escape or a tap on the page closes, and that closes by itself if the window grows. The page is a `<main>` that a skip link reaches. The sizes are tokens.
905
+
906
+ ```ts
907
+ import { AppShell } from "@primecoderin/fast-ui-react";
908
+ ```
909
+
910
+ | Prop | Type | Default | Description |
911
+ | --- | --- | --- | --- |
912
+ | `header` * | `ReactNode` | | The header: the app's name, search, the account menu. It is a sticky bar the page scrolls under. |
913
+ | `nav` * | `ReactNode` | | The navigation, usually a SideNav. It is a column on a wide screen and the content of a drawer on a narrow one. |
914
+ | `children` * | `ReactNode` | | The page. It is the `<main>`. |
915
+ | `labels` * | `AppShellLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
916
+ | `navOpen` * | `boolean` | | Whether the navigation drawer is open (on a narrow screen). |
917
+ | `onNavOpenChange` * | `(open: boolean) => void` | | Called when the drawer should open or close: the header button, a click outside, Escape. |
918
+ | `navCollapsed` | `boolean` | `false` | Make the navigation column narrow, for icons only (pass the same to SideNav's `collapsed`). |
919
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
920
+
921
+ Tested examples: `stories/patterns/app-shell.stories.tsx`
922
+
923
+ #### Autocomplete
924
+
925
+ A text input with suggestions: the value is whatever is typed, and a list of the suggestions that contain it offers to complete it. Unlike Combobox the text need not be one of the suggestions. The arrow keys move through the list and Enter takes the suggestion.
926
+
927
+ ```ts
928
+ import { Autocomplete } from "@primecoderin/fast-ui-react";
929
+ ```
930
+
931
+ | Prop | Type | Default | Description |
932
+ | --- | --- | --- | --- |
933
+ | `suggestions` * | `readonly string[]` | | The suggestions: the ones that contain the typed text are listed. |
934
+ | `value` * | `string` | | The text in the field: what was typed, or the suggestion that was chosen. |
935
+ | `onValueChange` * | `(value: string) => void` | | Called with the new text as the person types, and with a suggestion's text when one is chosen. |
936
+ | `noMatchesLabel` | `string` | | Shown when the typed text matches no suggestion. If omitted the list is hidden while nothing matches. |
937
+ | `resultsLabel` | `((count: number) => string)` | | The number of suggestions the typed text matches, as a screen reader announces it (politely, as it changes): `(count) => `${count} suggestions``. Nothing is announced if omitted. |
938
+ | `placeholder` | `string` | | |
939
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
940
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
941
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
942
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
943
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
944
+ | `name` | `string` | | The field's name in a submitted form. |
945
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
946
+ | `aria-label` | `string` | | The accessible name of the input and of its list of suggestions, for a field with no label element of its own. Give this or `aria-labelledby`. |
947
+ | `aria-labelledby` | `string` | | The id of the element that names the input and its list, such as a field's label. |
948
+ | `onBlur` | `(() => void)` | | The field was left. |
949
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, for a form library to focus the first invalid field. |
950
+
951
+ Tested examples: `stories/patterns/autocomplete.stories.tsx`
952
+
953
+ #### Breadcrumbs
954
+
955
+ The path to the current page: each ancestor a link, the page itself plain text marked `aria-current="page"`. It is a `<nav>` with an ordered list, so a screen reader announces how many levels there are. The separator points the way the page reads.
956
+
957
+ ```ts
958
+ import { Breadcrumbs } from "@primecoderin/fast-ui-react";
959
+ ```
960
+
961
+ | Prop | Type | Default | Description |
962
+ | --- | --- | --- | --- |
963
+ | `items` * | `readonly BreadcrumbItem[]` | | The path from the top to the current page, in order. The last item is the current page. |
964
+ | `aria-label` * | `string` | | Accessible name of the navigation, e.g. "Breadcrumb". |
965
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
966
+
967
+ Tested examples: `stories/patterns/breadcrumbs.stories.tsx`
968
+
969
+ #### Calendar
970
+
971
+ A month of days on show, to pick one day or a range: the date picker's calendar, inline. The arrow buttons and Page Up and Page Down change the month, the month's name opens a list of months and years, and the arrow keys move between days (the other way in right to left). A range is two clicks, the start and then the end; a click before the start begins again. The weeks start on the locale's first day of the week.
972
+
973
+ ```ts
974
+ import { Calendar } from "@primecoderin/fast-ui-react";
975
+ ```
976
+
977
+ | Prop | Type | Default | Description |
978
+ | --- | --- | --- | --- |
979
+ | `value` * | `string \| DateRangeValue` | | The picked day, "yyyy-MM-dd", or an empty string for none. A day that cannot be read, or does not exist, is none. The picked range: `start` and `end` empty for none, `end` empty while only the start is picked. |
980
+ | `onValueChange` * | `((value: string) => void) \| ((value: DateRangeValue) => void)` | | Called with the day the person picks. Called with the range as it grows: the start alone after the first click, then both. |
981
+ | `mode` | `"range" \| "single"` | | One day. A range: the first click picks the start, the second the end. |
982
+ | `min` | `string` | | The earliest day that can be picked, "yyyy-MM-dd". Earlier days are greyed out. |
983
+ | `max` | `string` | | The latest day that can be picked, "yyyy-MM-dd". |
984
+ | `labels` | `CalendarLabels` | | The texts, in the user's language. English if omitted. |
985
+ | `locale` | `Locale` | | date-fns' locale for the names of months and days and the first day of the week (Monday for `de`), such as `he` from "date-fns/locale/he". English, with weeks from Sunday, if omitted. |
986
+ | `defaultMonth` | `string` | | The month shown first when nothing is picked, as a day or a month: "2026-10-24" or "2026-10". Today's month if omitted or unreadable. |
987
+ | `aria-label` | `string` | | Accessible name of the calendar's group, when it has no heading of its own. |
988
+ | `className` | `string` | | Classes for the calendar's box, e.g. a margin or a width. |
989
+
990
+ Tested examples: `stories/patterns/calendar.stories.tsx`
991
+
992
+ #### Card
993
+
994
+ A surface that groups related content. Pass `onClick` to make the whole card a button: it becomes focusable, Enter and Space click it, and it lifts on hover. A button's content is read as one name, so a clickable card holds plain text: a heading inside it is not announced as a heading, and a control inside it is a control within a button. For a card with headings or its own controls, put a button or link inside the card instead.
995
+
996
+ ```ts
997
+ import { Card } from "@primecoderin/fast-ui-react";
998
+ ```
999
+
1000
+ | Prop | Type | Default | Description |
1001
+ | --- | --- | --- | --- |
1002
+ | `variant` | `CardVariant` | `"standard"` | |
1003
+ | `padding` | `CardPadding` | `"medium"` | |
1004
+
1005
+ Tested examples: `stories/patterns/card.stories.tsx`
1006
+
1007
+ #### Carousel
1008
+
1009
+ Slides in a row that scroll sideways and snap into place: swipe or scroll on a touch screen, the buttons and dots elsewhere. It is a native scroll area, so it needs no script to move and works with the arrow keys once focused. Every slide is in the page for a screen reader. Nothing moves by itself: there is no autoplay. The slides run the way the page reads.
1010
+
1011
+ ```ts
1012
+ import { Carousel } from "@primecoderin/fast-ui-react";
1013
+ ```
1014
+
1015
+ | Prop | Type | Default | Description |
1016
+ | --- | --- | --- | --- |
1017
+ | `children` * | `ReactNode` | | The slides: one child each. |
1018
+ | `labels` * | `CarouselLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1019
+ | `aria-label` * | `string` | | Accessible name of the carousel, e.g. "Featured products". |
1020
+ | `slidesPerView` | `1 \| 3 \| 2` | `1` | How many slides show at once. Default 1. |
1021
+ | `hideIndicators` | `boolean` | `false` | Hide the dots under the slides. Default shows them. |
1022
+ | `onIndexChange` | `((index: number) => void)` | | Called with the index of the first slide in view, as the carousel moves. |
1023
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1024
+
1025
+ Tested examples: `stories/patterns/carousel.stories.tsx`
1026
+
1027
+ #### Cascader
1028
+
1029
+ Choosing through levels: a country, then a region, then a city. A button shows the chosen path and opens columns, one for each level; choosing a step opens its children beside it, and choosing a last step ends the choice. In the columns the up and down keys move, the key toward the end edge opens a step and goes in, the key toward the start edge goes back out, and Enter chooses. For a list of one level, see Combobox.
1030
+
1031
+ ```ts
1032
+ import { Cascader } from "@primecoderin/fast-ui-react";
1033
+ ```
1034
+
1035
+ | Prop | Type | Default | Description |
1036
+ | --- | --- | --- | --- |
1037
+ | `options` * | `readonly CascaderOption[]` | | |
1038
+ | `value` * | `readonly string[]` | | The path to the chosen option: the `value` of each step, from the first column to the last. Empty for none. |
1039
+ | `onValueChange` * | `(value: string[]) => void` | | Called with the path when a last step (an option with no children) is chosen. |
1040
+ | `labels` * | `CascaderLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1041
+ | `placeholder` | `string` | | Shown on the button while nothing is chosen. `labels.choose` if omitted. |
1042
+ | `separator` | `string` | `" / "` | Written between the labels of the path on the button. Default " / ". |
1043
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1044
+ | `invalid` | `boolean` | `false` | Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its message, which `aria-describedby` ties to it. |
1045
+ | `size` | `FieldSize` | `"medium"` | |
1046
+ | `id` | `string` | | |
1047
+ | `aria-label` | `string` | | What names the field when there is no visible label. |
1048
+ | `aria-labelledby` | `string` | | The id of the element that is the field's label; the chosen path is added to the name. |
1049
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1050
+ | `triggerRef` | `Ref<HTMLButtonElement>` | | |
1051
+ | `onBlur` | `(() => void)` | | The cascader was left: the panel closed, or focus moved off the button while closed. |
1052
+
1053
+ Tested examples: `stories/patterns/cascader.stories.tsx`
1054
+
1055
+ #### CheckboxField
1056
+
1057
+ A checkbox with its label, hint and error. It is controlled: it shows `checked` and reports a change through `onCheckedChange`. Bound to react-hook-form, it is FormCheckboxField.
1058
+
1059
+ ```ts
1060
+ import { CheckboxField } from "@primecoderin/fast-ui-react";
1061
+ ```
1062
+
1063
+ | Prop | Type | Default | Description |
1064
+ | --- | --- | --- | --- |
1065
+ | `label` * | `string` | | The visible label. |
1066
+ | `checked` * | `boolean` | | Whether it is checked. Controlled: the caller keeps this state. |
1067
+ | `onCheckedChange` * | `(checked: boolean) => void` | | Called with the new state when the person ticks or clears the box. |
1068
+ | `name` | `string` | | The field's name in a submitted form. |
1069
+ | `hint` | `string` | | |
1070
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the box, which it marks invalid. |
1071
+ | `invalid` | `boolean` | `false` | Marks the field invalid without a message to show. |
1072
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1073
+ | `size` | `"medium" \| "large"` | `"medium"` | "large" is a 20px box (the default is 17px). |
1074
+ | `onBlur` | `(() => void)` | | The checkbox was left. |
1075
+ | `inputRef` | `Ref<HTMLInputElement>` | | The checkbox's hidden input, e.g. for a form library to focus the first invalid field. |
1076
+
1077
+ Tested examples: `stories/patterns/form-fields/checkbox-field.stories.tsx`
1078
+
1079
+ #### ColorPicker
1080
+
1081
+ A colour picker: a button showing the colour that opens a panel with an area for saturation (across) and brightness (up), a hue slider, the hex text and, if given, swatches. The value is hex text. The area is one slider for a screen reader, which reads its position through `labels.areaValue`; the arrow keys move it by 1 (10 with Shift). The panel is always left to right, like the colours it shows.
1082
+
1083
+ ```ts
1084
+ import { ColorPicker } from "@primecoderin/fast-ui-react";
1085
+ ```
1086
+
1087
+ | Prop | Type | Default | Description |
1088
+ | --- | --- | --- | --- |
1089
+ | `value` * | `string` | | The colour as hex, "#6d28d9"; an empty string for none. |
1090
+ | `onValueChange` * | `(value: string) => void` | | Called with the new colour as "#rrggbb" in lower case, as the person picks. |
1091
+ | `labels` * | `ColorPickerLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1092
+ | `swatches` | `readonly string[]` | | Colours offered as one-click choices under the picker, as hex. |
1093
+ | `placeholder` | `string` | | Shown on the button while there is no colour. `labels.choose` if omitted. |
1094
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1095
+ | `invalid` | `boolean` | `false` | Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its message, which `aria-describedby` ties to it. |
1096
+ | `size` | `FieldSize` | `"medium"` | |
1097
+ | `id` | `string` | | |
1098
+ | `aria-label` | `string` | | What names the picker when there is no visible label. `labels.choose` if omitted. |
1099
+ | `aria-labelledby` | `string` | | The id of the element that is the picker's label; the chosen colour is added to the name. |
1100
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1101
+ | `triggerRef` | `Ref<HTMLButtonElement>` | | |
1102
+ | `onBlur` | `(() => void)` | | The picker was left: the panel closed, or focus moved off it while closed. |
1103
+
1104
+ Tested examples: `stories/patterns/color-picker.stories.tsx`
1105
+
1106
+ #### Combobox
1107
+
1108
+ A select you can type into: the box shows the chosen option, typing filters the list to the options that contain the text, and the arrow keys and Enter choose. For a short list that needs no typing, see SelectField; for several choices, MultiSelect; for free text with suggestions, Autocomplete.
1109
+
1110
+ ```ts
1111
+ import { Combobox } from "@primecoderin/fast-ui-react";
1112
+ ```
1113
+
1114
+ | Prop | Type | Default | Description |
1115
+ | --- | --- | --- | --- |
1116
+ | `options` * | `readonly ComboboxOption[]` | | |
1117
+ | `value` * | `string` | | The chosen option's `value`; an empty string for none. |
1118
+ | `onValueChange` * | `(value: string) => void` | | Called with the chosen option's `value`. |
1119
+ | `noMatchesLabel` * | `string` | | Shown when the typed text matches no option. |
1120
+ | `resultsLabel` | `((count: number) => string)` | | The number of options the typed text matches, as a screen reader announces it (politely, as it changes): `(count) => `${count} results``. Nothing is announced if omitted. |
1121
+ | `placeholder` | `string` | | |
1122
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1123
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
1124
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
1125
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1126
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
1127
+ | `name` | `string` | | The field's name in a submitted form. |
1128
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
1129
+ | `aria-label` | `string` | | The accessible name of the input and of its list of options, for a combobox with no label element of its own. Give this or `aria-labelledby`: a `<label htmlFor>` alone names the input but not the list. |
1130
+ | `aria-labelledby` | `string` | | The id of the element that names the input and its list of options, such as a field's label. |
1131
+ | `onBlur` | `(() => void)` | | The combobox was left. |
1132
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, for a form library to focus the first invalid field. |
1133
+
1134
+ Tested examples: `stories/patterns/combobox.stories.tsx`
1135
+
1136
+ #### CommandPalette
1137
+
1138
+ A search box over a list of commands, opened over the page: type to narrow the list, the arrow keys move through it, Enter runs the command and Escape closes. The app opens it, usually from a shortcut such as Ctrl or Cmd and K, and says what each command does. To a screen reader it is a dialog holding a combobox whose list is announced.
1139
+
1140
+ ```ts
1141
+ import { CommandPalette } from "@primecoderin/fast-ui-react";
1142
+ ```
1143
+
1144
+ | Prop | Type | Default | Description |
1145
+ | --- | --- | --- | --- |
1146
+ | `open` * | `boolean` | | Whether the palette is open. Each opening starts with an empty search. |
1147
+ | `onOpenChange` * | `(open: boolean) => void` | | Called with `false` when the palette closes: Escape, a click outside, or a command run. |
1148
+ | `groups` * | `readonly CommandGroup[]` | | The commands, in groups, in the order they are listed. |
1149
+ | `labels` * | `CommandPaletteLabels` | | The palette's name, the search field's placeholder and the no-results text. |
1150
+
1151
+ Tested examples: `stories/patterns/command-palette.stories.tsx`
1152
+
1153
+ #### DataTable
1154
+
1155
+ An edge-to-edge table. When rows are activatable, a click is ignored while the user has text selected, so copying a cell's text does not navigate away.
1156
+
1157
+ ```ts
1158
+ import { DataTable } from "@primecoderin/fast-ui-react";
1159
+ ```
1160
+
1161
+ | Prop | Type | Default | Description |
1162
+ | --- | --- | --- | --- |
1163
+ | `columns` * | `readonly DataTableColumn<TRow>[]` | | The columns, in order from the start edge. |
1164
+ | `rows` * | `readonly TRow[]` | | The rows to show, in the order to show them: sorting and paging are the caller's. |
1165
+ | `getRowId` * | `(row: TRow) => RowId` | | A row's id, unique among the rows: the React key, and what `selection` holds. |
1166
+ | `aria-label` * | `string` | | Accessible name of the table. |
1167
+ | `onRowActivate` | `((row: TRow) => void)` | | Makes rows clickable and keyboard-activatable (Enter or Space): each row becomes a Tab stop. A screen reader hears a row there, not a button, so this is a convenience: give the same action a real control in a cell too, such as a link to the row's page. To open a panel under the row, use `expansion`, which draws its own button. |
1168
+ | `sort` | `DataTableSort` | | The column the rows are sorted by, shown on its header. Sorting itself is the caller's. |
1169
+ | `onSortChange` | `((columnId: string) => void)` | | Called with a sortable column's id when its header is pressed; the caller sorts and sets `sort`. |
1170
+ | `selection` | `DataTableSelection<TRow>` | | Adds a checkbox column. Selected ids may include rows on other pages. |
1171
+ | `expansion` | `DataTableExpansion<TRow>` | | Lets rows expand inline, each with a disclosure button. The caller owns which rows are open. |
1172
+ | `isLoading` | `boolean` | `false` | Shows placeholder rows in place of `rows`. |
1173
+ | `loadingRows` | `number` | `5` | How many placeholder rows to show while loading. |
1174
+ | `emptyState` | `ReactNode` | | Shown under the header when there are no rows. |
1175
+ | `stickyHeader` | `boolean` | `false` | Keep the header in view while the rows scroll inside a bounded container. |
1176
+ | `rowClassName` | `((row: TRow) => string \| undefined)` | | Extra classes for a row's `tr`, e.g. a tint for the rows of one kind. Merged last, so it can override the defaults. |
1177
+ | `virtualPadding` | `{ top: number; bottom: number; }` | | For a windowed list: `rows` is only the part in view, and these are the heights, in pixels, of the rows left out above and below it. They are drawn as empty rows, so the scroll bar is as long as the whole list would be. |
1178
+
1179
+ Tested examples: `stories/patterns/data-table.stories.tsx`
1180
+
1181
+ #### DateRangePicker
1182
+
1183
+ A field that picks a start and an end day: a button showing the range that opens a calendar, where the first click is the start and the second the end, and the panel closes. The value is two day texts. For one day, see DateTimePicker; for a calendar that is always on show, see Calendar.
1184
+
1185
+ ```ts
1186
+ import { DateRangePicker } from "@primecoderin/fast-ui-react";
1187
+ ```
1188
+
1189
+ | Prop | Type | Default | Description |
1190
+ | --- | --- | --- | --- |
1191
+ | `value` * | `DateRangeValue` | | The range: "yyyy-MM-dd" each, `end` empty while only the start is picked. |
1192
+ | `onValueChange` * | `(value: DateRangeValue) => void` | | Called with the range as the person picks. The panel closes once both ends are picked. |
1193
+ | `min` | `string` | | The earliest and latest day that can be picked, "yyyy-MM-dd". |
1194
+ | `max` | `string` | | |
1195
+ | `placeholder` | `string` | | Shown while there is no range. `labels.select` if omitted. |
1196
+ | `labels` | `DateRangePickerLabels` | `ENGLISH_RANGE_LABELS` | The texts of the field and its calendar. English if omitted. |
1197
+ | `locale` | `Locale` | `enUS` | date-fns' locale for the names of months and days and the first day of the week. English, with weeks from Sunday, if omitted. |
1198
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1199
+ | `invalid` | `boolean` | `false` | Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its message, which `aria-describedby` ties to it. |
1200
+ | `size` | `FieldSize` | `"medium"` | |
1201
+ | `icon` | `ReactNode` | | Replaces the calendar glyph at the end of the field. |
1202
+ | `id` | `string` | | |
1203
+ | `aria-label` | `string` | | What names the field when there is no visible label. |
1204
+ | `aria-labelledby` | `string` | | The id of the element that is the field's label; the chosen range is added to the name. |
1205
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1206
+ | `triggerRef` | `Ref<HTMLButtonElement>` | | |
1207
+ | `onBlur` | `(() => void)` | | The picker was left: the panel closed, or focus moved off it while closed. |
1208
+
1209
+ Tested examples: `stories/patterns/date-range-picker.stories.tsx`
1210
+
1211
+ #### DateTimePicker
1212
+
1213
+ A date and time picker: a read-only field with a calendar glyph that opens a panel with the month, the days, the time sliders and Today or Now, Clear and Done. It is a button, so the value is picked and never typed, and it holds its value as the plain text a native `<input type="date">` holds (see `value`), so a form's schema and the code that turns the text into a request need nothing picker-specific. For a field with a label bound to react-hook-form use FormDateTimeField.
1214
+
1215
+ ```ts
1216
+ import { DateTimePicker } from "@primecoderin/fast-ui-react";
1217
+ ```
1218
+
1219
+ | Prop | Type | Default | Description |
1220
+ | --- | --- | --- | --- |
1221
+ | `value` * | `string` | | The value as the matching native input holds it, with no time zone: "2026-10-24" for a date, "2026-10-24T14:05" for a date and time, "14:05" for a time. Empty for none. Turning it into a moment and back is the caller's. |
1222
+ | `onValueChange` * | `(value: string) => void` | | Called with the new value as the person picks, and with "" when they clear it. |
1223
+ | `mode` | `PickerKind` | `"date"` | A day (default), a day and a time, or a time of day. |
1224
+ | `showSeconds` | `boolean` | `false` | Show and set the seconds as well: "14:05:09". For a date and time or a time. |
1225
+ | `min` | `string` | | The earliest and latest value, written as the value is ("2026-10-24"; a date and time may be a day alone, which is that day's first or last moment). Days outside are greyed out and cannot be picked, and a time outside becomes the nearer limit. |
1226
+ | `max` | `string` | | |
1227
+ | `defaultTime` | `string` | | The time a day gets when it is picked and the value has none: "00:00" for the start of a range, "23:59" for its end. The time now if omitted. Seconds are dropped unless `showSeconds`. |
1228
+ | `clearable` | `boolean` | `false` | Offer Clear, which empties the value. |
1229
+ | `showNow` | `boolean` | `true` | Offer Today (a date) or Now. Default true. |
1230
+ | `display` | `"full" \| "dayMonth"` | `"full"` | "dayMonth" shows a date as "24 October", for a date whose year does not matter (a season's first day). |
1231
+ | `placeholder` | `string` | | Shown while there is no value. `labels.select` if omitted. |
1232
+ | `labels` | `DateTimePickerLabels` | `ENGLISH_PICKER_LABELS` | The texts of the field and its panel, in the user's language. English if omitted. |
1233
+ | `locale` | `Locale` | `enUS` | date-fns' locale for the names of months and days and the first day of the week (Monday for `de`), such as `he` from "date-fns/locale/he". English, with weeks from Sunday, if omitted. Dates are always written day first and times in 24 hours, whatever the locale. |
1234
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1235
+ | `invalid` | `boolean` | `false` | Draws the red border. A button cannot carry aria-invalid, so the field is announced as invalid through its message, which `aria-describedby` ties to it. |
1236
+ | `size` | `FieldSize` | `"medium"` | |
1237
+ | `icon` | `ReactNode` | | Replaces the calendar (or, for a time, clock) glyph at the end of the field. |
1238
+ | `id` | `string` | | |
1239
+ | `aria-label` | `string` | | What names the field when there is no visible label. |
1240
+ | `aria-labelledby` | `string` | | The id of the element that is the field's label; the chosen value is added to the name. |
1241
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1242
+ | `triggerRef` | `Ref<HTMLButtonElement>` | | |
1243
+ | `onBlur` | `(() => void)` | | The picker was left: the panel closed, or focus moved off it while closed. |
1244
+
1245
+ Tested examples: `stories/patterns/date-time-picker.stories.tsx`
1246
+
1247
+ #### DescriptionList
1248
+
1249
+ The details of one record as term and value pairs: an order's status, date and total. It is a `<dl>`, so a screen reader announces each value with its term. For a table of many records, see DataTable.
1250
+
1251
+ ```ts
1252
+ import { DescriptionList } from "@primecoderin/fast-ui-react";
1253
+ ```
1254
+
1255
+ | Prop | Type | Default | Description |
1256
+ | --- | --- | --- | --- |
1257
+ | `items` * | `readonly DescriptionListItem[]` | | |
1258
+ | `layout` | `"horizontal" \| "stacked"` | `"stacked"` | "stacked" (default) puts the term over its value; "horizontal" puts the terms in a column beside the values. |
1259
+ | `dividers` | `boolean` | `false` | A rule between the pairs. |
1260
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1261
+
1262
+ Tested examples: `stories/patterns/description-list.stories.tsx`
1263
+
1264
+ #### Dialog
1265
+
1266
+ A modal dialog, opened and closed by its caller through `open` and `onOpenChange`: a header with an icon tile, eyebrow, title and close button, a body that scrolls, and a footer of actions.
1267
+
1268
+ ```ts
1269
+ import { Dialog } from "@primecoderin/fast-ui-react";
1270
+ ```
1271
+
1272
+ | Prop | Type | Default | Description |
1273
+ | --- | --- | --- | --- |
1274
+ | `open` * | `boolean` | | Whether it is open. Controlled: the caller keeps this state. |
1275
+ | `onOpenChange` * | `(open: boolean) => void` | | Called with the next open state (false on Escape, an outside click or a close button); set `open` from it. |
1276
+ | `title` * | `string` | | The title, shown and used as the accessible name. |
1277
+ | `children` * | `ReactNode` | | The content. |
1278
+ | `eyebrow` | `string` | | The small teal line above the title, e.g. the section the dialog belongs to. |
1279
+ | `icon` | `ReactNode` | | An icon in a teal tile before the title. |
1280
+ | `description` | `string` | | One small grey line under the title, e.g. an id. |
1281
+ | `actions` | `ReactNode` | | Footer buttons, end-aligned in the order given: Cancel first, then the primary action. |
1282
+ | `closeLabel` | `string` | | Accessible name for the close (X) button. The button is omitted when not provided. |
1283
+ | `modalType` | `"modal" \| "alert"` | `"modal"` | "alert" blocks outside-click and Escape dismissal, for decisions that must be answered. |
1284
+ | `size` | `"default" \| "narrow" \| "wide"` | `"default"` | Widest the dialog grows: 480px, 800px (default) or 940px. |
1285
+
1286
+ Tested examples: `stories/patterns/dialog.stories.tsx`
1287
+
1288
+ #### Drawer
1289
+
1290
+ A full-height panel that slides in at one edge over a dimmed page: navigation on a narrow screen (`start`), or filters and details (`end`). A header (glyph, title, an action), scrolling content and a footer; with `hideTitle`, only the content. Opening it puts the cursor in its first field, if it has one; Escape or a click on the page closes it, and focus stays inside while it is open.
1291
+
1292
+ ```ts
1293
+ import { Drawer } from "@primecoderin/fast-ui-react";
1294
+ ```
1295
+
1296
+ | Prop | Type | Default | Description |
1297
+ | --- | --- | --- | --- |
1298
+ | `open` * | `boolean` | | Whether it is open. Controlled: the caller keeps this state. |
1299
+ | `onOpenChange` * | `(open: boolean) => void` | | Called with the next open state (false on Escape, an outside click or a close button); set `open` from it. |
1300
+ | `title` * | `string` | | The drawer's name: shown in its header, and its accessible name. |
1301
+ | `children` * | `ReactNode` | | The content. |
1302
+ | `hideTitle` | `boolean` | `false` | Keep the title for assistive technology only, and draw no header: e.g. navigation that has its own heading. |
1303
+ | `side` | `DrawerSide` | `"end"` | |
1304
+ | `icon` | `ReactNode` | | A small glyph before the title. |
1305
+ | `headerAction` | `ReactNode` | | At the end of the header, e.g. a Reset button. |
1306
+ | `footer` | `ReactNode` | | Pinned under the content, e.g. the Apply button. |
1307
+ | `onSubmit` | `((event: SubmitEvent<HTMLFormElement>) => void)` | | Makes the content and footer one form, so Enter in a field submits it. |
1308
+ | `padding` | `DrawerPadding` | `"medium"` | |
1309
+ | `className` | `string` | | On the panel, e.g. a width: `w-[min(420px,90vw)]`. |
1310
+
1311
+ Tested examples: `stories/patterns/drawer.stories.tsx`
1312
+
1313
+ #### EmptyState
1314
+
1315
+ What a view shows when it has nothing to show: a title, an optional line, an icon and a call to action. It is a status region by default and an alert with `announce="assertive"` for a failure. A status region that appears with its text is often not announced, so where an empty result must be heard as it happens (a search that found nothing), also say so in a region that is already on the page, such as a results count. `variant="inline"` is the compact form for a table's empty row.
1316
+
1317
+ ```ts
1318
+ import { EmptyState } from "@primecoderin/fast-ui-react";
1319
+ ```
1320
+
1321
+ | Prop | Type | Default | Description |
1322
+ | --- | --- | --- | --- |
1323
+ | `title` * | `string` | | What the view has none of, e.g. "No projects yet". |
1324
+ | `description` | `string` | | A line under the title: why, or what to do next. |
1325
+ | `icon` | `ReactNode` | `<Search />` | The glyph on the disc or tile. Default a magnifying glass. |
1326
+ | `tone` | `ToneName` | `"neutral"` | The disc's colour, for `variant="page"`. Default neutral. |
1327
+ | `action` | `ReactNode` | | An optional call to action, e.g. a "Clear filters" button. |
1328
+ | `announce` | `"polite" \| "assertive"` | `"polite"` | The live region it is. "polite" (default) is a status region (`role="status"`): a change to its text while it is shown is announced at the next pause, but one that appears with its text is often not announced at all. "assertive", for a failure, is an alert (`role="alert"`), which is announced when it appears. |
1329
+ | `variant` | `"page" \| "inline"` | `"page"` | "page" fills a page or a card: an icon on a large disc. "inline" sits in a table's place (Figma's empty row): a small teal tile, a 13px title, one line. |
1330
+ | `className` | `string` | | Classes for the outer element, e.g. a height. |
1331
+
1332
+ Tested examples: `stories/patterns/empty-state.stories.tsx`
1333
+
1334
+ #### FieldFrame
1335
+
1336
+ The shared shell of every form field: label, control, validation message and hint, in a column or with the label beside the control. The field's state (invalid, and touched and dirty when a form library tracks them) goes through Base UI's Field, so the control is labelled and described for assistive technology automatically (for a control Base UI does not describe, see `messageIds`). Every field of the design system is built on it.
1337
+
1338
+ ```ts
1339
+ import { FieldFrame } from "@primecoderin/fast-ui-react";
1340
+ ```
1341
+
1342
+ | Prop | Type | Default | Description |
1343
+ | --- | --- | --- | --- |
1344
+ | `label` * | `string` | | The field's label, above the control or beside it. It names the control. |
1345
+ | `invalid` * | `boolean` | | Marks the field and its control invalid; the label turns red. |
1346
+ | `children` * | `ReactNode` | | The control. |
1347
+ | `name` | `string` | | The field's name: it identifies the field to Base UI and in a submitted form. |
1348
+ | `hideLabel` | `boolean` | `false` | Keep the label out of the layout and give it to assistive technology only. |
1349
+ | `hint` | `string` | | Help under the control, in grey; it describes the control. |
1350
+ | `required` | `boolean` | `false` | Adds the asterisk to the label. It does not mark the control: give the control `aria-required` too. |
1351
+ | `disabled` | `boolean` | `false` | Disables the field: Base UI controls inside it are disabled with it (a plain `<input>` needs its own `disabled`). |
1352
+ | `errorMessage` | `string` | | The validation message, already formatted for display. |
1353
+ | `successMessage` | `string` | | Shown instead of nothing when there is no error, in green, with a check. It describes the control and is announced when it appears. |
1354
+ | `touched` | `boolean` | | The field has been left. Base UI tracks it itself when omitted. |
1355
+ | `dirty` | `boolean` | | The value differs from the first one. Base UI tracks it itself when omitted. |
1356
+ | `orientation` | `FieldOrientation` | `"vertical"` | Label above the control (default) or in a column beside it. |
1357
+ | `size` | `FieldSize` | `"medium"` | The control's size, which sets the gap under the label. |
1358
+ | `triggerLabel` | `boolean` | `false` | The control is a button that opens a popup (select, combobox). Its label must not behave as a native <label>, which would also click the button. |
1359
+ | `labelId` | `string` | | The label's DOM id, for a control that names itself with `aria-labelledby` (a trigger whose button text is the chosen value, so it needs the label and the value both). |
1360
+ | `messageIds` | `{ error: string; hint: string; }` | | DOM ids for the validation message and the hint, for a control that Base UI does not describe by itself (a button that opens a panel): it lists them in its `aria-describedby`. |
1361
+
1362
+ Tested examples: `stories/patterns/form-fields/field-frame.stories.tsx`
1363
+
1364
+ #### FileUpload
1365
+
1366
+ A drop area and a button for choosing files, and the list of what was chosen, each with its size, a progress bar if the app reports one, and a button that removes it. Files are checked against `accept`, `maxSize` and `maxFiles` as they are added; what is refused is reported, not shown, so the app words it. The drop is for the pointer; the button is for everyone else. Sending the files is the app's; a form the browser submits itself sends them under `name`. A file's error is announced when the app sets it, and describes its Remove button.
1367
+
1368
+ ```ts
1369
+ import { FileUpload } from "@primecoderin/fast-ui-react";
1370
+ ```
1371
+
1372
+ | Prop | Type | Default | Description |
1373
+ | --- | --- | --- | --- |
1374
+ | `value` * | `readonly File[]` | | The chosen files, in the order they were added. |
1375
+ | `onValueChange` * | `(files: File[]) => void` | | Called with the new list when files are added or removed. |
1376
+ | `labels` * | `FileUploadLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1377
+ | `accept` | `string` | | The kinds of file it takes, as the file input writes them: `"image/*,.pdf"`. Anything if omitted. |
1378
+ | `multiple` | `boolean` | `false` | Let several files be chosen. Otherwise a new choice replaces the one before, and of several files dropped at once the first that passes is taken and the others are reported to `onReject` as `count`. |
1379
+ | `maxSize` | `number` | | The largest a file may be, in bytes. |
1380
+ | `maxFiles` | `number` | | The most files the list takes. |
1381
+ | `onReject` | `((rejections: FileUploadRejection[]) => void)` | | Called with the files that were not added and why, so the app can tell the person in its own words. The files that were fine are added regardless. |
1382
+ | `statuses` | `ReadonlyMap<File, FileUploadStatus>` | | Progress and errors of the files, by file: the app sets them as it sends them. |
1383
+ | `description` | `string` | | A line in the drop area under the button: the limits, e.g. "PNG or JPG, up to 5 MB". |
1384
+ | `locale` | `string` | | The locale that writes the sizes, a BCP 47 tag. If omitted, the runtime's default locale (the browser's, or the server's when rendered there), not the page's `lang`. |
1385
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1386
+ | `invalid` | `boolean` | `false` | Draws the drop area red and marks it invalid for assistive technology. |
1387
+ | `name` | `string` | | The field's name in a submitted form. A hidden file input holds the chosen files, so a form the browser submits itself sends them under this name (where the browser can set a file input's files, as current browsers can). |
1388
+ | `id` | `string` | | |
1389
+ | `aria-label` | `string` | | The accessible name of the drop area, for an upload with no label element of its own. |
1390
+ | `aria-labelledby` | `string` | | The id of the element that names the drop area, such as a field's label. |
1391
+ | `aria-describedby` | `string` | | The ids of the field's message and hint. They describe the drop area and its Browse button, which takes the focus. |
1392
+ | `onBlur` | `(() => void)` | | The upload was left. |
1393
+ | `buttonRef` | `Ref<HTMLButtonElement>` | | The button that opens the chooser, for a form library to focus the first invalid field. |
1394
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1395
+
1396
+ Tested examples: `stories/patterns/file-upload.stories.tsx`
1397
+
1398
+ #### List
1399
+
1400
+ Rows of text with an icon or avatar at the start and something at the end: contacts, files, notifications. A row can be a link, or a choice (one, or several, with the arrow keys or Tab and Space). Plain, it is a list a screen reader counts. For many records with columns, see DataTable.
1401
+
1402
+ ```ts
1403
+ import { List } from "@primecoderin/fast-ui-react";
1404
+ ```
1405
+
1406
+ | Prop | Type | Default | Description |
1407
+ | --- | --- | --- | --- |
1408
+ | `items` * | `readonly ListItem[]` | | |
1409
+ | `aria-label` * | `string` | | Accessible name of the list (of the group, when rows can be chosen). |
1410
+ | `selection` | `"none" \| "multiple" \| "single"` | `"none"` | Whether rows can be chosen: none (default), one (a choice, like radio buttons), or several (like checkboxes). |
1411
+ | `value` | `readonly string[]` | `[]` | The `id`s of the chosen rows. For `single` it holds one at most. |
1412
+ | `onValueChange` | `((value: string[]) => void)` | | Called with the `id`s of the chosen rows. |
1413
+ | `dividers` | `boolean` | `true` | A rule between the rows. |
1414
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1415
+
1416
+ Tested examples: `stories/patterns/list.stories.tsx`
1417
+
1418
+ #### MentionsInput
1419
+
1420
+ A text area that suggests people as you type their name after "@": the list filters as you type, the arrow keys move through it, Enter or Tab writes the name into the text and Escape closes the list. The value is plain text, so the app finds the mentions it needs in it. To a screen reader it is a text box whose suggestions are announced as the arrow keys move through them.
1421
+
1422
+ ```ts
1423
+ import { MentionsInput } from "@primecoderin/fast-ui-react";
1424
+ ```
1425
+
1426
+ | Prop | Type | Default | Description |
1427
+ | --- | --- | --- | --- |
1428
+ | `value` * | `string` | | The text, with each mention written as the trigger and the name: "Ask |
1429
+ | `onValueChange` * | `(value: string) => void` | | Called with the text as it is typed, and when a person is chosen from the list. |
1430
+ | `suggestions` * | `readonly MentionSuggestion[]` | | The people that can be mentioned. |
1431
+ | `trigger` | `string` | `"@"` | The character that starts a mention. Default "@". |
1432
+ | `onMention` | `((suggestion: MentionSuggestion) => void)` | | Called with the person when one is chosen from the list. |
1433
+ | `maxSuggestions` | `number` | `6` | The most suggestions listed. Default 6. |
1434
+ | `placeholder` | `string` | | Shown in the empty text area, e.g. "Type @ to mention someone". |
1435
+ | `rows` | `number` | `4` | The height of the text area in lines. Default 4. |
1436
+ | `disabled` | `boolean` | `false` | Makes the text area read only and greyed. |
1437
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the text area invalid for assistive technology. |
1438
+ | `required` | `boolean` | `false` | Marks the text area required for assistive technology; the label shows the asterisk. |
1439
+ | `size` | `FieldSize` | `"medium"` | The field size, as the other inputs have it. Default `medium`. |
1440
+ | `id` | `string` | | For a `<label htmlFor>` that names the text area. The list of suggestions is then named only by `aria-label`. |
1441
+ | `aria-label` | `string` | | What names the text area, and its list of suggestions, when there is no visible label. |
1442
+ | `aria-labelledby` | `string` | | The id of the element that names the text area and its list of suggestions, such as a field's label. |
1443
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1444
+ | `onBlur` | `(() => void)` | | The text area was left. |
1445
+ | `inputRef` | `Ref<HTMLTextAreaElement>` | | The `<textarea>`, for a form library to focus the first invalid field. |
1446
+ | `className` | `string` | | Extra classes for the box around the text area and its list. Merged last. |
1447
+
1448
+ Tested examples: `stories/patterns/mentions-input.stories.tsx`
1449
+
1450
+ #### Menubar
1451
+
1452
+ An application's menu bar (File, Edit, View): a row of menus that is one stop in the Tab order. The left and right arrow keys move between the menus (the other way in right to left), and while one is open, moving to another opens it at once. Each menu's items are Menu's.
1453
+
1454
+ ```ts
1455
+ import { Menubar } from "@primecoderin/fast-ui-react";
1456
+ ```
1457
+
1458
+ | Prop | Type | Default | Description |
1459
+ | --- | --- | --- | --- |
1460
+ | `children` * | `ReactNode` | | The menus: one MenubarMenu each. |
1461
+ | `aria-label` * | `string` | | Accessible name of the bar, e.g. "Application". |
1462
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1463
+
1464
+ Tested examples: `stories/patterns/menubar.stories.tsx`
1465
+
1466
+ #### MenubarMenu
1467
+
1468
+ One menu of a Menubar.
1469
+
1470
+ ```ts
1471
+ import { MenubarMenu } from "@primecoderin/fast-ui-react";
1472
+ ```
1473
+
1474
+ | Prop | Type | Default | Description |
1475
+ | --- | --- | --- | --- |
1476
+ | `label` * | `string` | | The button on the bar that opens the menu. |
1477
+ | `children` * | `ReactNode` | | The menu's items: MenuItem, MenuSeparator, MenuSubmenu and the rest of Menu's parts. |
1478
+
1479
+
1480
+ #### MultiSelect
1481
+
1482
+ A select for several options. The chosen ones are chips in the box, each with a button that removes it, and the box grows onto more lines as chips are added. Typing filters the list, the arrow keys and Enter add an option and the list stays open for the next; Backspace in the empty input removes the last chip.
1483
+
1484
+ ```ts
1485
+ import { MultiSelect } from "@primecoderin/fast-ui-react";
1486
+ ```
1487
+
1488
+ | Prop | Type | Default | Description |
1489
+ | --- | --- | --- | --- |
1490
+ | `options` * | `readonly ComboboxOption[]` | | |
1491
+ | `value` * | `readonly string[]` | | The `value`s of the chosen options, in the order they were chosen. |
1492
+ | `onValueChange` * | `(value: string[]) => void` | | Called with the `value`s of the chosen options. |
1493
+ | `labels` * | `MultiSelectLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1494
+ | `placeholder` | `string` | | |
1495
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1496
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
1497
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
1498
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1499
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
1500
+ | `name` | `string` | | The field's name in a submitted form. |
1501
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
1502
+ | `aria-label` | `string` | | The accessible name of the input and of its list of options, for a control with no label element of its own. Give this or `aria-labelledby`. |
1503
+ | `aria-labelledby` | `string` | | The id of the element that names the input and its list of options, such as a field's label. |
1504
+ | `onBlur` | `(() => void)` | | The control was left. |
1505
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, for a form library to focus the first invalid field. |
1506
+
1507
+ Tested examples: `stories/patterns/multi-select.stories.tsx`
1508
+
1509
+ #### NavigationMenu
1510
+
1511
+ The top navigation of a site: links, and buttons that open a panel of more links. The panels open on hover and on click, and the arrow keys move between the items and into a panel; Escape closes one. For navigation down the side of the page, see SideNav.
1512
+
1513
+ ```ts
1514
+ import { NavigationMenu } from "@primecoderin/fast-ui-react";
1515
+ ```
1516
+
1517
+ | Prop | Type | Default | Description |
1518
+ | --- | --- | --- | --- |
1519
+ | `items` * | `readonly NavigationMenuItem[]` | | |
1520
+ | `aria-label` * | `string` | | Accessible name of the navigation, e.g. "Main". |
1521
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1522
+
1523
+ Tested examples: `stories/patterns/navigation-menu.stories.tsx`
1524
+
1525
+ #### NumberField
1526
+
1527
+ A number input with a button at each end to step it. Typing is free and checked on leaving (a number out of `min` and `max` snaps back), the up and down arrow keys step, and `format` and `locale` write the number the way the user reads it. The number reads left to right in a right-to-left language too, while the buttons follow the page. Inside a FormNumberField it is labelled and described by the field.
1528
+
1529
+ ```ts
1530
+ import { NumberField } from "@primecoderin/fast-ui-react";
1531
+ ```
1532
+
1533
+ | Prop | Type | Default | Description |
1534
+ | --- | --- | --- | --- |
1535
+ | `value` * | `number \| null` | | The number, or null for an empty field. |
1536
+ | `onValueChange` * | `(value: number \| null) => void` | | Called with the new number as the person types or steps, and with null when the field is emptied. |
1537
+ | `labels` * | `NumberFieldLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1538
+ | `min` | `number` | | |
1539
+ | `max` | `number` | | |
1540
+ | `step` | `number` | `1` | What the buttons and the up and down arrow keys change. Default 1. |
1541
+ | `largeStep` | `number` | | What Shift with the arrow keys (or Page Up and Page Down) change. Default 10. |
1542
+ | `format` | `NumberFormatOptions` | | How the number is written: `{ style: "currency", currency: "USD" }`, `{ maximumFractionDigits: 1 }`. |
1543
+ | `locale` | `LocalesArgument` | | The locale that writes and reads the number. The page's if omitted. |
1544
+ | `placeholder` | `string` | | |
1545
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1546
+ | `readOnly` | `boolean` | `false` | |
1547
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
1548
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
1549
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1550
+ | `contentBefore` | `ReactNode` | | A decorative icon or unit at the start of the box. |
1551
+ | `name` | `string` | | The field's name in a submitted form. |
1552
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
1553
+ | `aria-label` | `string` | | The accessible name of the input, for a number with no label element of its own. |
1554
+ | `aria-labelledby` | `string` | | The id of the element that names the input, such as a field's label. |
1555
+ | `onBlur` | `(() => void)` | | The field was left. |
1556
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, for a form library to focus the first invalid field. |
1557
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1558
+
1559
+ Tested examples: `stories/patterns/number-field.stories.tsx`
1560
+
1561
+ #### Pagination
1562
+
1563
+ Previous, page numbers, next, a page-size select and a "Showing 1–20 of 250" summary.
1564
+
1565
+ ```ts
1566
+ import { Pagination } from "@primecoderin/fast-ui-react";
1567
+ ```
1568
+
1569
+ | Prop | Type | Default | Description |
1570
+ | --- | --- | --- | --- |
1571
+ | `page` * | `number` | | The current page, counting from 1. |
1572
+ | `pageSize` * | `number` | | |
1573
+ | `totalItems` * | `number` | | |
1574
+ | `onPageChange` * | `(page: number) => void` | | |
1575
+ | `labels` * | `PaginationLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1576
+ | `onPageSizeChange` | `((pageSize: number) => void)` | | With `pageSizeOptions`, shows a page-size select. |
1577
+ | `pageSizeOptions` | `readonly number[]` | | |
1578
+
1579
+ Tested examples: `stories/foundations/branding.stories.tsx`, `stories/patterns/pagination.stories.tsx`
1580
+
1581
+ #### PhoneField
1582
+
1583
+ A phone number: a searchable calling-code picker and a digits-only number in one box, holding the number in E.164. The box is always left to right: numbers read that way in a right-to-left language too. A number pasted with its calling code ("+44 7700 900123") sets the code as well as the digits. It is controlled: it shows `value` and reports each change through `onValueChange`; clearing the digits keeps the calling code shown. Bound to react-hook-form, it is FormPhoneField.
1584
+
1585
+ ```ts
1586
+ import { PhoneField } from "@primecoderin/fast-ui-react";
1587
+ ```
1588
+
1589
+ | Prop | Type | Default | Description |
1590
+ | --- | --- | --- | --- |
1591
+ | `label` * | `string` | | The visible label. |
1592
+ | `value` * | `string` | | The number in E.164: the calling code and the digits with nothing between, e.g. "+12025550123" (`joinPhone` and `splitPhone` convert it). An empty string for none. |
1593
+ | `onValueChange` * | `(value: string) => void` | | Called with the new number in E.164, or "" when the digits are cleared. |
1594
+ | `countries` * | `readonly PhoneCountry[]` | | |
1595
+ | `defaultDialCode` * | `string` | | The calling code shown while no number has been entered. |
1596
+ | `labels` * | `PhoneFieldLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1597
+ | `name` | `string` | | The field's name in a submitted form. |
1598
+ | `placeholder` | `string` | | |
1599
+ | `maxDigits` | `number` | `13` | The most digits the number takes. |
1600
+ | `hint` | `string` | | |
1601
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the field, which it marks invalid. |
1602
+ | `invalid` | `boolean` | `false` | Marks the field invalid without a message to show. |
1603
+ | `required` | `boolean` | | |
1604
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1605
+ | `size` | `FieldSize` | `"medium"` | |
1606
+ | `orientation` | `FieldOrientation` | | |
1607
+ | `onBlur` | `(() => void)` | | The calling code or the number was left. |
1608
+ | `inputRef` | `Ref<HTMLInputElement>` | | The number's `<input>`, e.g. for a form library to focus the first invalid field. |
1609
+
1610
+ Tested examples: `stories/patterns/form-fields/phone-field.stories.tsx`
1611
+
1612
+ #### RadioGroupField
1613
+
1614
+ A labelled radio group with the design system's hint and error. It is controlled: it checks the option whose `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is FormRadioGroupField.
1615
+
1616
+ ```ts
1617
+ import { RadioGroupField } from "@primecoderin/fast-ui-react";
1618
+ ```
1619
+
1620
+ | Prop | Type | Default | Description |
1621
+ | --- | --- | --- | --- |
1622
+ | `label` * | `string` | | The visible label. |
1623
+ | `options` * | `readonly RadioOption[]` | | |
1624
+ | `value` * | `string` | | The chosen option's `value`; an empty string for none. |
1625
+ | `onValueChange` * | `(value: string) => void` | | Called with the chosen option's `value`. |
1626
+ | `name` | `string` | | The field's name in a submitted form. |
1627
+ | `hint` | `string` | | |
1628
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the group, which it marks invalid. |
1629
+ | `invalid` | `boolean` | `false` | Marks the group invalid without a message to show. |
1630
+ | `required` | `boolean` | `false` | |
1631
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1632
+ | `orientation` | `FieldOrientation` | `"vertical"` | Label above the group (default) or in a column beside it. |
1633
+ | `layout` | `"vertical" \| "horizontal"` | `"vertical"` | Lay the options out in a column (default) or a row. |
1634
+ | `onBlur` | `(() => void)` | | An option was left. |
1635
+ | `inputRef` | `Ref<HTMLInputElement>` | | The group's hidden input, e.g. for a form library to focus the first invalid field. |
1636
+
1637
+ Tested examples: `stories/patterns/form-fields/radio-group-field.stories.tsx`
1638
+
1639
+ #### ResizablePanels
1640
+
1641
+ Panels with dividers between them that the person drags to give one more room and the next less. The dividers are focusable separators with a value, so the arrow keys move them too (1%, or 10% with Shift), and Home and End take the panel before to its least and most. Side by side, the panels run the way the page reads. Give the container a height.
1642
+
1643
+ ```ts
1644
+ import { ResizablePanels } from "@primecoderin/fast-ui-react";
1645
+ ```
1646
+
1647
+ | Prop | Type | Default | Description |
1648
+ | --- | --- | --- | --- |
1649
+ | `panels` * | `readonly ResizablePanel[]` | | |
1650
+ | `labels` * | `ResizablePanelsLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1651
+ | `orientation` | `"vertical" \| "horizontal"` | `"horizontal"` | Side by side (default) or one above the other. |
1652
+ | `sizes` | `readonly number[]` | | The sizes in percent, one for each panel, adding up to 100. Leave it out to let the panels keep their own. |
1653
+ | `onSizesChange` | `((sizes: number[]) => void)` | | Called with the sizes as a divider moves. |
1654
+ | `aria-label` | `string` | | What the panels are, e.g. "Mail". A group's name. |
1655
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1656
+
1657
+ Tested examples: `stories/patterns/resizable-panels.stories.tsx`
1658
+
1659
+ #### SearchInput
1660
+
1661
+ Figma's search input: a magnifier at the start and, once there is text, a clear button at the end. It is the box every input uses (`fieldControl`), so it hovers, focuses and disables like them and lines up beside a FormTextField in a filter bar. Controlled; the caller debounces.
1662
+
1663
+ ```ts
1664
+ import { SearchInput } from "@primecoderin/fast-ui-react";
1665
+ ```
1666
+
1667
+ | Prop | Type | Default | Description |
1668
+ | --- | --- | --- | --- |
1669
+ | `value` * | `string` | | The search text. |
1670
+ | `onValueChange` * | `(value: string) => void` | | Called with the whole text as each key is pressed, and with "" when the clear button empties it. Debounce it yourself. |
1671
+ | `aria-label` * | `string` | | Accessible name of the input. |
1672
+ | `clearLabel` * | `string` | | Accessible name of the clear button that appears once there is text. |
1673
+ | `placeholder` | `string` | | Shown while the input is empty, e.g. "Search projects". It does not name the input: give `aria-label`. |
1674
+ | `size` | `FieldSize` | `"medium"` | The box's height: "small" 32px, "medium" 42px (the default), "large" 46px, as the other fields. |
1675
+ | `disabled` | `boolean` | `false` | Greys the box out; the input cannot be focused and the clear button is not shown. |
1676
+ | `className` | `string` | | Classes for the box around the input, merged last. |
1677
+
1678
+ Tested examples: `stories/patterns/search-input.stories.tsx`
1679
+
1680
+ #### SelectField
1681
+
1682
+ A labelled select with the design system's hint and error. It is controlled: it shows the option whose `value` is `value` and reports a choice through `onValueChange`. Bound to react-hook-form, it is FormSelectField.
1683
+
1684
+ ```ts
1685
+ import { SelectField } from "@primecoderin/fast-ui-react";
1686
+ ```
1687
+
1688
+ | Prop | Type | Default | Description |
1689
+ | --- | --- | --- | --- |
1690
+ | `label` * | `string` | | The visible label. |
1691
+ | `options` * | `readonly SelectOption[]` | | |
1692
+ | `value` * | `string` | | The chosen option's `value`; an empty string for none, which shows the placeholder. |
1693
+ | `onValueChange` * | `(value: string) => void` | | Called with the chosen option's `value`. |
1694
+ | `name` | `string` | | The field's name in a submitted form. |
1695
+ | `placeholder` | `string` | | |
1696
+ | `hint` | `string` | | |
1697
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the field, which it marks invalid. |
1698
+ | `invalid` | `boolean` | `false` | Marks the field invalid without a message to show. |
1699
+ | `required` | `boolean` | | |
1700
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1701
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1702
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
1703
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only, e.g. a select in a table row. |
1704
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
1705
+ | `onBlur` | `(() => void)` | | The select was left. |
1706
+ | `inputRef` | `Ref<HTMLInputElement>` | | The select's hidden input, e.g. for a form library to focus the first invalid field. |
1707
+
1708
+ Tested examples: `stories/patterns/form-fields/select-field.stories.tsx`
1709
+
1710
+ #### SideNav
1711
+
1712
+ The navigation down the side of an app: sections of items with glyphs, the page the person is on highlighted, groups that open a list under them, and a collapsed form that is only icons. It is a `<nav>`; the current item is `aria-current="page"`. Put it in AppShell, which gives it a column and turns it into a drawer on a narrow screen.
1713
+
1714
+ ```ts
1715
+ import { SideNav } from "@primecoderin/fast-ui-react";
1716
+ ```
1717
+
1718
+ | Prop | Type | Default | Description |
1719
+ | --- | --- | --- | --- |
1720
+ | `sections` * | `readonly SideNavSection[]` | | |
1721
+ | `aria-label` * | `string` | | Accessible name of the navigation, e.g. "Main". |
1722
+ | `current` | `string` | | The `id` of the item for the page the person is on: it is highlighted and gets `aria-current="page"`. |
1723
+ | `collapsed` | `boolean` | `false` | Show only the icons: a narrow bar, each item named by a tooltip (and, for a screen reader, by its label). A group's list does not fit there, so choosing a group calls `onExpandRequest`. |
1724
+ | `onExpandRequest` | `(() => void)` | | Called when a group is chosen in the collapsed bar: expand the bar. |
1725
+ | `onNavigate` | `(() => void)` | | Called after an item is chosen, e.g. to close a drawer the navigation sits in. |
1726
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1727
+
1728
+ Tested examples: `stories/patterns/side-nav.stories.tsx`
1729
+
1730
+ #### Stat
1731
+
1732
+ One figure with its label, and optionally a line of context, an icon and a trend. On its own it is a card; inside a `StatGroup` it is one of the group's items, drawn as the group's variant asks.
1733
+
1734
+ ```ts
1735
+ import { Stat } from "@primecoderin/fast-ui-react";
1736
+ ```
1737
+
1738
+ | Prop | Type | Default | Description |
1739
+ | --- | --- | --- | --- |
1740
+ | `label` * | `string` | | The visible label. |
1741
+ | `value` * | `ReactNode` | | The figure, formatted by the caller. |
1742
+ | `description` | `string` | | A line of context under the figure, e.g. "this month". |
1743
+ | `icon` | `ReactNode` | | A glyph in a tile beside the label. A strip shows none. |
1744
+ | `tone` | `IconTileTone` | | The icon tile's colour. |
1745
+ | `trend` | `StatTrend` | | |
1746
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1747
+
1748
+ Tested examples: `stories/foundations/branding.stories.tsx`, `stories/patterns/stat.stories.tsx`
1749
+
1750
+ #### StatGroup
1751
+
1752
+ A named list of `Stat`s in a row, as separate cards (`cards`) or one card split into cells (`strip`). The items stack on a narrow screen. <StatGroup aria-label="Order summary"> <Stat label="Orders" value={128} description="this month" icon={<ShoppingCart />} /> <Stat label="Failed" value={4} icon={<CircleAlert />} tone="error" /> </StatGroup>
1753
+
1754
+ ```ts
1755
+ import { StatGroup } from "@primecoderin/fast-ui-react";
1756
+ ```
1757
+
1758
+ | Prop | Type | Default | Description |
1759
+ | --- | --- | --- | --- |
1760
+ | `aria-label` * | `string` | | Accessible name of the list, e.g. "Order summary". |
1761
+ | `children` * | `ReactNode` | | The `Stat`s. |
1762
+ | `variant` | `StatGroupVariant` | `"cards"` | |
1763
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1764
+
1765
+ Tested examples: `stories/foundations/branding.stories.tsx`
1766
+
1767
+ #### Stepper
1768
+
1769
+ The steps of a process and where the person is in it: done, current, ahead. An ordered list, so a screen reader announces "step 2 of 4"; the current step is `aria-current="step"` and a step that is done says so through `labels.completed`. With `onStepClick` the steps that are done are buttons that go back.
1770
+
1771
+ ```ts
1772
+ import { Stepper } from "@primecoderin/fast-ui-react";
1773
+ ```
1774
+
1775
+ | Prop | Type | Default | Description |
1776
+ | --- | --- | --- | --- |
1777
+ | `steps` * | `readonly StepperStep[]` | | |
1778
+ | `current` * | `number` | | The index of the step the person is on: those before it are done, those after it are ahead. |
1779
+ | `labels` * | `StepperLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1780
+ | `aria-label` * | `string` | | Accessible name of the list, e.g. "Checkout progress". |
1781
+ | `orientation` | `"vertical" \| "horizontal"` | `"horizontal"` | A row (default) or a column. |
1782
+ | `onStepClick` | `((index: number) => void)` | | Makes the steps that are done buttons, so the person can go back to one. Called with its index. |
1783
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1784
+
1785
+ Tested examples: `stories/patterns/stepper.stories.tsx`
1786
+
1787
+ #### SwitchField
1788
+
1789
+ A switch with its label: a settings row, the label at the start and the switch at the far end. It is controlled: it shows `checked` and reports a change through `onCheckedChange`. Bound to react-hook-form, it is FormSwitchField.
1790
+
1791
+ ```ts
1792
+ import { SwitchField } from "@primecoderin/fast-ui-react";
1793
+ ```
1794
+
1795
+ | Prop | Type | Default | Description |
1796
+ | --- | --- | --- | --- |
1797
+ | `label` * | `string` | | The visible label. |
1798
+ | `checked` * | `boolean` | | Whether it is checked. Controlled: the caller keeps this state. |
1799
+ | `onCheckedChange` * | `(checked: boolean) => void` | | Called with the new state when the person flips the switch. |
1800
+ | `name` | `string` | | The field's name in a submitted form. |
1801
+ | `hideLabel` | `boolean` | `false` | Show the switch alone, with the label kept for assistive technology. For a layout that draws the label itself, e.g. in a label column. |
1802
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1803
+ | `invalid` | `boolean` | `false` | Marks the switch invalid for assistive technology. |
1804
+ | `onBlur` | `(() => void)` | | The switch was left. |
1805
+ | `inputRef` | `Ref<HTMLInputElement>` | | The switch's hidden input, e.g. for a form library to focus the first invalid field. |
1806
+
1807
+ Tested examples: `stories/patterns/form-fields/switch-field.stories.tsx`
1808
+
1809
+ #### TagGroup
1810
+
1811
+ A named list of removable tags: light brand-tinted pills, each a button that removes its tag, and an optional "Clear all". The applied filters of a list, the recipients of a message, chosen labels. Renders nothing when there are no items. A remove button or Clear all that had the keyboard focus takes it away with itself, so once the app has removed the tag the focus moves on: to the tag now in its place, to the one before when it was the last, and to `emptyFocusRef` when none is left.
1812
+
1813
+ ```ts
1814
+ import { TagGroup } from "@primecoderin/fast-ui-react";
1815
+ ```
1816
+
1817
+ | Prop | Type | Default | Description |
1818
+ | --- | --- | --- | --- |
1819
+ | `items` * | `readonly TagGroupItem[]` | | The tags, in order. |
1820
+ | `aria-label` * | `string` | | Accessible name of the list, e.g. "Active filters". |
1821
+ | `onRemove` * | `(id: string) => void` | | Called with a tag's id when its remove button is used. |
1822
+ | `labels` * | `TagGroupLabels` | | The remove buttons' names and the "Clear all" text. |
1823
+ | `onClearAll` | `(() => void)` | | Called by the "Clear all" button, shown when this and `labels.clearAll` are given. |
1824
+ | `emptyFocusRef` | `RefObject<HTMLElement \| null>` | | The element that takes the keyboard focus when the last tag goes (removed, or by Clear all), e.g. the field or button that adds tags. The group renders nothing once it is empty, so without this the focus is lost to the page, as it is whenever the focused element goes away. |
1825
+ | `className` | `string` | | Classes for the outer element, e.g. a margin. |
1826
+
1827
+ Tested examples: `stories/patterns/tag-group.stories.tsx`
1828
+
1829
+ #### TagsInput
1830
+
1831
+ An input that turns what is typed into tags: Enter or a separator (a comma) ends a tag, a tag is removed with the button on it or with Backspace in the empty input, and text left in the input when it is left becomes a tag. For a choice from a fixed list, see MultiSelect.
1832
+
1833
+ ```ts
1834
+ import { TagsInput } from "@primecoderin/fast-ui-react";
1835
+ ```
1836
+
1837
+ | Prop | Type | Default | Description |
1838
+ | --- | --- | --- | --- |
1839
+ | `value` * | `readonly string[]` | | The tags, in the order they were added. |
1840
+ | `onValueChange` * | `(value: string[]) => void` | | Called with the new list of tags. |
1841
+ | `labels` * | `TagsInputLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1842
+ | `separators` | `readonly string[]` | `[","]` | The characters that end a tag as they are typed or pasted, besides Enter. Default `[","]`. Pasted text is split at them, so pasting "a, b, c" adds three tags. |
1843
+ | `allowDuplicates` | `boolean` | `false` | Let the same tag be added twice. By default a tag already in the list is not added again. |
1844
+ | `maxTags` | `number` | | The most tags the list takes; the input stops adding past it. |
1845
+ | `isValidTag` | `((tag: string) => boolean)` | | Returns false for a tag that must not be added (an email address that is not one); the text stays in the input. |
1846
+ | `placeholder` | `string` | | |
1847
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1848
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
1849
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
1850
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1851
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
1852
+ | `aria-label` | `string` | | The accessible name of the input, for a control with no label element of its own. |
1853
+ | `aria-labelledby` | `string` | | The id of the element that names the input, such as a field's label. |
1854
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
1855
+ | `onBlur` | `(() => void)` | | The control was left. Text typed and not yet a tag becomes one first. |
1856
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, for a form library to focus the first invalid field. |
1857
+
1858
+ Tested examples: `stories/patterns/tags-input.stories.tsx`
1859
+
1860
+ #### TextAreaField
1861
+
1862
+ A labelled multi-line input with the design system's hint and error. It is controlled: it shows `value` and reports each change through `onValueChange`. Bound to react-hook-form, it is FormTextAreaField.
1863
+
1864
+ ```ts
1865
+ import { TextAreaField } from "@primecoderin/fast-ui-react";
1866
+ ```
1867
+
1868
+ | Prop | Type | Default | Description |
1869
+ | --- | --- | --- | --- |
1870
+ | `label` * | `string` | | The visible label. |
1871
+ | `value` * | `string` | | The text in the field. |
1872
+ | `onValueChange` * | `(value: string) => void` | | Called with the new text as the person types. |
1873
+ | `name` | `string` | | The field's name in a submitted form. |
1874
+ | `hint` | `string` | | |
1875
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the field, which it marks invalid. |
1876
+ | `invalid` | `boolean` | `false` | Marks the field invalid without a message to show. |
1877
+ | `required` | `boolean` | | |
1878
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
1879
+ | `placeholder` | `string` | | |
1880
+ | `maxLength` | `number` | | |
1881
+ | `rows` | `number` | | |
1882
+ | `autoComplete` | `string` | | |
1883
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
1884
+ | `resize` | `"none" \| "vertical" \| "horizontal" \| "both"` | `"vertical"` | Which way the user can drag the corner to resize. Defaults to vertical. |
1885
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
1886
+ | `onBlur` | `(() => void)` | | The text area was left. |
1887
+ | `inputRef` | `Ref<HTMLTextAreaElement>` | | The `<textarea>`, e.g. for a form library to focus the first invalid field. |
1888
+
1889
+ Tested examples: `stories/patterns/form-fields/text-area-field.stories.tsx`
1890
+
1891
+ #### TextField
1892
+
1893
+ A labelled text input with the design system's hint, error and confirmation. It is controlled: it shows `value` and reports each change through `onValueChange`. Bound to react-hook-form, it is FormTextField.
1894
+
1895
+ ```ts
1896
+ import { TextField } from "@primecoderin/fast-ui-react";
1897
+ ```
1898
+
1899
+ | Prop | Type | Default | Description |
1900
+ | --- | --- | --- | --- |
1901
+ | `label` * | `string` | | The visible label. |
1902
+ | `value` * | `string` | | The text in the field. |
1903
+ | `onValueChange` * | `(value: string) => void` | | Called with the new text as the person types. A change `acceptInput` refuses never arrives. |
1904
+ | `hint` | `string` | | |
1905
+ | `errorMessage` | `string` | | The validation message, in the user's language: shown in red under the field, which it marks invalid. |
1906
+ | `invalid` | `boolean` | `false` | Marks the field invalid without a message to show. |
1907
+ | `successMessage` | `string` | | Shown in green, with a check, while the field is valid: a confirmation such as "Name is available". The caller decides when it applies; FormTextField shows it once the field has been left with a valid value. |
1908
+ | `required` | `boolean` | | |
1909
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density; "large" is for sign-in style screens. |
1910
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
1911
+ | `hideLabel` | `boolean` | `false` | Keep the label out of the layout and give it to assistive technology only. For inputs whose meaning is clear from a placeholder or their neighbours. |
1912
+ | `contentBefore` | `ReactNode` | | Content inside the box, before and after the text. Decorative icons, units. |
1913
+ | `contentAfter` | `ReactNode` | | |
1914
+ | `passwordToggleLabels` | `PasswordToggleLabels` | | Adds a show/hide button when type is "password". Texts come from the caller. |
1915
+ | `acceptInput` | `((value: string) => boolean)` | | Keystroke filter: a change is ignored when this returns false for the new value, so the field never holds invalid text (e.g. numeric masks). |
1916
+ | `inputRef` | `Ref<HTMLInputElement>` | | The `<input>`, e.g. for a form library to focus the first invalid field. |
1917
+
1918
+ Tested examples: `stories/patterns/form-fields/text-field.stories.tsx`
1919
+
1920
+ #### Timeline
1921
+
1922
+ Events in the order they happened, joined by a line, each with a dot, a title, the time and a description. An ordered list, so a screen reader counts the events. The caller sorts the events.
1923
+
1924
+ ```ts
1925
+ import { Timeline } from "@primecoderin/fast-ui-react";
1926
+ ```
1927
+
1928
+ | Prop | Type | Default | Description |
1929
+ | --- | --- | --- | --- |
1930
+ | `events` * | `readonly TimelineEvent[]` | | The events in the order they are shown: newest first or oldest first is the caller's. |
1931
+ | `aria-label` * | `string` | | Accessible name of the list, e.g. "Order history". |
1932
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1933
+
1934
+ Tested examples: `stories/patterns/timeline.stories.tsx`
1935
+
1936
+ #### Toolbar
1937
+
1938
+ A row of controls that is one stop in the Tab order: Tab enters it, the arrow keys move between the buttons, and Tab leaves it. For formatting, view and editing controls (a text editor's bold, italic, link), where Tab through twenty buttons would be a burden.
1939
+
1940
+ ```ts
1941
+ import { Toolbar } from "@primecoderin/fast-ui-react";
1942
+ ```
1943
+
1944
+ | Prop | Type | Default | Description |
1945
+ | --- | --- | --- | --- |
1946
+ | `children` * | `ReactNode` | | The content. |
1947
+ | `aria-label` * | `string` | | Accessible name of the toolbar, e.g. "Text formatting". |
1948
+ | `orientation` | `"vertical" \| "horizontal"` | `"horizontal"` | A row (default) or a column. |
1949
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
1950
+
1951
+ Tested examples: `stories/patterns/toolbar.stories.tsx`
1952
+
1953
+ #### ToolbarButton
1954
+
1955
+ A button in a Toolbar.
1956
+
1957
+ ```ts
1958
+ import { ToolbarButton } from "@primecoderin/fast-ui-react";
1959
+ ```
1960
+
1961
+ | Prop | Type | Default | Description |
1962
+ | --- | --- | --- | --- |
1963
+ | `children` | `ReactNode` | | The label. Leave it out for a glyph alone, and give `aria-label`. |
1964
+ | `icon` | `ReactNode` | | A glyph before the label. |
1965
+ | `onClick` | `(() => void)` | | |
1966
+ | `pressed` | `boolean` | | For a button that stays on (bold): whether it is on. It sets `aria-pressed`. Leave it out for an action. |
1967
+ | `disabled` | `boolean` | | Not interactive, and shown as disabled. |
1968
+ | `aria-label` | `string` | | The accessible name, for a button with no text of its own. |
1969
+
1970
+
1971
+ #### ToolbarSeparator
1972
+
1973
+ A thin rule between groups of buttons in a Toolbar.
1974
+
1975
+ ```ts
1976
+ import { ToolbarSeparator } from "@primecoderin/fast-ui-react";
1977
+ ```
1978
+
1979
+ This component takes no props.
1980
+
1981
+
1982
+ #### Tour
1983
+
1984
+ A guided walk through the page: one step at a time points at a part of it with a ring and a card, and the card's buttons go back and on. The page is dimmed around the ring but not blocked, and Escape ends the tour. The focus starts on the card's Next button; on each later step it moves to the step's title, so a screen reader reads the new step. The app decides when to show it (a first visit) and remembers that it has. A step whose target is not on the page is not shown, so a tour should only open once its targets are there.
1985
+
1986
+ ```ts
1987
+ import { Tour } from "@primecoderin/fast-ui-react";
1988
+ ```
1989
+
1990
+ | Prop | Type | Default | Description |
1991
+ | --- | --- | --- | --- |
1992
+ | `steps` * | `readonly TourStep[]` | | |
1993
+ | `open` * | `boolean` | | Whether it is open. Controlled: the caller keeps this state. |
1994
+ | `onOpenChange` * | `(open: boolean) => void` | | Called with `false` when the tour ends: the close button, the last step's button, or Escape. |
1995
+ | `step` * | `number` | | The index of the step on show. |
1996
+ | `onStepChange` * | `(step: number) => void` | | Called with the index of the step the buttons go to. |
1997
+ | `labels` * | `TourLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
1998
+
1999
+ Tested examples: `stories/patterns/tour.stories.tsx`
2000
+
2001
+ #### TransferList
2002
+
2003
+ Two lists with the items between them moved by buttons: pick from what is available into what is chosen. Tick items in either list and press the arrow; the double arrows move every item that can move. For a few options, a MultiSelect is quicker; this is for long lists where seeing both sides matters.
2004
+
2005
+ ```ts
2006
+ import { TransferList } from "@primecoderin/fast-ui-react";
2007
+ ```
2008
+
2009
+ | Prop | Type | Default | Description |
2010
+ | --- | --- | --- | --- |
2011
+ | `items` * | `readonly TransferListItem[]` | | Every item, in either list. Each item is in the second list when its `id` is in `value`, else in the first. |
2012
+ | `value` * | `readonly string[]` | | The `id`s of the items in the second list, in the order they were added. |
2013
+ | `onValueChange` * | `(value: string[]) => void` | | Called with the `id`s of the items in the second list. |
2014
+ | `labels` * | `TransferListLabels` | | The headings, the buttons' names and the count. |
2015
+ | `aria-label` | `string` | | Accessible name of the whole control, e.g. "Permissions". |
2016
+ | `aria-labelledby` | `string` | | The id of the element that names the control, such as a field's label. |
2017
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
2018
+ | `disabled` | `boolean` | `false` | Turns off every box and button. |
2019
+ | `listHeight` | `number` | `240` | The height of each list in pixels; a longer list scrolls. Default 240. |
2020
+ | `className` | `string` | | Extra classes for the control. Merged last. |
2021
+
2022
+ Tested examples: `stories/patterns/transfer-list.stories.tsx`
2023
+
2024
+ #### TreeSelect
2025
+
2026
+ A searchable single-select for two-level lists such as an organization and its departments. Children are listed indented beneath their parent, and each child's option is described by its parent's name, so a screen reader that reads the options one by one says which parent a child is under. Typing keeps a parent that matches itself or through any child, and shows all of a matching parent's children, or only the matching children otherwise.
2027
+
2028
+ ```ts
2029
+ import { TreeSelect } from "@primecoderin/fast-ui-react";
2030
+ ```
2031
+
2032
+ | Prop | Type | Default | Description |
2033
+ | --- | --- | --- | --- |
2034
+ | `options` * | `readonly TreeSelectOption[]` | | |
2035
+ | `value` * | `string \| null` | | The current value. Controlled: the caller keeps this state. |
2036
+ | `onValueChange` * | `(id: string) => void` | | Called with the new value when the user picks one; set `value` from it. |
2037
+ | `noMatchesLabel` * | `string` | | Shown when the typed text matches nothing. |
2038
+ | `onBlur` | `(() => void)` | | |
2039
+ | `placeholder` | `string` | | |
2040
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2041
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the input invalid for assistive technology. |
2042
+ | `required` | `boolean` | `false` | Marks the input required for assistive technology; the label shows the asterisk. |
2043
+ | `resultsLabel` | `((count: number) => string)` | | The number of options listed for the typed text, parents kept for a matching child included, as a screen reader announces it (politely, as it changes): `(count) => `${count} results``. Nothing is announced if omitted. |
2044
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2045
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2046
+ | `id` | `string` | | For a `<label htmlFor>` that names the input. |
2047
+ | `aria-label` | `string` | | The accessible name of the input and of its list of options, for a combobox with no label element of its own. Give this or `aria-labelledby`: a `<label htmlFor>` alone names the input but not the list. |
2048
+ | `aria-labelledby` | `string` | | The id of the element that names the input and its list of options, such as a field's label. |
2049
+
2050
+ Tested examples: `stories/patterns/tree-select.stories.tsx`
2051
+
2052
+ #### TreeView
2053
+
2054
+ A tree of items that open and close: folders and files, a hierarchy of categories. A tree is one stop in the Tab order; the arrow keys do the rest: Up and Down move through what is showing, the key toward the end edge opens a branch (and, on an open one, goes to its first child), the key toward the start edge closes it (and, on a closed one, goes to its parent), Home and End go to the first and last, Enter or Space chooses, and typing the start of a label goes to the next item that has it. A click chooses an item and opens or closes a branch; a disabled item can be reached but not chosen, opened or closed. For picking one value from a list, see TreeSelect.
2055
+
2056
+ ```ts
2057
+ import { TreeView } from "@primecoderin/fast-ui-react";
2058
+ ```
2059
+
2060
+ | Prop | Type | Default | Description |
2061
+ | --- | --- | --- | --- |
2062
+ | `items` * | `readonly TreeViewItem[]` | | The items at the top level, each with its own `children`. |
2063
+ | `aria-label` * | `string` | | Accessible name of the tree, e.g. "Files". |
2064
+ | `selected` | `string \| null` | `null` | The `id` of the chosen item, or null for none. |
2065
+ | `onSelectedChange` | `((id: string) => void)` | | Called with the `id` of the item the person chooses. |
2066
+ | `expanded` | `readonly string[]` | | The `id`s of the open branches. Leave it out to let the tree keep its own. |
2067
+ | `defaultExpanded` | `readonly string[]` | `[]` | The `id`s of the branches that start open, when the tree keeps its own. |
2068
+ | `onExpandedChange` | `((expanded: string[]) => void)` | | Called with the `id`s of the open branches. |
2069
+ | `className` | `string` | | Extra classes for the tree. Merged last. |
2070
+
2071
+ Tested examples: `stories/patterns/tree-view.stories.tsx`
2072
+
2073
+ ## Form fields bound to react-hook-form: `@primecoderin/fast-ui-react/forms`
2074
+
2075
+ ### Patterns
2076
+
2077
+ #### FormAutocompleteField
2078
+
2079
+ An Autocomplete in a field, bound to a react-hook-form string field holding the text.
2080
+
2081
+ ```ts
2082
+ import { FormAutocompleteField } from "@primecoderin/fast-ui-react/forms";
2083
+ ```
2084
+
2085
+ | Prop | Type | Default | Description |
2086
+ | --- | --- | --- | --- |
2087
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2088
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2089
+ | `label` * | `string` | | The visible label. |
2090
+ | `suggestions` * | `readonly string[]` | | The suggestions: the ones that contain the typed text are listed. |
2091
+ | `hint` | `string` | | |
2092
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2093
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2094
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2095
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2096
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2097
+ | `placeholder` | `string` | | |
2098
+ | `required` | `boolean` | | Marks the input required for assistive technology; the label shows the asterisk. |
2099
+ | `noMatchesLabel` | `string` | | Shown when the typed text matches no suggestion. If omitted the list is hidden while nothing matches. |
2100
+ | `resultsLabel` | `((count: number) => string)` | | The number of suggestions the typed text matches, as a screen reader announces it (politely, as it changes): `(count) => `${count} suggestions``. Nothing is announced if omitted. |
2101
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2102
+
2103
+ Tested examples: `stories/patterns/form-fields/form-autocomplete-field.stories.tsx`
2104
+
2105
+ #### FormCascaderField
2106
+
2107
+ A Cascader in a field, bound to a react-hook-form field holding the path: an array of the `value` of each step.
2108
+
2109
+ ```ts
2110
+ import { FormCascaderField } from "@primecoderin/fast-ui-react/forms";
2111
+ ```
2112
+
2113
+ | Prop | Type | Default | Description |
2114
+ | --- | --- | --- | --- |
2115
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2116
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2117
+ | `label` * | `string` | | The visible label. |
2118
+ | `labels` * | `CascaderLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2119
+ | `options` * | `readonly CascaderOption[]` | | |
2120
+ | `hint` | `string` | | |
2121
+ | `required` | `boolean` | | |
2122
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2123
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only. |
2124
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2125
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2126
+ | `size` | `FieldSize` | `"medium"` | |
2127
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2128
+ | `placeholder` | `string` | | Shown on the button while nothing is chosen. `labels.choose` if omitted. |
2129
+ | `separator` | `string` | | Written between the labels of the path on the button. Default " / ". |
2130
+
2131
+ Tested examples: `stories/patterns/form-fields/form-cascader-field.stories.tsx`
2132
+
2133
+ #### FormCheckboxField
2134
+
2135
+ A CheckboxField bound to a boolean react-hook-form field, with consistent error display.
2136
+
2137
+ ```ts
2138
+ import { FormCheckboxField } from "@primecoderin/fast-ui-react/forms";
2139
+ ```
2140
+
2141
+ | Prop | Type | Default | Description |
2142
+ | --- | --- | --- | --- |
2143
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2144
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2145
+ | `label` * | `string` | | The visible label. |
2146
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`): the message is shown as the field's error, through `formatError`. |
2147
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2148
+ | `onCheckedChange` | `((checked: boolean) => void)` | | Called after the value changes. |
2149
+ | `size` | `"medium" \| "large"` | `"medium"` | "large" is a 20px box (the default is 17px). |
2150
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2151
+ | `hint` | `string` | | |
2152
+
2153
+ Tested examples: `stories/patterns/form-fields/form-checkbox-field.stories.tsx`
2154
+
2155
+ #### FormColorField
2156
+
2157
+ A ColorPicker in a field, bound to a react-hook-form string field holding the colour as "#rrggbb" (or "" for none).
2158
+
2159
+ ```ts
2160
+ import { FormColorField } from "@primecoderin/fast-ui-react/forms";
2161
+ ```
2162
+
2163
+ | Prop | Type | Default | Description |
2164
+ | --- | --- | --- | --- |
2165
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2166
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2167
+ | `label` * | `string` | | The visible label. |
2168
+ | `labels` * | `ColorPickerLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2169
+ | `hint` | `string` | | |
2170
+ | `required` | `boolean` | | |
2171
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2172
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only. |
2173
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2174
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2175
+ | `size` | `FieldSize` | `"medium"` | |
2176
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2177
+ | `placeholder` | `string` | | Shown on the button while there is no colour. `labels.choose` if omitted. |
2178
+ | `swatches` | `readonly string[]` | | Colours offered as one-click choices under the picker, as hex. |
2179
+
2180
+ Tested examples: `stories/patterns/form-fields/form-color-field.stories.tsx`
2181
+
2182
+ #### FormComboboxField
2183
+
2184
+ A Combobox in a field, bound to a react-hook-form string field holding the chosen option's `value`.
2185
+
2186
+ ```ts
2187
+ import { FormComboboxField } from "@primecoderin/fast-ui-react/forms";
2188
+ ```
2189
+
2190
+ | Prop | Type | Default | Description |
2191
+ | --- | --- | --- | --- |
2192
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2193
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2194
+ | `label` * | `string` | | The visible label. |
2195
+ | `options` * | `readonly ComboboxOption[]` | | |
2196
+ | `noMatchesLabel` * | `string` | | Shown when the typed text matches no option. |
2197
+ | `hint` | `string` | | |
2198
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2199
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2200
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2201
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2202
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2203
+ | `placeholder` | `string` | | |
2204
+ | `required` | `boolean` | | Marks the input required for assistive technology; the label shows the asterisk. |
2205
+ | `resultsLabel` | `((count: number) => string)` | | The number of options the typed text matches, as a screen reader announces it (politely, as it changes): `(count) => `${count} results``. Nothing is announced if omitted. |
2206
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2207
+
2208
+ Tested examples: `stories/patterns/form-fields/form-combobox-field.stories.tsx`
2209
+
2210
+ #### FormDateRangeField
2211
+
2212
+ A DateRangePicker in a field, bound to a react-hook-form field holding `{ start, end }`, "yyyy-MM-dd" each.
2213
+
2214
+ ```ts
2215
+ import { FormDateRangeField } from "@primecoderin/fast-ui-react/forms";
2216
+ ```
2217
+
2218
+ | Prop | Type | Default | Description |
2219
+ | --- | --- | --- | --- |
2220
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2221
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2222
+ | `label` * | `string` | | The visible label. |
2223
+ | `hint` | `string` | | |
2224
+ | `required` | `boolean` | | |
2225
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2226
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only. |
2227
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. The value is an object that is never empty, so `required` does not apply: use `validate`, e.g. `(range) => range.end !== "" \|\| "Pick both days"`. |
2228
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2229
+ | `size` | `FieldSize` | `"medium"` | |
2230
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2231
+ | `icon` | `ReactNode` | | Replaces the calendar glyph at the end of the field. |
2232
+ | `labels` | `DateRangePickerLabels` | | The texts of the field and its calendar. English if omitted. |
2233
+ | `placeholder` | `string` | | Shown while there is no range. `labels.select` if omitted. |
2234
+ | `min` | `string` | | The earliest and latest day that can be picked, "yyyy-MM-dd". |
2235
+ | `max` | `string` | | |
2236
+ | `locale` | `Locale` | | date-fns' locale for the names of months and days and the first day of the week. English, with weeks from Sunday, if omitted. |
2237
+
2238
+ Tested examples: `stories/patterns/form-fields/form-date-range-field.stories.tsx`
2239
+
2240
+ #### FormDateTimeField
2241
+
2242
+ A date, a date and time or a time, picked from a panel and bound to react-hook-form: the field value is the text a native input holds ("2026-10-24", "2026-10-24T14:05", "14:05"), so it takes the place of `FormTextField type="date"` (or "time") with the schema and the request code unchanged. See DateTimePicker for what the panel offers.
2243
+
2244
+ ```ts
2245
+ import { FormDateTimeField } from "@primecoderin/fast-ui-react/forms";
2246
+ ```
2247
+
2248
+ | Prop | Type | Default | Description |
2249
+ | --- | --- | --- | --- |
2250
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2251
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2252
+ | `label` * | `string` | | The visible label. |
2253
+ | `hint` | `string` | | |
2254
+ | `required` | `boolean` | | |
2255
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2256
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2257
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2258
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only, e.g. a time in a table row. |
2259
+ | `clearable` | `boolean` | | Offer Clear. By default a field that is not `required` can be cleared and one that is cannot. |
2260
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2261
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (such as a translation key) into display text. |
2262
+ | `id` | `string` | | |
2263
+ | `icon` | `ReactNode` | | Replaces the calendar (or, for a time, clock) glyph at the end of the field. |
2264
+ | `display` | `"full" \| "dayMonth"` | | "dayMonth" shows a date as "24 October", for a date whose year does not matter (a season's first day). |
2265
+ | `labels` | `DateTimePickerLabels` | | The texts of the field and its panel, in the user's language. English if omitted. |
2266
+ | `placeholder` | `string` | | Shown while there is no value. `labels.select` if omitted. |
2267
+ | `mode` | `PickerKind` | | A day (default), a day and a time, or a time of day. |
2268
+ | `showSeconds` | `boolean` | | Show and set the seconds as well: "14:05:09". For a date and time or a time. |
2269
+ | `min` | `string` | | The earliest and latest value, written as the value is ("2026-10-24"; a date and time may be a day alone, which is that day's first or last moment). Days outside are greyed out and cannot be picked, and a time outside becomes the nearer limit. |
2270
+ | `max` | `string` | | |
2271
+ | `defaultTime` | `string` | | The time a day gets when it is picked and the value has none: "00:00" for the start of a range, "23:59" for its end. The time now if omitted. Seconds are dropped unless `showSeconds`. |
2272
+ | `showNow` | `boolean` | | Offer Today (a date) or Now. Default true. |
2273
+ | `locale` | `Locale` | | date-fns' locale for the names of months and days and the first day of the week (Monday for `de`), such as `he` from "date-fns/locale/he". English, with weeks from Sunday, if omitted. Dates are always written day first and times in 24 hours, whatever the locale. |
2274
+
2275
+ Tested examples: `stories/patterns/form-date-time-field.stories.tsx`
2276
+
2277
+ #### FormFileUploadField
2278
+
2279
+ A FileUpload in a field, bound to a react-hook-form field holding an array of `File`s.
2280
+
2281
+ ```ts
2282
+ import { FormFileUploadField } from "@primecoderin/fast-ui-react/forms";
2283
+ ```
2284
+
2285
+ | Prop | Type | Default | Description |
2286
+ | --- | --- | --- | --- |
2287
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2288
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2289
+ | `label` * | `string` | | The visible label. |
2290
+ | `labels` * | `FileUploadLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2291
+ | `hint` | `string` | | |
2292
+ | `required` | `boolean` | | |
2293
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2294
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2295
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2296
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2297
+ | `description` | `string` | | A line in the drop area under the button: the limits, e.g. "PNG or JPG, up to 5 MB". |
2298
+ | `locale` | `string` | | The locale that writes the sizes, a BCP 47 tag. If omitted, the runtime's default locale (the browser's, or the server's when rendered there), not the page's `lang`. |
2299
+ | `accept` | `string` | | The kinds of file it takes, as the file input writes them: `"image/*,.pdf"`. Anything if omitted. |
2300
+ | `multiple` | `boolean` | | Let several files be chosen. Otherwise a new choice replaces the one before, and of several files dropped at once the first that passes is taken and the others are reported to `onReject` as `count`. |
2301
+ | `maxSize` | `number` | | The largest a file may be, in bytes. |
2302
+ | `maxFiles` | `number` | | The most files the list takes. |
2303
+ | `onReject` | `((rejections: FileUploadRejection[]) => void)` | | Called with the files that were not added and why, so the app can tell the person in its own words. The files that were fine are added regardless. |
2304
+ | `statuses` | `ReadonlyMap<File, FileUploadStatus>` | | Progress and errors of the files, by file: the app sets them as it sends them. |
2305
+
2306
+ Tested examples: `stories/patterns/form-fields/form-file-upload-field.stories.tsx`
2307
+
2308
+ #### FormMentionsField
2309
+
2310
+ A MentionsInput in a field, bound to a react-hook-form string field holding the text.
2311
+
2312
+ ```ts
2313
+ import { FormMentionsField } from "@primecoderin/fast-ui-react/forms";
2314
+ ```
2315
+
2316
+ | Prop | Type | Default | Description |
2317
+ | --- | --- | --- | --- |
2318
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2319
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2320
+ | `label` * | `string` | | The visible label. |
2321
+ | `suggestions` * | `readonly MentionSuggestion[]` | | The people that can be mentioned. |
2322
+ | `hint` | `string` | | |
2323
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2324
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2325
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2326
+ | `size` | `FieldSize` | `"medium"` | The field size, as the other inputs have it. Default `medium`. |
2327
+ | `disabled` | `boolean` | `false` | Makes the text area read only and greyed. |
2328
+ | `trigger` | `string` | | The character that starts a mention. Default "@". |
2329
+ | `rows` | `number` | | The height of the text area in lines. Default 4. |
2330
+ | `placeholder` | `string` | | Shown in the empty text area, e.g. "Type @ to mention someone". |
2331
+ | `required` | `boolean` | | Marks the text area required for assistive technology; the label shows the asterisk. |
2332
+ | `onMention` | `((suggestion: MentionSuggestion) => void)` | | Called with the person when one is chosen from the list. |
2333
+ | `maxSuggestions` | `number` | | The most suggestions listed. Default 6. |
2334
+
2335
+ Tested examples: `stories/patterns/form-fields/form-mentions-field.stories.tsx`
2336
+
2337
+ #### FormMultiSelectField
2338
+
2339
+ A MultiSelect in a field, bound to a react-hook-form field holding an array of the chosen options' `value`s.
2340
+
2341
+ ```ts
2342
+ import { FormMultiSelectField } from "@primecoderin/fast-ui-react/forms";
2343
+ ```
2344
+
2345
+ | Prop | Type | Default | Description |
2346
+ | --- | --- | --- | --- |
2347
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2348
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2349
+ | `label` * | `string` | | The visible label. |
2350
+ | `labels` * | `MultiSelectLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2351
+ | `options` * | `readonly ComboboxOption[]` | | |
2352
+ | `hint` | `string` | | |
2353
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2354
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2355
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2356
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2357
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2358
+ | `placeholder` | `string` | | |
2359
+ | `required` | `boolean` | | Marks the input required for assistive technology; the label shows the asterisk. |
2360
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2361
+
2362
+ Tested examples: `stories/patterns/form-fields/form-multi-select-field.stories.tsx`
2363
+
2364
+ #### FormNumberField
2365
+
2366
+ A NumberField in a field, bound to a react-hook-form field holding a number, or null while the field is empty.
2367
+
2368
+ ```ts
2369
+ import { FormNumberField } from "@primecoderin/fast-ui-react/forms";
2370
+ ```
2371
+
2372
+ | Prop | Type | Default | Description |
2373
+ | --- | --- | --- | --- |
2374
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2375
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2376
+ | `label` * | `string` | | The visible label. |
2377
+ | `labels` * | `NumberFieldLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2378
+ | `hint` | `string` | | |
2379
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2380
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2381
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2382
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2383
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
2384
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2385
+ | `readOnly` | `boolean` | | |
2386
+ | `placeholder` | `string` | | |
2387
+ | `min` | `number` | | |
2388
+ | `max` | `number` | | |
2389
+ | `locale` | `LocalesArgument` | | The locale that writes and reads the number. The page's if omitted. |
2390
+ | `required` | `boolean` | | Marks the input required for assistive technology; the label shows the asterisk. |
2391
+ | `contentBefore` | `ReactNode` | | A decorative icon or unit at the start of the box. |
2392
+ | `step` | `number` | | What the buttons and the up and down arrow keys change. Default 1. |
2393
+ | `largeStep` | `number` | | What Shift with the arrow keys (or Page Up and Page Down) change. Default 10. |
2394
+ | `format` | `NumberFormatOptions` | | How the number is written: `{ style: "currency", currency: "USD" }`, `{ maximumFractionDigits: 1 }`. |
2395
+
2396
+ Tested examples: `stories/patterns/form-fields/form-number-field.stories.tsx`
2397
+
2398
+ #### FormPhoneField
2399
+
2400
+ A PhoneField bound to a react-hook-form string field holding the number in E.164: the calling code and the digits with nothing between, e.g. "+12025550123" (`joinPhone` and `splitPhone` convert it). A searchable calling-code picker and a digits-only number share one box. The box is always left to right: numbers read that way in a right-to-left language too.
2401
+
2402
+ ```ts
2403
+ import { FormPhoneField } from "@primecoderin/fast-ui-react/forms";
2404
+ ```
2405
+
2406
+ | Prop | Type | Default | Description |
2407
+ | --- | --- | --- | --- |
2408
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2409
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2410
+ | `label` * | `string` | | The visible label. |
2411
+ | `labels` * | `PhoneFieldLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2412
+ | `countries` * | `readonly PhoneCountry[]` | | |
2413
+ | `defaultDialCode` * | `string` | | The calling code shown while no number has been entered. |
2414
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`): the message is shown as the field's error, through `formatError`. |
2415
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2416
+ | `size` | `FieldSize` | `"medium"` | |
2417
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2418
+ | `placeholder` | `string` | | |
2419
+ | `required` | `boolean` | | |
2420
+ | `hint` | `string` | | |
2421
+ | `orientation` | `FieldOrientation` | | |
2422
+ | `maxDigits` | `number` | `13` | The most digits the number takes. |
2423
+
2424
+ Tested examples: `stories/patterns/form-fields/form-phone-field.stories.tsx`
2425
+
2426
+ #### FormRadioGroupField
2427
+
2428
+ A RadioGroupField bound to react-hook-form. The field value is the chosen option's `value` string.
2429
+
2430
+ ```ts
2431
+ import { FormRadioGroupField } from "@primecoderin/fast-ui-react/forms";
2432
+ ```
2433
+
2434
+ | Prop | Type | Default | Description |
2435
+ | --- | --- | --- | --- |
2436
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2437
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2438
+ | `label` * | `string` | | The visible label. |
2439
+ | `options` * | `readonly RadioOption[]` | | |
2440
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`): the message is shown as the field's error, through `formatError`. |
2441
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2442
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2443
+ | `required` | `boolean` | `false` | |
2444
+ | `hint` | `string` | | |
2445
+ | `orientation` | `FieldOrientation` | `"vertical"` | Label above the group (default) or in a column beside it. |
2446
+ | `layout` | `"vertical" \| "horizontal"` | `"vertical"` | Lay the options out in a column (default) or a row. |
2447
+
2448
+ Tested examples: `stories/patterns/form-fields/form-radio-group-field.stories.tsx`
2449
+
2450
+ #### FormRatingField
2451
+
2452
+ A Rating in a field, bound to a react-hook-form field holding a number from 0 (none) to the number of stars.
2453
+
2454
+ ```ts
2455
+ import { FormRatingField } from "@primecoderin/fast-ui-react/forms";
2456
+ ```
2457
+
2458
+ | Prop | Type | Default | Description |
2459
+ | --- | --- | --- | --- |
2460
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2461
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2462
+ | `label` * | `string` | | The visible label. |
2463
+ | `getValueLabel` * | `(value: number, max: number) => string` | | What a rating of `value` out of `max` is called, e.g. `(n, max) => "3 of 5 stars"`. It names each star and the shown rating. |
2464
+ | `hint` | `string` | | |
2465
+ | `required` | `boolean` | | The label shows the asterisk and the group is announced as required. Validation is the form's (`rules`). |
2466
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2467
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2468
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2469
+ | `size` | `"small" \| "medium" \| "large"` | | The stars' size: small 16px, medium 20px (the default), large 26px. Small and medium stars that can be chosen each sit in a 24px box, the least size of a target, so they stand further apart than read-only ones. |
2470
+ | `disabled` | `boolean` | `false` | Dims the stars, which cannot be chosen or focused. |
2471
+ | `max` | `number` | | How many stars. Default 5. |
2472
+ | `clearable` | `boolean` | | Pressing the chosen star again sets the rating back to 0. |
2473
+
2474
+ Tested examples: `stories/patterns/form-fields/form-rating-field.stories.tsx`
2475
+
2476
+ #### FormSelectField
2477
+
2478
+ A SelectField bound to react-hook-form. The field value is the selected option's `value` string.
2479
+
2480
+ ```ts
2481
+ import { FormSelectField } from "@primecoderin/fast-ui-react/forms";
2482
+ ```
2483
+
2484
+ | Prop | Type | Default | Description |
2485
+ | --- | --- | --- | --- |
2486
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2487
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2488
+ | `label` * | `string` | | The visible label. |
2489
+ | `options` * | `readonly SelectOption[]` | | |
2490
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`): the message is shown as the field's error, through `formatError`. |
2491
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2492
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2493
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2494
+ | `placeholder` | `string` | | |
2495
+ | `required` | `boolean` | | |
2496
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2497
+ | `hint` | `string` | | |
2498
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2499
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only, e.g. a select in a table row. |
2500
+
2501
+ Tested examples: `stories/patterns/form-fields/form-select-field.stories.tsx`
2502
+
2503
+ #### FormSliderField
2504
+
2505
+ A Slider in a field, bound to a react-hook-form field holding a number, or an array of numbers for a range (a thumb for each; name them with `thumbLabels`). A field with no value starts at `min`.
2506
+
2507
+ ```ts
2508
+ import { FormSliderField } from "@primecoderin/fast-ui-react/forms";
2509
+ ```
2510
+
2511
+ | Prop | Type | Default | Description |
2512
+ | --- | --- | --- | --- |
2513
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2514
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2515
+ | `label` * | `string` | | The visible label. |
2516
+ | `hint` | `string` | | |
2517
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2518
+ | `hideLabel` | `boolean` | `false` | Keep the label for assistive technology only. |
2519
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2520
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2521
+ | `disabled` | `boolean` | `false` | Greys the slider out; its thumbs cannot be moved or focused. |
2522
+ | `min` | `number` | `0` | The least value, at the start of the track (Home goes there). Default 0. |
2523
+ | `max` | `number` | | The greatest value, at the end of the track (End goes there). Default 100. |
2524
+ | `step` | `number` | | What one arrow key press changes. Default 1. |
2525
+ | `largeStep` | `number` | | What Page Up and Page Down (or Shift and an arrow) change. Default 10. |
2526
+ | `minStepsBetweenValues` | `number` | | The least distance between two thumbs of a range, in steps. |
2527
+ | `getValueText` | `((formattedValue: string, value: number, index: number) => string)` | | Writes a value as text for a screen reader, e.g. `(text) => `${text} km``. The number as formatted if omitted. |
2528
+ | `thumbLabels` | `readonly string[]` | | Names the thumbs of a range in order, e.g. ["Minimum price", "Maximum price"]. |
2529
+
2530
+ Tested examples: `stories/patterns/form-fields/form-slider-field.stories.tsx`
2531
+
2532
+ #### FormSwitchField
2533
+
2534
+ A SwitchField bound to a boolean react-hook-form field. With its label it is a settings row: the label at the start, the switch at the far end.
2535
+
2536
+ ```ts
2537
+ import { FormSwitchField } from "@primecoderin/fast-ui-react/forms";
2538
+ ```
2539
+
2540
+ | Prop | Type | Default | Description |
2541
+ | --- | --- | --- | --- |
2542
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2543
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2544
+ | `label` * | `string` | | The visible label. |
2545
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ validate: ... }`). A switch shows no message: a rule that fails marks the switch invalid for assistive technology only, so say why near it. |
2546
+ | `onCheckedChange` | `((checked: boolean) => void)` | | Called after the value changes, e.g. to clear the fields the switch controls. |
2547
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2548
+ | `hideLabel` | `boolean` | `false` | Show the switch alone, with the label kept for assistive technology. For a layout that draws the label itself, e.g. in a label column. |
2549
+
2550
+ Tested examples: `stories/patterns/form-fields/form-switch-field.stories.tsx`
2551
+
2552
+ #### FormTagsInputField
2553
+
2554
+ A TagsInput in a field, bound to a react-hook-form field holding an array of strings.
2555
+
2556
+ ```ts
2557
+ import { FormTagsInputField } from "@primecoderin/fast-ui-react/forms";
2558
+ ```
2559
+
2560
+ | Prop | Type | Default | Description |
2561
+ | --- | --- | --- | --- |
2562
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2563
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2564
+ | `label` * | `string` | | The visible label. |
2565
+ | `labels` * | `TagsInputLabels` | | Every text it shows or announces, in the user's language (the library has no built-in text). |
2566
+ | `hint` | `string` | | |
2567
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2568
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2569
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2570
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2571
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2572
+ | `placeholder` | `string` | | |
2573
+ | `required` | `boolean` | | Marks the input required for assistive technology; the label shows the asterisk. |
2574
+ | `separators` | `readonly string[]` | | The characters that end a tag as they are typed or pasted, besides Enter. Default `[","]`. Pasted text is split at them, so pasting "a, b, c" adds three tags. |
2575
+ | `allowDuplicates` | `boolean` | | Let the same tag be added twice. By default a tag already in the list is not added again. |
2576
+ | `maxTags` | `number` | | The most tags the list takes; the input stops adding past it. |
2577
+ | `isValidTag` | `((tag: string) => boolean)` | | Returns false for a tag that must not be added (an email address that is not one); the text stays in the input. |
2578
+
2579
+ Tested examples: `stories/patterns/form-fields/form-tags-input-field.stories.tsx`
2580
+
2581
+ #### FormTextAreaField
2582
+
2583
+ A TextAreaField bound to react-hook-form, with consistent error display.
2584
+
2585
+ ```ts
2586
+ import { FormTextAreaField } from "@primecoderin/fast-ui-react/forms";
2587
+ ```
2588
+
2589
+ | Prop | Type | Default | Description |
2590
+ | --- | --- | --- | --- |
2591
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2592
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2593
+ | `label` * | `string` | | The visible label. |
2594
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2595
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2596
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2597
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2598
+ | `rows` | `number` | | |
2599
+ | `placeholder` | `string` | | |
2600
+ | `required` | `boolean` | | |
2601
+ | `autoComplete` | `string` | | |
2602
+ | `maxLength` | `number` | | |
2603
+ | `hint` | `string` | | |
2604
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2605
+ | `resize` | `"none" \| "vertical" \| "horizontal" \| "both"` | `"vertical"` | Which way the user can drag the corner to resize. Defaults to vertical. |
2606
+
2607
+ Tested examples: `stories/patterns/form-fields/form-text-area-field.stories.tsx`
2608
+
2609
+ #### FormTextField
2610
+
2611
+ A TextField bound to react-hook-form, with consistent error display.
2612
+
2613
+ ```ts
2614
+ import { FormTextField } from "@primecoderin/fast-ui-react/forms";
2615
+ ```
2616
+
2617
+ | Prop | Type | Default | Description |
2618
+ | --- | --- | --- | --- |
2619
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2620
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2621
+ | `label` * | `string` | | The visible label. |
2622
+ | `successMessage` | `string` | | Shown in green, with a check, once the field has been left with a value that passes validation. For confirmations such as "Name is available". |
2623
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`). |
2624
+ | `formatError` | `((message: string) => string)` | | Validation messages are i18n keys. This turns the stored message into display text; without it the message is shown as is. |
2625
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density; "large" is for sign-in style screens. |
2626
+ | `required` | `boolean` | | |
2627
+ | `contentBefore` | `ReactNode` | | Content inside the box, before and after the text. Decorative icons, units. |
2628
+ | `hint` | `string` | | |
2629
+ | `acceptInput` | `((value: string) => boolean)` | | Keystroke filter: a change is ignored when this returns false for the new value, so the field never holds invalid text (e.g. numeric masks). |
2630
+ | `passwordToggleLabels` | `PasswordToggleLabels` | | Adds a show/hide button when type is "password". Texts come from the caller. |
2631
+ | `contentAfter` | `ReactNode` | | |
2632
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2633
+ | `hideLabel` | `boolean` | `false` | Keep the label out of the layout and give it to assistive technology only. For inputs whose meaning is clear from a placeholder or their neighbours. |
2634
+
2635
+ Tested examples: `stories/patterns/form-fields/form-text-field.stories.tsx`
2636
+
2637
+ #### FormTransferListField
2638
+
2639
+ A TransferList in a field, bound to a react-hook-form field holding an array of the `id`s of the chosen items.
2640
+
2641
+ ```ts
2642
+ import { FormTransferListField } from "@primecoderin/fast-ui-react/forms";
2643
+ ```
2644
+
2645
+ | Prop | Type | Default | Description |
2646
+ | --- | --- | --- | --- |
2647
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2648
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2649
+ | `label` * | `string` | | The visible label. |
2650
+ | `items` * | `readonly TransferListItem[]` | | Every item, in either list. Each item is in the second list when its `id` is in `value`, else in the first. |
2651
+ | `labels` * | `TransferListLabels` | | The headings, the buttons' names and the count. |
2652
+ | `hint` | `string` | | |
2653
+ | `required` | `boolean` | | |
2654
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2655
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2656
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2657
+ | `disabled` | `boolean` | `false` | Turns off every box and button. |
2658
+ | `listHeight` | `number` | | The height of each list in pixels; a longer list scrolls. Default 240. |
2659
+
2660
+ Tested examples: `stories/patterns/form-fields/form-transfer-list-field.stories.tsx`
2661
+
2662
+ #### FormTreeSelectField
2663
+
2664
+ A TreeSelect in a field, bound to a react-hook-form field holding the chosen option's id (or null).
2665
+
2666
+ ```ts
2667
+ import { FormTreeSelectField } from "@primecoderin/fast-ui-react/forms";
2668
+ ```
2669
+
2670
+ | Prop | Type | Default | Description |
2671
+ | --- | --- | --- | --- |
2672
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2673
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2674
+ | `label` * | `string` | | The visible label. |
2675
+ | `options` * | `readonly TreeSelectOption[]` | | |
2676
+ | `noMatchesLabel` * | `string` | | |
2677
+ | `resultsLabel` | `((count: number) => string)` | | The number of options listed for the typed text, as a screen reader announces it. Nothing is announced if omitted. |
2678
+ | `placeholder` | `string` | | |
2679
+ | `required` | `boolean` | | |
2680
+ | `disabled` | `boolean` | `false` | Not interactive, and shown as disabled. |
2681
+ | `size` | `FieldSize` | `"medium"` | "small" is the compact density. |
2682
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2683
+ | `contentBefore` | `ReactNode` | | A decorative icon at the start of the box. |
2684
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2685
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2686
+
2687
+ Tested examples: `stories/patterns/form-fields/form-tree-select-field.stories.tsx`
2688
+
2689
+ ## Charts: `@primecoderin/fast-ui-react/charts`
2690
+
2691
+ ### Patterns
2692
+
2693
+ #### AreaChart
2694
+
2695
+ Filled areas over a shared x axis: a volume over time, or with `stacked` how a total divides into parts. The colours are the chart tokens, and the top edge of each area after the first is dashed or dotted in its own way (the legend shows the same). The data is also given to a screen reader as a table.
2696
+
2697
+ ```ts
2698
+ import { AreaChart } from "@primecoderin/fast-ui-react/charts";
2699
+ ```
2700
+
2701
+ | Prop | Type | Default | Description |
2702
+ | --- | --- | --- | --- |
2703
+ | `data` * | `readonly Readonly<Record<string, string \| number \| null>>[]` | | The rows to draw, in x order. With none the chart draws its axes only, and its data table has no rows. |
2704
+ | `xKey` * | `string` | | The key of the x value in each datum: a month, a date, a category. |
2705
+ | `series` * | `readonly ChartSeries[]` | | The measures to draw, one line, area or bar group each. Five is the most the colours can tell apart. |
2706
+ | `aria-label` * | `string` | | What the chart shows, e.g. "Orders per month". It names the chart and its data table. |
2707
+ | `stacked` | `boolean` | `false` | Stack the series on top of each other, so the top edge is their total. Otherwise each is drawn from the axis. |
2708
+ | `curve` | `"step" \| "linear" \| "monotone"` | `"monotone"` | How the edge runs between points: straight, smoothed (`monotone`, default) or in steps. |
2709
+ | `xLabel` | `string` | | What the x values are called, for the data table a screen reader reads: "Month". The `xKey` if omitted. |
2710
+ | `height` | `number` | `240` | The height of the plot in pixels. Default 240. The width is the container's. |
2711
+ | `formatX` | `((value: string \| number) => string)` | | Writes an x value on the axis, in the tooltip and in the data table. |
2712
+ | `formatValue` | `((value: number) => string)` | | Writes a number on the value axis, in the tooltip and in the data table: `(n) => `${n} kr``. |
2713
+ | `hideLegend` | `boolean` | `false` | Leave out the legend under the chart (for one series, whose name the heading says). |
2714
+ | `hideGrid` | `boolean` | `false` | Leave out the grid lines. |
2715
+ | `className` | `string` | | Extra classes for the chart's box. Merged last. |
2716
+
2717
+ Tested examples: `stories/patterns/charts/area-chart.stories.tsx`
2718
+
2719
+ #### BarChart
2720
+
2721
+ Bars for each x value: a comparison between categories, or with `stacked` how each total divides into parts. The colours are the chart tokens and the data is also given to a screen reader as a table. Unlike the lines of a LineChart, the bars of several series differ only by colour and by their place in each group.
2722
+
2723
+ ```ts
2724
+ import { BarChart } from "@primecoderin/fast-ui-react/charts";
2725
+ ```
2726
+
2727
+ | Prop | Type | Default | Description |
2728
+ | --- | --- | --- | --- |
2729
+ | `data` * | `readonly Readonly<Record<string, string \| number \| null>>[]` | | The rows to draw, in x order. With none the chart draws its axes only, and its data table has no rows. |
2730
+ | `xKey` * | `string` | | The key of the x value in each datum: a month, a date, a category. |
2731
+ | `series` * | `readonly ChartSeries[]` | | The measures to draw, one line, area or bar group each. Five is the most the colours can tell apart. |
2732
+ | `aria-label` * | `string` | | What the chart shows, e.g. "Orders per month". It names the chart and its data table. |
2733
+ | `stacked` | `boolean` | `false` | Stack the series into one bar for each x value, so the bar's height is their total. Otherwise they stand side by side. |
2734
+ | `xLabel` | `string` | | What the x values are called, for the data table a screen reader reads: "Month". The `xKey` if omitted. |
2735
+ | `height` | `number` | `240` | The height of the plot in pixels. Default 240. The width is the container's. |
2736
+ | `formatX` | `((value: string \| number) => string)` | | Writes an x value on the axis, in the tooltip and in the data table. |
2737
+ | `formatValue` | `((value: number) => string)` | | Writes a number on the value axis, in the tooltip and in the data table: `(n) => `${n} kr``. |
2738
+ | `hideLegend` | `boolean` | `false` | Leave out the legend under the chart (for one series, whose name the heading says). |
2739
+ | `hideGrid` | `boolean` | `false` | Leave out the grid lines. |
2740
+ | `className` | `string` | | Extra classes for the chart's box. Merged last. |
2741
+
2742
+ Tested examples: `stories/patterns/charts/bar-chart.stories.tsx`
2743
+
2744
+ #### DonutChart
2745
+
2746
+ A ring divided into slices: how a whole splits into a few parts (five or fewer read well). The legend gives each slice's name and value, and the data is also given to a screen reader as a table. The colours are the chart tokens, so it follows the theme.
2747
+
2748
+ ```ts
2749
+ import { DonutChart } from "@primecoderin/fast-ui-react/charts";
2750
+ ```
2751
+
2752
+ | Prop | Type | Default | Description |
2753
+ | --- | --- | --- | --- |
2754
+ | `slices` * | `readonly DonutSlice[]` | | The slices, in the order they go round the ring. With none nothing is drawn, and the data table has no rows. |
2755
+ | `aria-label` * | `string` | | What the chart shows, e.g. "Orders by status". It names the chart and its data table. |
2756
+ | `nameLabel` * | `string` | | The heading of the data table's column of slice names, e.g. "Status". |
2757
+ | `valueLabel` * | `string` | | The heading of the data table's column of values, e.g. "Orders". |
2758
+ | `formatValue` | `((value: number) => string)` | | Writes a value in the legend, the tooltip and the data table. |
2759
+ | `centerLabel` | `ReactNode` | | In the hole: a total, a score. It is hidden from a screen reader, so the data table must say the same. |
2760
+ | `size` | `number` | `220` | The size of the ring in pixels. Default 220. |
2761
+ | `hideLegend` | `boolean` | `false` | Leave out the legend under the chart. |
2762
+ | `className` | `string` | | Extra classes for the chart's box. Merged last. |
2763
+
2764
+ Tested examples: `stories/patterns/charts/donut-chart.stories.tsx`
2765
+
2766
+ #### GaugeChart
2767
+
2768
+ A dial with a half circle for the arc: where one value stands between a minimum and a maximum (load, quota used, a score). It is a `role="meter"`, so a screen reader hears the name, the value and the range, and the arc is drawn by the eye only. The colour can follow bands, so a value turns from green to red as it climbs. The arc always fills from the left, like any dial, whatever the page's direction. It is a plain SVG.
2769
+
2770
+ ```ts
2771
+ import { GaugeChart } from "@primecoderin/fast-ui-react/charts";
2772
+ ```
2773
+
2774
+ | Prop | Type | Default | Description |
2775
+ | --- | --- | --- | --- |
2776
+ | `value` * | `number` | | The value to show. A value outside the range is drawn at the nearer end, and the meter's value (`aria-valuenow`) is held in the range too (a value that is not a number counts as the minimum), while its text (`aria-valuetext`) still says the value as it is. |
2777
+ | `aria-label` * | `string` | | What it measures, e.g. "CPU load". It names the gauge for a screen reader, which hears it as a meter with its value, minimum and maximum. |
2778
+ | `min` | `number` | `0` | The least the gauge can show. Default 0. |
2779
+ | `max` | `number` | `100` | The most the gauge can show. Default 100. |
2780
+ | `formatValue` | `((value: number) => string)` | | Writes a number: in the middle of the gauge, at its ends and in what a screen reader hears. `(n) => `${n}%``. |
2781
+ | `bands` | `readonly GaugeBand[]` | | Colours by value, from the lowest: `[{ upTo: 60, color: "var(--fast-tone-success-solid)" }, ...]`. The arc takes the colour of the band the value is in, so it turns amber and then red as the value climbs. |
2782
+ | `color` | `string` | | The arc's colour when there are no bands: a CSS colour or variable. The first chart token if omitted. |
2783
+ | `label` | `ReactNode` | | Under the value, in the middle: what it is, e.g. "CPU load". Hidden from a screen reader, which has `aria-label`. |
2784
+ | `showRange` | `boolean` | `false` | Show the minimum and the maximum under the ends of the arc. |
2785
+ | `size` | `number` | `200` | The width in pixels; the height is a little over half. Default 200. |
2786
+ | `className` | `string` | | Extra classes for the gauge. Merged last. |
2787
+
2788
+ Tested examples: `stories/patterns/charts/gauge-chart.stories.tsx`
2789
+
2790
+ #### LineChart
2791
+
2792
+ Lines over a shared x axis: a trend over time, a few measures side by side. The colours are the chart tokens, so it follows the theme and a tenant's branding, and each line after the first is dashed or dotted in its own way (the legend shows the same), so the lines differ by more than colour. The drawing is for the eyes; a screen reader gets the data as a table. It is an SVG, drawn by Recharts, and fills the width of its container.
2793
+
2794
+ ```ts
2795
+ import { LineChart } from "@primecoderin/fast-ui-react/charts";
2796
+ ```
2797
+
2798
+ | Prop | Type | Default | Description |
2799
+ | --- | --- | --- | --- |
2800
+ | `data` * | `readonly Readonly<Record<string, string \| number \| null>>[]` | | The rows to draw, in x order. With none the chart draws its axes only, and its data table has no rows. |
2801
+ | `xKey` * | `string` | | The key of the x value in each datum: a month, a date, a category. |
2802
+ | `series` * | `readonly ChartSeries[]` | | The measures to draw, one line, area or bar group each. Five is the most the colours can tell apart. |
2803
+ | `aria-label` * | `string` | | What the chart shows, e.g. "Orders per month". It names the chart and its data table. |
2804
+ | `curve` | `"step" \| "linear" \| "monotone"` | `"linear"` | How the line runs between points: straight (default), smoothed (`monotone`) or in steps. |
2805
+ | `showDots` | `boolean` | `false` | Mark each point with a dot. Default off; the dot under the pointer always shows. |
2806
+ | `xLabel` | `string` | | What the x values are called, for the data table a screen reader reads: "Month". The `xKey` if omitted. |
2807
+ | `height` | `number` | `240` | The height of the plot in pixels. Default 240. The width is the container's. |
2808
+ | `formatX` | `((value: string \| number) => string)` | | Writes an x value on the axis, in the tooltip and in the data table. |
2809
+ | `formatValue` | `((value: number) => string)` | | Writes a number on the value axis, in the tooltip and in the data table: `(n) => `${n} kr``. |
2810
+ | `hideLegend` | `boolean` | `false` | Leave out the legend under the chart (for one series, whose name the heading says). |
2811
+ | `hideGrid` | `boolean` | `false` | Leave out the grid lines. |
2812
+ | `className` | `string` | | Extra classes for the chart's box. Merged last. |
2813
+
2814
+ Tested examples: `stories/patterns/charts/line-chart.stories.tsx`
2815
+
2816
+ #### Sparkline
2817
+
2818
+ A tiny line chart with no axes or labels, to sit in a stat card or a table row and show a trend at a glance. It is a plain SVG, not Recharts, so it costs next to nothing to put in every row. It is an image to a screen reader, named by `aria-label`.
2819
+
2820
+ ```ts
2821
+ import { Sparkline } from "@primecoderin/fast-ui-react/charts";
2822
+ ```
2823
+
2824
+ | Prop | Type | Default | Description |
2825
+ | --- | --- | --- | --- |
2826
+ | `values` * | `readonly number[]` | | The numbers, in order, oldest first. Two or more draw a line; the line is scaled to fit the box. |
2827
+ | `aria-label` * | `string` | | What it says, in words, since the line itself has no numbers: "Sales, last 7 days: rising, 12 percent". A screen reader reads this as the sparkline's name. |
2828
+ | `color` | `string` | | A CSS colour or variable. The first chart token if omitted. |
2829
+ | `variant` | `"line" \| "area"` | `"line"` | A line (default), or a line with the area under it filled. |
2830
+ | `width` | `number` | `96` | Width in pixels. Default 96. |
2831
+ | `height` | `number` | `32` | Height in pixels. Default 32. |
2832
+ | `className` | `string` | | Extra classes on the root element, merged last so they win over the defaults. |
2833
+
2834
+ Tested examples: `stories/patterns/charts/sparkline.stories.tsx`
2835
+
2836
+ ## Rich text editor: `@primecoderin/fast-ui-react/editor`
2837
+
2838
+ ### Patterns
2839
+
2840
+ #### RichTextEditor
2841
+
2842
+ A text editor for formatted text: a toolbar of bold, italic, a heading, lists and a link over a writing area, with the usual shortcuts: Ctrl or Cmd with B, I and Z, Ctrl or Cmd with K to open the link field, and Shift+Enter for a line break. The value is HTML. The editor writes only those elements and drops the rest of what is pasted, but a request to the app's server can carry any HTML, so the app cleans the value before it shows one person's text to another. It is built on TipTap, so the app installs the TipTap packages to use it.
2843
+
2844
+ ```ts
2845
+ import { RichTextEditor } from "@primecoderin/fast-ui-react/editor";
2846
+ ```
2847
+
2848
+ | Prop | Type | Default | Description |
2849
+ | --- | --- | --- | --- |
2850
+ | `value` * | `string` | | The text as HTML. An empty string for none. The editor writes paragraphs, headings (levels 2 and 3), bulleted and numbered lists, bold, italic, links and line breaks (Shift+Enter). Anything else in a value it is given or in pasted HTML is dropped (its text is kept), and a link keeps only its address, with `rel="noopener noreferrer nofollow"`. |
2851
+ | `onValueChange` * | `(value: string) => void` | | Called with the HTML as it is edited, or "" while the document is empty. |
2852
+ | `labels` * | `RichTextEditorLabels` | | The texts of the toolbar and the link field. |
2853
+ | `disabled` | `boolean` | `false` | Makes the text read only: the toolbar is off and the writing area says it is disabled. |
2854
+ | `invalid` | `boolean` | `false` | Draws the box red and marks the editor invalid for assistive technology. |
2855
+ | `required` | `boolean` | `false` | Marks the editor required for assistive technology; the label shows the asterisk. |
2856
+ | `minHeight` | `number` | `160` | The height of the writing area at least, in pixels. Default 160. |
2857
+ | `aria-label` | `string` | | What names the editor when there is no visible label. |
2858
+ | `aria-labelledby` | `string` | | The id of the element that names the editor, such as a field's label. |
2859
+ | `aria-describedby` | `string` | | The ids of the field's message and hint, read after the name. |
2860
+ | `onBlur` | `(() => void)` | | The editor was left (focus moved out of the writing area). |
2861
+ | `editorRef` | `Ref<HTMLDivElement>` | | The editor's box, for a form library to find the first invalid field. |
2862
+ | `className` | `string` | | Extra classes for the editor's box. Merged last. |
2863
+
2864
+ Tested examples: `stories/patterns/rich-text-editor.stories.tsx`
2865
+
2866
+ ## Rich text form field: `@primecoderin/fast-ui-react/editor-forms`
2867
+
2868
+ ### Patterns
2869
+
2870
+ #### FormRichTextField
2871
+
2872
+ A RichTextEditor in a field, bound to a react-hook-form string field holding the text as HTML.
2873
+
2874
+ ```ts
2875
+ import { FormRichTextField } from "@primecoderin/fast-ui-react/editor-forms";
2876
+ ```
2877
+
2878
+ | Prop | Type | Default | Description |
2879
+ | --- | --- | --- | --- |
2880
+ | `control` * | `Control<TValues>` | | The react-hook-form `control` from `useForm()`. |
2881
+ | `name` * | `Path<TValues>` | | The field's name in the react-hook-form values. |
2882
+ | `label` * | `string` | | The visible label. |
2883
+ | `labels` * | `RichTextEditorLabels` | | The texts of the toolbar and the link field. |
2884
+ | `hint` | `string` | | |
2885
+ | `orientation` | `FieldOrientation` | | Label above the control (default) or in a column beside it. |
2886
+ | `rules` | `Omit<RegisterOptions<TValues, Path<TValues>>, "disabled" \| "valueAsNumber" \| "valueAsDate" \| "setValueAs">` | | react-hook-form validation rules, for forms that do not use a schema resolver. |
2887
+ | `formatError` | `((message: string) => string)` | | Turns a stored schema message (an i18n key) into display text. |
2888
+ | `disabled` | `boolean` | `false` | Makes the text read only: the toolbar is off and the writing area says it is disabled. |
2889
+ | `required` | `boolean` | | Marks the editor required for assistive technology; the label shows the asterisk. |
2890
+ | `minHeight` | `number` | | The height of the writing area at least, in pixels. Default 160. |
2891
+
2892
+ Tested examples: `stories/patterns/form-fields/form-rich-text-field.stories.tsx`
2893
+
2894
+ ## Hooks, functions and constants
2895
+
2896
+ | Export | Kind | Entry | What it is |
2897
+ | --- | --- | --- | --- |
2898
+ | `applyTenantBranding` | function | `main` | Applies a tenant's branding to the page, or restores the default teal when given `null`. |
2899
+ | `applyTheme` | function | `main` | Applies a theme to the page, or removes the one applied when given `null`. |
2900
+ | `applyThemeMode` | function | `main` | Applies a theme to the page. |
2901
+ | `applyThemePreference` | function | `main` | Applies a theme preference. |
2902
+ | `BRANDING_STYLE_ID` | constant | `main` | The id of the <style> element that holds a tenant's branding (`applyTenantBranding`, the provider's `branding`). |
2903
+ | `cn` | function | `main` | Joins class names and resolves Tailwind conflicts, the later one winning: `cn("px-4 py-2", isCompact && "px-2", className)`. |
2904
+ | `createTheme` | function | `main` | Makes a theme: the primary colour (`branding`) and any of the design tokens, for both themes or for one. |
2905
+ | `createTooltipGroup` | function | `main` | Many triggers, one tooltip: for a table of metrics where every figure explains itself on hover and a tooltip each would mean hundreds of them. |
2906
+ | `ENGLISH_RANGE_LABELS` | constant | `main` | The texts used when a picker is given none. |
2907
+ | `FAST_ICONS` | constant | `main` | The shared icons of the design foundation, grouped by common navigation, actions and status roles. |
2908
+ | `fieldControl` | function | `main` | The box around a text input, a text area or a select trigger. |
2909
+ | `fieldInput` | constant | `main` | The `<input>` inside a control box: no chrome of its own, it fills the box. |
2910
+ | `formatFileSize` | function | `main` | A file's size the way a person reads it: "12 byte", "3.4 kB", "1.2 MB" in the user's language (the unit names come from the browser's Intl, so nothing here needs translating). |
2911
+ | `getChartPalette` | function | `main` | |
2912
+ | `getInitials` | function | `main` | The initials of a name's first and last words, e.g. "Jane Ann Doe" → "JD". |
2913
+ | `heatmapGradient` | function | `main` | The heatmap's colours as a CSS gradient for its legend, low to high in the reading direction. |
2914
+ | `hexToHsv` | function | `main` | The hue, saturation and brightness of a hex colour; null if `hex` is not one. |
2915
+ | `hsvToHex` | function | `main` | The hex colour ("#rrggbb") of a hue, saturation and brightness; each is kept within its range. |
2916
+ | `joinPhone` | function | `main` | Joins a calling code ("+972") and the digits ("541234567") into E.164: "+972541234567". |
2917
+ | `matchesAccept` | function | `main` | Whether a file matches an `accept` list as the file input writes it: extensions (".png"), exact types ("image/png") and wildcards ("image/*"), separated by commas. |
2918
+ | `parseHex` | function | `main` | A hex colour written the way it is stored: "#rrggbb" in lower case, from "#6D28D9", "6d28d9", "#6d2" (each digit doubled) or "6d2". |
2919
+ | `QRCode` | function | `main` | A QR code for a link or a short text, drawn as SVG (crisp at any size and in print). |
2920
+ | `readInternationalPhone` | function | `main` | Reads text pasted into a phone number's digits. |
2921
+ | `restoreThemeAttribute` | function | `main` | Puts the page's `data-theme` back to `theme`, the value it had before (`null`: no attribute), at once and without a cross-fade. |
2922
+ | `splitPhone` | function | `main` | Splits an E.164 number into its calling code and digits. |
2923
+ | `THEME_STYLE_ID` | constant | `main` | The id of the <style> element that holds the theme (`createTheme`, the provider's `theme`). |
2924
+ | `toErrorText` | function | `main` | Validation messages are stored as i18n keys (the design system has no i18n), so the caller supplies `formatError` to turn one into display text. |
2925
+ | `TOKEN_NAMES` | constant | `main` | The design tokens: each is the CSS variable `--fast-<name>`. |
2926
+ | `useAppToast` | hook | `main` | Raises toasts through the app-wide toaster hosted by DesignSystemProvider. |
2927
+
2928
+ For the types, and for tested examples of each component, use the [MCP server](ai-assistants.md) or the stories in `stories/`.