@vjdesigns/vjdesigns-ui 3.3.0 → 3.5.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 (505) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/README.md +854 -864
  3. package/dist/components/data-display/Accordion/Accordion.mjs +97 -166
  4. package/dist/components/data-display/Chat/Chat.d.ts +13 -2
  5. package/dist/components/data-display/Collapsible/Collapsible.d.ts +70 -0
  6. package/dist/components/data-display/Collapsible/Collapsible.mjs +102 -0
  7. package/dist/components/data-display/Collapsible/Collapsible.module.css.mjs +8 -0
  8. package/dist/components/data-display/Collapsible/index.d.ts +1 -0
  9. package/dist/components/feedback/Progress/Progress.d.ts +32 -2
  10. package/dist/components/feedback/Progress/Progress.mjs +78 -74
  11. package/dist/components/feedback/Progress/Progress.module.css.mjs +1 -1
  12. package/dist/components/forms/CheckBox/CheckBox.mjs +171 -135
  13. package/dist/components/forms/CheckBox/CheckBox.module.css.mjs +5 -3
  14. package/dist/components/forms/Radio/Radio.mjs +12 -10
  15. package/dist/components/forms/ToggleGroup/ToggleGroup.mjs +133 -131
  16. package/dist/components/navigation/Toolbar/Toolbar.mjs +106 -0
  17. package/dist/components/navigation/Toolbar/Toolbar.module.css.mjs +11 -0
  18. package/dist/components/navigation/Toolbar/ToolbarContext.mjs +4 -0
  19. package/dist/components/navigation/Toolbar/index.d.ts +1 -0
  20. package/dist/components/primitives/CopyButton/CopyButton.d.ts +39 -0
  21. package/dist/components/primitives/CopyButton/CopyButton.mjs +49 -0
  22. package/dist/components/primitives/CopyButton/index.d.ts +1 -0
  23. package/dist/hooks/useCollapsePresence.mjs +83 -0
  24. package/dist/i18n/en.mjs +5 -0
  25. package/dist/index.mjs +104 -101
  26. package/dist/locales/ar.mjs +5 -0
  27. package/dist/locales/bn.mjs +5 -0
  28. package/dist/locales/cs.mjs +5 -0
  29. package/dist/locales/da.mjs +5 -0
  30. package/dist/locales/de.mjs +5 -0
  31. package/dist/locales/el.mjs +5 -0
  32. package/dist/locales/es.mjs +5 -0
  33. package/dist/locales/fa.mjs +5 -0
  34. package/dist/locales/fi.mjs +5 -0
  35. package/dist/locales/fr.mjs +5 -0
  36. package/dist/locales/he.mjs +5 -0
  37. package/dist/locales/hi.mjs +5 -0
  38. package/dist/locales/hu.mjs +5 -0
  39. package/dist/locales/id.mjs +5 -0
  40. package/dist/locales/it.mjs +5 -0
  41. package/dist/locales/ja.mjs +5 -0
  42. package/dist/locales/ko.mjs +5 -0
  43. package/dist/locales/nb.mjs +5 -0
  44. package/dist/locales/nl.mjs +5 -0
  45. package/dist/locales/pl.mjs +5 -0
  46. package/dist/locales/pt-BR.mjs +5 -0
  47. package/dist/locales/ro.mjs +5 -0
  48. package/dist/locales/ru.mjs +5 -0
  49. package/dist/locales/sv.mjs +5 -0
  50. package/dist/locales/th.mjs +5 -0
  51. package/dist/locales/tr.mjs +5 -0
  52. package/dist/locales/uk.mjs +5 -0
  53. package/dist/locales/ur.mjs +5 -0
  54. package/dist/locales/vi.mjs +5 -0
  55. package/dist/locales/zh-Hans.mjs +5 -0
  56. package/dist/locales/zh-Hant.mjs +5 -0
  57. package/dist/vjdesigns-ui.css +1 -1
  58. package/package.json +7 -5
  59. package/dist/ai/llms-full.txt +0 -8498
  60. package/dist/ai/llms.txt +0 -198
  61. package/dist/ai/mcp-server.mjs +0 -212
  62. package/dist/ai/registry.json +0 -21048
  63. package/dist/components/data-display/Accordion/Accordion.cjs.js +0 -1
  64. package/dist/components/data-display/Accordion/Accordion.module.css.cjs.js +0 -1
  65. package/dist/components/data-display/Avatar/Avatar.cjs.js +0 -1
  66. package/dist/components/data-display/Avatar/Avatar.module.css.cjs.js +0 -1
  67. package/dist/components/data-display/Badge/Badge.cjs.js +0 -1
  68. package/dist/components/data-display/Badge/Badge.module.css.cjs.js +0 -1
  69. package/dist/components/data-display/Card/Card.cjs.js +0 -1
  70. package/dist/components/data-display/Card/Card.module.css.cjs.js +0 -1
  71. package/dist/components/data-display/Carousel/Carousel.cjs.js +0 -1
  72. package/dist/components/data-display/Carousel/Carousel.module.css.cjs.js +0 -1
  73. package/dist/components/data-display/Chat/Chat.cjs.js +0 -1
  74. package/dist/components/data-display/Chat/Chat.module.css.cjs.js +0 -1
  75. package/dist/components/data-display/Chat/streams.cjs.js +0 -4
  76. package/dist/components/data-display/Chip/Chip.cjs.js +0 -1
  77. package/dist/components/data-display/Chip/Chip.module.css.cjs.js +0 -1
  78. package/dist/components/data-display/CodeBlock/CodeBlock.cjs.js +0 -6
  79. package/dist/components/data-display/CodeBlock/CodeBlock.module.css.cjs.js +0 -1
  80. package/dist/components/data-display/CodeBlock/tokenize.cjs.js +0 -13
  81. package/dist/components/data-display/CodeBlock/tokenize.d.ts +0 -26
  82. package/dist/components/data-display/Countdown/Countdown.cjs.js +0 -1
  83. package/dist/components/data-display/Countdown/Countdown.module.css.cjs.js +0 -1
  84. package/dist/components/data-display/DataGrid/DataGrid.cjs.js +0 -1
  85. package/dist/components/data-display/DataGrid/DataGrid.module.css.cjs.js +0 -1
  86. package/dist/components/data-display/DataGrid/dataGridUtils.cjs.js +0 -1
  87. package/dist/components/data-display/DataGrid/dataGridUtils.d.ts +0 -46
  88. package/dist/components/data-display/EmptyState/EmptyState.cjs.js +0 -1
  89. package/dist/components/data-display/EmptyState/EmptyState.module.css.cjs.js +0 -1
  90. package/dist/components/data-display/Image/Image.cjs.js +0 -1
  91. package/dist/components/data-display/Image/Image.module.css.cjs.js +0 -1
  92. package/dist/components/data-display/List/List.cjs.js +0 -1
  93. package/dist/components/data-display/List/List.module.css.cjs.js +0 -1
  94. package/dist/components/data-display/Stat/Stat.cjs.js +0 -1
  95. package/dist/components/data-display/Stat/Stat.module.css.cjs.js +0 -1
  96. package/dist/components/data-display/Table/Table.cjs.js +0 -1
  97. package/dist/components/data-display/Table/Table.module.css.cjs.js +0 -1
  98. package/dist/components/data-display/Table/useTable.cjs.js +0 -1
  99. package/dist/components/data-display/Table/useTable.d.ts +0 -118
  100. package/dist/components/data-display/Timeline/Timeline.cjs.js +0 -1
  101. package/dist/components/data-display/Timeline/Timeline.module.css.cjs.js +0 -1
  102. package/dist/components/data-display/TreeView/TreeView.cjs.js +0 -1
  103. package/dist/components/data-display/TreeView/TreeView.module.css.cjs.js +0 -1
  104. package/dist/components/data-display/TreeView/treeUtils.cjs.js +0 -1
  105. package/dist/components/data-display/TreeView/treeUtils.d.ts +0 -82
  106. package/dist/components/data-display/VirtualList/VirtualList.cjs.js +0 -1
  107. package/dist/components/data-display/VirtualList/VirtualList.module.css.cjs.js +0 -1
  108. package/dist/components/feedback/Alert/Alert.cjs.js +0 -1
  109. package/dist/components/feedback/Alert/Alert.module.css.cjs.js +0 -1
  110. package/dist/components/feedback/Banner/Banner.cjs.js +0 -1
  111. package/dist/components/feedback/Banner/Banner.module.css.cjs.js +0 -1
  112. package/dist/components/feedback/ErrorSummary/ErrorSummary.cjs.js +0 -1
  113. package/dist/components/feedback/ErrorSummary/ErrorSummary.module.css.cjs.js +0 -1
  114. package/dist/components/feedback/Progress/Progress.cjs.js +0 -1
  115. package/dist/components/feedback/Progress/Progress.module.css.cjs.js +0 -1
  116. package/dist/components/feedback/Skeleton/Skeleton.cjs.js +0 -1
  117. package/dist/components/feedback/Skeleton/Skeleton.module.css.cjs.js +0 -1
  118. package/dist/components/feedback/Spinner/Spinner.cjs.js +0 -1
  119. package/dist/components/feedback/Spinner/Spinner.module.css.cjs.js +0 -1
  120. package/dist/components/feedback/Toast/Toast.cjs.js +0 -1
  121. package/dist/components/feedback/Toast/Toast.module.css.cjs.js +0 -1
  122. package/dist/components/feedback/Toast/Toast.storyHelpers.d.ts +0 -21
  123. package/dist/components/feedback/Toast/ToastItem.cjs.js +0 -1
  124. package/dist/components/feedback/Toast/ToastItem.d.ts +0 -18
  125. package/dist/components/feedback/Toast/ToastProvider.cjs.js +0 -1
  126. package/dist/components/feedback/Toast/ToastViewport.cjs.js +0 -1
  127. package/dist/components/feedback/Toast/ToastViewport.d.ts +0 -25
  128. package/dist/components/feedback/Toast/toastStore.cjs.js +0 -1
  129. package/dist/components/feedback/Toast/toastTiming.cjs.js +0 -1
  130. package/dist/components/feedback/Toast/toastTypes.d.ts +0 -136
  131. package/dist/components/feedback/Toast/useToast.cjs.js +0 -1
  132. package/dist/components/feedback/Toast/useToastAnnouncer.cjs.js +0 -1
  133. package/dist/components/feedback/Toast/useToastAnnouncer.d.ts +0 -15
  134. package/dist/components/forms/CheckBox/CheckBox.cjs.js +0 -1
  135. package/dist/components/forms/CheckBox/CheckBox.d.ts +0 -79
  136. package/dist/components/forms/CheckBox/CheckBox.module.css.cjs.js +0 -1
  137. package/dist/components/forms/ColorPicker/ColorInput.cjs.js +0 -1
  138. package/dist/components/forms/ColorPicker/ColorInput.d.ts +0 -38
  139. package/dist/components/forms/ColorPicker/ColorPicker.cjs.js +0 -1
  140. package/dist/components/forms/ColorPicker/ColorPicker.d.ts +0 -129
  141. package/dist/components/forms/ColorPicker/ColorPicker.module.css.cjs.js +0 -1
  142. package/dist/components/forms/ColorPicker/colorUtils.cjs.js +0 -1
  143. package/dist/components/forms/ColorPicker/colorUtils.d.ts +0 -86
  144. package/dist/components/forms/Combobox/Combobox.cjs.js +0 -1
  145. package/dist/components/forms/Combobox/Combobox.d.ts +0 -172
  146. package/dist/components/forms/Combobox/Combobox.module.css.cjs.js +0 -1
  147. package/dist/components/forms/Combobox/ComboboxPopup.cjs.js +0 -1
  148. package/dist/components/forms/Combobox/ComboboxPopup.d.ts +0 -40
  149. package/dist/components/forms/Combobox/comboboxUtils.cjs.js +0 -1
  150. package/dist/components/forms/Combobox/comboboxUtils.d.ts +0 -73
  151. package/dist/components/forms/DatePicker/Calendar.cjs.js +0 -1
  152. package/dist/components/forms/DatePicker/Calendar.d.ts +0 -98
  153. package/dist/components/forms/DatePicker/Calendar.module.css.cjs.js +0 -1
  154. package/dist/components/forms/DatePicker/DatePicker.cjs.js +0 -1
  155. package/dist/components/forms/DatePicker/DatePicker.d.ts +0 -100
  156. package/dist/components/forms/DatePicker/DatePicker.module.css.cjs.js +0 -1
  157. package/dist/components/forms/DatePicker/DateRangePicker.cjs.js +0 -1
  158. package/dist/components/forms/DatePicker/DateRangePicker.d.ts +0 -124
  159. package/dist/components/forms/DatePicker/DateRangePicker.module.css.cjs.js +0 -1
  160. package/dist/components/forms/DatePicker/dateUtils.cjs.js +0 -1
  161. package/dist/components/forms/DatePicker/dateUtils.d.ts +0 -88
  162. package/dist/components/forms/DateTimePicker/DateTimePicker.cjs.js +0 -1
  163. package/dist/components/forms/DateTimePicker/DateTimePicker.d.ts +0 -101
  164. package/dist/components/forms/DateTimePicker/DateTimePicker.module.css.cjs.js +0 -1
  165. package/dist/components/forms/Field/Field.cjs.js +0 -1
  166. package/dist/components/forms/Field/Field.d.ts +0 -171
  167. package/dist/components/forms/Field/Field.module.css.cjs.js +0 -1
  168. package/dist/components/forms/Field/FieldContext.cjs.js +0 -1
  169. package/dist/components/forms/Field/FieldContext.d.ts +0 -74
  170. package/dist/components/forms/FileUpload/FileUpload.cjs.js +0 -1
  171. package/dist/components/forms/FileUpload/FileUpload.d.ts +0 -153
  172. package/dist/components/forms/FileUpload/FileUpload.module.css.cjs.js +0 -1
  173. package/dist/components/forms/Input/Input.cjs.js +0 -1
  174. package/dist/components/forms/Input/Input.d.ts +0 -98
  175. package/dist/components/forms/Input/Input.module.css.cjs.js +0 -1
  176. package/dist/components/forms/NumberInput/NumberInput.cjs.js +0 -1
  177. package/dist/components/forms/NumberInput/NumberInput.d.ts +0 -87
  178. package/dist/components/forms/NumberInput/NumberInput.module.css.cjs.js +0 -1
  179. package/dist/components/forms/PasswordInput/PasswordInput.cjs.js +0 -1
  180. package/dist/components/forms/PasswordInput/PasswordInput.d.ts +0 -117
  181. package/dist/components/forms/PasswordInput/PasswordInput.module.css.cjs.js +0 -1
  182. package/dist/components/forms/PinInput/PinInput.cjs.js +0 -1
  183. package/dist/components/forms/PinInput/PinInput.d.ts +0 -92
  184. package/dist/components/forms/PinInput/PinInput.module.css.cjs.js +0 -1
  185. package/dist/components/forms/Radio/Radio.cjs.js +0 -1
  186. package/dist/components/forms/Radio/Radio.d.ts +0 -119
  187. package/dist/components/forms/Radio/Radio.module.css.cjs.js +0 -1
  188. package/dist/components/forms/Rating/Rating.cjs.js +0 -1
  189. package/dist/components/forms/Rating/Rating.d.ts +0 -128
  190. package/dist/components/forms/Rating/Rating.module.css.cjs.js +0 -1
  191. package/dist/components/forms/SearchInput/SearchInput.cjs.js +0 -1
  192. package/dist/components/forms/SearchInput/SearchInput.d.ts +0 -124
  193. package/dist/components/forms/SearchInput/SearchInput.module.css.cjs.js +0 -1
  194. package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.js +0 -1
  195. package/dist/components/forms/SegmentedControl/SegmentedControl.d.ts +0 -120
  196. package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.js +0 -1
  197. package/dist/components/forms/Select/Select.cjs.js +0 -1
  198. package/dist/components/forms/Select/Select.d.ts +0 -86
  199. package/dist/components/forms/Select/Select.module.css.cjs.js +0 -1
  200. package/dist/components/forms/Slider/Slider.cjs.js +0 -1
  201. package/dist/components/forms/Slider/Slider.d.ts +0 -84
  202. package/dist/components/forms/Slider/Slider.module.css.cjs.js +0 -1
  203. package/dist/components/forms/Switch/Switch.cjs.js +0 -1
  204. package/dist/components/forms/Switch/Switch.d.ts +0 -62
  205. package/dist/components/forms/Switch/Switch.module.css.cjs.js +0 -1
  206. package/dist/components/forms/TagInput/TagInput.cjs.js +0 -1
  207. package/dist/components/forms/TagInput/TagInput.d.ts +0 -144
  208. package/dist/components/forms/TagInput/TagInput.module.css.cjs.js +0 -1
  209. package/dist/components/forms/Textarea/Textarea.cjs.js +0 -1
  210. package/dist/components/forms/Textarea/Textarea.d.ts +0 -62
  211. package/dist/components/forms/Textarea/Textarea.module.css.cjs.js +0 -1
  212. package/dist/components/forms/TimePicker/TimePicker.cjs.js +0 -1
  213. package/dist/components/forms/TimePicker/TimePicker.d.ts +0 -116
  214. package/dist/components/forms/TimePicker/TimePicker.module.css.cjs.js +0 -1
  215. package/dist/components/forms/TimePicker/timeUtils.cjs.js +0 -1
  216. package/dist/components/forms/TimePicker/timeUtils.d.ts +0 -26
  217. package/dist/components/forms/ToggleGroup/ToggleGroup.cjs.js +0 -1
  218. package/dist/components/forms/ToggleGroup/ToggleGroup.d.ts +0 -153
  219. package/dist/components/forms/ToggleGroup/ToggleGroup.module.css.cjs.js +0 -1
  220. package/dist/components/layout/Box/Box.cjs.js +0 -1
  221. package/dist/components/layout/Box/Box.module.css.cjs.js +0 -1
  222. package/dist/components/layout/Container/Container.cjs.js +0 -1
  223. package/dist/components/layout/Container/Container.module.css.cjs.js +0 -1
  224. package/dist/components/layout/Divider/Divider.cjs.js +0 -1
  225. package/dist/components/layout/Divider/Divider.module.css.cjs.js +0 -1
  226. package/dist/components/layout/Flex/Flex.cjs.js +0 -1
  227. package/dist/components/layout/Flex/Flex.module.css.cjs.js +0 -1
  228. package/dist/components/layout/Grid/Grid.cjs.js +0 -1
  229. package/dist/components/layout/Grid/Grid.module.css.cjs.js +0 -1
  230. package/dist/components/layout/ResizablePanels/ResizablePanels.cjs.js +0 -1
  231. package/dist/components/layout/ResizablePanels/ResizablePanels.module.css.cjs.js +0 -1
  232. package/dist/components/layout/ScrollArea/ScrollArea.cjs.js +0 -1
  233. package/dist/components/layout/ScrollArea/ScrollArea.module.css.cjs.js +0 -1
  234. package/dist/components/layout/Stack/Stack.cjs.js +0 -1
  235. package/dist/components/layout/Stack/Stack.module.css.cjs.js +0 -1
  236. package/dist/components/navigation/Breadcrumbs/Breadcrumbs.cjs.js +0 -1
  237. package/dist/components/navigation/Breadcrumbs/Breadcrumbs.module.css.cjs.js +0 -1
  238. package/dist/components/navigation/ContextMenu/ContextMenu.cjs.js +0 -1
  239. package/dist/components/navigation/ContextMenu/ContextMenu.module.css.cjs.js +0 -1
  240. package/dist/components/navigation/Link/Link.cjs.js +0 -1
  241. package/dist/components/navigation/Link/Link.module.css.cjs.js +0 -1
  242. package/dist/components/navigation/Menu/Menu.cjs.js +0 -1
  243. package/dist/components/navigation/Menu/Menu.module.css.cjs.js +0 -1
  244. package/dist/components/navigation/Menu/MenuContent.cjs.js +0 -1
  245. package/dist/components/navigation/Menu/MenuContent.d.ts +0 -46
  246. package/dist/components/navigation/Menu/MenuContext.cjs.js +0 -1
  247. package/dist/components/navigation/Menu/MenuContext.d.ts +0 -84
  248. package/dist/components/navigation/Menu/MenuItem.cjs.js +0 -1
  249. package/dist/components/navigation/Menu/MenuItem.d.ts +0 -133
  250. package/dist/components/navigation/Menu/MenuSub.cjs.js +0 -1
  251. package/dist/components/navigation/Menu/MenuSub.d.ts +0 -28
  252. package/dist/components/navigation/Menu/useMenuRoot.cjs.js +0 -1
  253. package/dist/components/navigation/Menu/useMenuRoot.d.ts +0 -14
  254. package/dist/components/navigation/Navbar/Navbar.cjs.js +0 -1
  255. package/dist/components/navigation/Navbar/Navbar.module.css.cjs.js +0 -1
  256. package/dist/components/navigation/Pagination/Pagination.cjs.js +0 -1
  257. package/dist/components/navigation/Pagination/Pagination.d.ts +0 -97
  258. package/dist/components/navigation/Pagination/Pagination.module.css.cjs.js +0 -1
  259. package/dist/components/navigation/Sidebar/Sidebar.cjs.js +0 -1
  260. package/dist/components/navigation/Sidebar/Sidebar.module.css.cjs.js +0 -1
  261. package/dist/components/navigation/Sidebar/Sidebar.storyHelpers.d.ts +0 -27
  262. package/dist/components/navigation/Sidebar/SidebarContext.cjs.js +0 -1
  263. package/dist/components/navigation/Sidebar/SidebarContext.d.ts +0 -45
  264. package/dist/components/navigation/Sidebar/SidebarParts.cjs.js +0 -1
  265. package/dist/components/navigation/Sidebar/SidebarParts.d.ts +0 -179
  266. package/dist/components/navigation/SkipLink/SkipLink.cjs.js +0 -1
  267. package/dist/components/navigation/SkipLink/SkipLink.d.ts +0 -41
  268. package/dist/components/navigation/SkipLink/SkipLink.module.css.cjs.js +0 -1
  269. package/dist/components/navigation/Stepper/Stepper.cjs.js +0 -1
  270. package/dist/components/navigation/Stepper/Stepper.module.css.cjs.js +0 -1
  271. package/dist/components/navigation/Tabs/Tabs.cjs.js +0 -1
  272. package/dist/components/navigation/Tabs/Tabs.d.ts +0 -132
  273. package/dist/components/navigation/Tabs/Tabs.module.css.cjs.js +0 -1
  274. package/dist/components/overlays/CommandPalette/CommandPalette.cjs.js +0 -1
  275. package/dist/components/overlays/CommandPalette/CommandPalette.module.css.cjs.js +0 -1
  276. package/dist/components/overlays/CommandPalette/CommandPaletteContext.cjs.js +0 -1
  277. package/dist/components/overlays/CommandPalette/CommandPaletteContext.d.ts +0 -96
  278. package/dist/components/overlays/CommandPalette/CommandPaletteParts.cjs.js +0 -1
  279. package/dist/components/overlays/CommandPalette/CommandPaletteParts.d.ts +0 -115
  280. package/dist/components/overlays/CommandPalette/commandPaletteUtils.cjs.js +0 -1
  281. package/dist/components/overlays/CommandPalette/commandPaletteUtils.d.ts +0 -50
  282. package/dist/components/overlays/Drawer/Drawer.cjs.js +0 -1
  283. package/dist/components/overlays/Drawer/Drawer.module.css.cjs.js +0 -1
  284. package/dist/components/overlays/Drawer/Drawer.storyHelpers.d.ts +0 -16
  285. package/dist/components/overlays/Drawer/DrawerContent.cjs.js +0 -1
  286. package/dist/components/overlays/Drawer/DrawerContent.d.ts +0 -27
  287. package/dist/components/overlays/Drawer/DrawerContext.cjs.js +0 -1
  288. package/dist/components/overlays/Drawer/DrawerContext.d.ts +0 -39
  289. package/dist/components/overlays/Drawer/DrawerParts.cjs.js +0 -1
  290. package/dist/components/overlays/Drawer/DrawerParts.d.ts +0 -65
  291. package/dist/components/overlays/Drawer/internal.cjs.js +0 -1
  292. package/dist/components/overlays/Drawer/internal.d.ts +0 -1
  293. package/dist/components/overlays/Drawer/useDragToClose.cjs.js +0 -1
  294. package/dist/components/overlays/Drawer/useDragToClose.d.ts +0 -28
  295. package/dist/components/overlays/HoverCard/HoverCard.cjs.js +0 -1
  296. package/dist/components/overlays/HoverCard/HoverCard.module.css.cjs.js +0 -1
  297. package/dist/components/overlays/Modal/ConfirmModal.cjs.js +0 -1
  298. package/dist/components/overlays/Modal/Modal.cjs.js +0 -1
  299. package/dist/components/overlays/Modal/Modal.module.css.cjs.js +0 -1
  300. package/dist/components/overlays/Modal/ModalContent.cjs.js +0 -1
  301. package/dist/components/overlays/Modal/ModalContent.d.ts +0 -12
  302. package/dist/components/overlays/Modal/ModalContext.cjs.js +0 -1
  303. package/dist/components/overlays/Modal/ModalContext.d.ts +0 -56
  304. package/dist/components/overlays/Modal/useScrollRegion.cjs.js +0 -1
  305. package/dist/components/overlays/Modal/useScrollRegion.d.ts +0 -7
  306. package/dist/components/overlays/Popover/Popover.cjs.js +0 -1
  307. package/dist/components/overlays/Popover/Popover.module.css.cjs.js +0 -1
  308. package/dist/components/overlays/Popover/PopoverContent.cjs.js +0 -1
  309. package/dist/components/overlays/Popover/PopoverContent.d.ts +0 -41
  310. package/dist/components/overlays/Popover/PopoverContext.cjs.js +0 -1
  311. package/dist/components/overlays/Popover/PopoverContext.d.ts +0 -38
  312. package/dist/components/overlays/Tooltip/Tooltip.cjs.js +0 -1
  313. package/dist/components/overlays/Tooltip/Tooltip.module.css.cjs.js +0 -1
  314. package/dist/components/primitives/Button/Button.cjs.js +0 -1
  315. package/dist/components/primitives/Button/Button.module.css.cjs.js +0 -1
  316. package/dist/components/primitives/Icon/Icon.cjs.js +0 -1
  317. package/dist/components/primitives/Icon/Icon.module.css.cjs.js +0 -1
  318. package/dist/components/primitives/Icon/IconSvg.cjs.js +0 -1
  319. package/dist/components/primitives/Icon/IconSvg.d.ts +0 -31
  320. package/dist/components/primitives/Icon/icons.cjs.js +0 -1
  321. package/dist/components/primitives/Kbd/Kbd.cjs.js +0 -1
  322. package/dist/components/primitives/Kbd/Kbd.module.css.cjs.js +0 -1
  323. package/dist/components/primitives/Typography/Typography.cjs.js +0 -1
  324. package/dist/components/primitives/Typography/Typography.module.css.cjs.js +0 -1
  325. package/dist/components/utilities/LocaleProvider/LocaleProvider.cjs.js +0 -1
  326. package/dist/components/utilities/LocaleProvider/LocaleProvider.module.css.cjs.js +0 -1
  327. package/dist/components/utilities/Portal/Portal.cjs.js +0 -1
  328. package/dist/components/utilities/Theme/Theme.cjs.js +0 -1
  329. package/dist/components/utilities/Theme/Theme.module.css.cjs.js +0 -1
  330. package/dist/components/utilities/VisuallyHidden/VisuallyHidden.cjs.js +0 -1
  331. package/dist/components/utilities/VisuallyHidden/VisuallyHidden.module.css.cjs.js +0 -1
  332. package/dist/hooks/elementSource.cjs.js +0 -1
  333. package/dist/hooks/elementSource.d.ts +0 -16
  334. package/dist/hooks/index.d.ts +0 -21
  335. package/dist/hooks/useClipboard.cjs.js +0 -1
  336. package/dist/hooks/useClipboard.d.ts +0 -24
  337. package/dist/hooks/useControllableState.cjs.js +0 -1
  338. package/dist/hooks/useControllableState.d.ts +0 -15
  339. package/dist/hooks/useDisclosure.cjs.js +0 -1
  340. package/dist/hooks/useDisclosure.d.ts +0 -35
  341. package/dist/hooks/useDismiss.cjs.js +0 -1
  342. package/dist/hooks/useDismiss.d.ts +0 -33
  343. package/dist/hooks/useElementObservers.cjs.js +0 -1
  344. package/dist/hooks/useElementObservers.d.ts +0 -70
  345. package/dist/hooks/useEnvironment.cjs.js +0 -1
  346. package/dist/hooks/useEnvironment.d.ts +0 -42
  347. package/dist/hooks/useFloatingPosition.cjs.js +0 -1
  348. package/dist/hooks/useFloatingPosition.d.ts +0 -55
  349. package/dist/hooks/useFocusTrap.cjs.js +0 -1
  350. package/dist/hooks/useFocusTrap.d.ts +0 -52
  351. package/dist/hooks/useFormReset.cjs.js +0 -1
  352. package/dist/hooks/useFormReset.d.ts +0 -17
  353. package/dist/hooks/useFormValidation.cjs.js +0 -1
  354. package/dist/hooks/useFormValidation.d.ts +0 -101
  355. package/dist/hooks/useHotkeys.cjs.js +0 -1
  356. package/dist/hooks/useHotkeys.d.ts +0 -50
  357. package/dist/hooks/useInertOutside.cjs.js +0 -1
  358. package/dist/hooks/useInertOutside.d.ts +0 -23
  359. package/dist/hooks/useMediaQuery.cjs.js +0 -1
  360. package/dist/hooks/useMediaQuery.d.ts +0 -11
  361. package/dist/hooks/useMergedRef.cjs.js +0 -1
  362. package/dist/hooks/useMergedRef.d.ts +0 -7
  363. package/dist/hooks/useOverlayLayer.cjs.js +0 -1
  364. package/dist/hooks/useOverlayLayer.d.ts +0 -92
  365. package/dist/hooks/useResponsiveValue.cjs.js +0 -1
  366. package/dist/hooks/useResponsiveValue.d.ts +0 -10
  367. package/dist/hooks/useScrollLock.cjs.js +0 -1
  368. package/dist/hooks/useScrollLock.d.ts +0 -4
  369. package/dist/hooks/useStorage.cjs.js +0 -1
  370. package/dist/hooks/useStorage.d.ts +0 -21
  371. package/dist/hooks/useTiming.cjs.js +0 -1
  372. package/dist/hooks/useTiming.d.ts +0 -78
  373. package/dist/hooks/useVirtualizer.cjs.js +0 -1
  374. package/dist/hooks/useVirtualizer.d.ts +0 -90
  375. package/dist/i18n/en.cjs.js +0 -1
  376. package/dist/i18n/en.d.ts +0 -3
  377. package/dist/i18n/index.d.ts +0 -4
  378. package/dist/i18n/locales/ar.d.ts +0 -3
  379. package/dist/i18n/locales/bn.d.ts +0 -3
  380. package/dist/i18n/locales/cs.d.ts +0 -3
  381. package/dist/i18n/locales/da.d.ts +0 -3
  382. package/dist/i18n/locales/de.d.ts +0 -3
  383. package/dist/i18n/locales/el.d.ts +0 -3
  384. package/dist/i18n/locales/es.d.ts +0 -3
  385. package/dist/i18n/locales/fa.d.ts +0 -3
  386. package/dist/i18n/locales/fi.d.ts +0 -3
  387. package/dist/i18n/locales/fr.d.ts +0 -3
  388. package/dist/i18n/locales/he.d.ts +0 -3
  389. package/dist/i18n/locales/hi.d.ts +0 -3
  390. package/dist/i18n/locales/hu.d.ts +0 -3
  391. package/dist/i18n/locales/id.d.ts +0 -3
  392. package/dist/i18n/locales/it.d.ts +0 -3
  393. package/dist/i18n/locales/ja.d.ts +0 -3
  394. package/dist/i18n/locales/ko.d.ts +0 -3
  395. package/dist/i18n/locales/nb.d.ts +0 -3
  396. package/dist/i18n/locales/nl.d.ts +0 -3
  397. package/dist/i18n/locales/pl.d.ts +0 -3
  398. package/dist/i18n/locales/pt-BR.d.ts +0 -3
  399. package/dist/i18n/locales/ro.d.ts +0 -3
  400. package/dist/i18n/locales/ru.d.ts +0 -3
  401. package/dist/i18n/locales/sv.d.ts +0 -3
  402. package/dist/i18n/locales/th.d.ts +0 -3
  403. package/dist/i18n/locales/tr.d.ts +0 -3
  404. package/dist/i18n/locales/uk.d.ts +0 -3
  405. package/dist/i18n/locales/ur.d.ts +0 -3
  406. package/dist/i18n/locales/vi.d.ts +0 -3
  407. package/dist/i18n/locales/zh-Hans.d.ts +0 -3
  408. package/dist/i18n/locales/zh-Hant.d.ts +0 -3
  409. package/dist/i18n/merge.cjs.js +0 -1
  410. package/dist/i18n/merge.d.ts +0 -6
  411. package/dist/i18n/plural.cjs.js +0 -1
  412. package/dist/i18n/plural.d.ts +0 -45
  413. package/dist/i18n/types.d.ts +0 -1160
  414. package/dist/index.cjs.js +0 -1
  415. package/dist/index.d.ts +0 -83
  416. package/dist/locales/ar.cjs.js +0 -1
  417. package/dist/locales/ar.d.ts +0 -6
  418. package/dist/locales/bn.cjs.js +0 -1
  419. package/dist/locales/bn.d.ts +0 -6
  420. package/dist/locales/cs.cjs.js +0 -1
  421. package/dist/locales/cs.d.ts +0 -6
  422. package/dist/locales/da.cjs.js +0 -1
  423. package/dist/locales/da.d.ts +0 -6
  424. package/dist/locales/de.cjs.js +0 -1
  425. package/dist/locales/de.d.ts +0 -6
  426. package/dist/locales/el.cjs.js +0 -1
  427. package/dist/locales/el.d.ts +0 -6
  428. package/dist/locales/es.cjs.js +0 -1
  429. package/dist/locales/es.d.ts +0 -6
  430. package/dist/locales/fa.cjs.js +0 -1
  431. package/dist/locales/fa.d.ts +0 -6
  432. package/dist/locales/fi.cjs.js +0 -1
  433. package/dist/locales/fi.d.ts +0 -6
  434. package/dist/locales/fr.cjs.js +0 -1
  435. package/dist/locales/fr.d.ts +0 -6
  436. package/dist/locales/he.cjs.js +0 -1
  437. package/dist/locales/he.d.ts +0 -6
  438. package/dist/locales/hi.cjs.js +0 -1
  439. package/dist/locales/hi.d.ts +0 -6
  440. package/dist/locales/hu.cjs.js +0 -1
  441. package/dist/locales/hu.d.ts +0 -6
  442. package/dist/locales/id.cjs.js +0 -1
  443. package/dist/locales/id.d.ts +0 -6
  444. package/dist/locales/it.cjs.js +0 -1
  445. package/dist/locales/it.d.ts +0 -6
  446. package/dist/locales/ja.cjs.js +0 -1
  447. package/dist/locales/ja.d.ts +0 -6
  448. package/dist/locales/ko.cjs.js +0 -1
  449. package/dist/locales/ko.d.ts +0 -6
  450. package/dist/locales/nb.cjs.js +0 -1
  451. package/dist/locales/nb.d.ts +0 -6
  452. package/dist/locales/nl.cjs.js +0 -1
  453. package/dist/locales/nl.d.ts +0 -6
  454. package/dist/locales/pl.cjs.js +0 -1
  455. package/dist/locales/pl.d.ts +0 -6
  456. package/dist/locales/pt-BR.cjs.js +0 -1
  457. package/dist/locales/pt-BR.d.ts +0 -6
  458. package/dist/locales/ro.cjs.js +0 -1
  459. package/dist/locales/ro.d.ts +0 -6
  460. package/dist/locales/ru.cjs.js +0 -1
  461. package/dist/locales/ru.d.ts +0 -6
  462. package/dist/locales/sv.cjs.js +0 -1
  463. package/dist/locales/sv.d.ts +0 -6
  464. package/dist/locales/th.cjs.js +0 -1
  465. package/dist/locales/th.d.ts +0 -6
  466. package/dist/locales/tr.cjs.js +0 -1
  467. package/dist/locales/tr.d.ts +0 -6
  468. package/dist/locales/uk.cjs.js +0 -1
  469. package/dist/locales/uk.d.ts +0 -6
  470. package/dist/locales/ur.cjs.js +0 -1
  471. package/dist/locales/ur.d.ts +0 -6
  472. package/dist/locales/vi.cjs.js +0 -1
  473. package/dist/locales/vi.d.ts +0 -6
  474. package/dist/locales/zh-Hans.cjs.js +0 -1
  475. package/dist/locales/zh-Hans.d.ts +0 -6
  476. package/dist/locales/zh-Hant.cjs.js +0 -1
  477. package/dist/locales/zh-Hant.d.ts +0 -6
  478. package/dist/types/common.cjs.js +0 -1
  479. package/dist/types/common.d.ts +0 -31
  480. package/dist/types/style.d.ts +0 -7
  481. package/dist/utils/announce.cjs.js +0 -1
  482. package/dist/utils/announce.d.ts +0 -1
  483. package/dist/utils/brandPalette.cjs.js +0 -3
  484. package/dist/utils/brandPalette.d.ts +0 -146
  485. package/dist/utils/clipboard.cjs.js +0 -1
  486. package/dist/utils/clipboard.d.ts +0 -6
  487. package/dist/utils/cx.cjs.js +0 -1
  488. package/dist/utils/cx.d.ts +0 -2
  489. package/dist/utils/fillSlot.cjs.js +0 -1
  490. package/dist/utils/fillSlot.d.ts +0 -9
  491. package/dist/utils/flattenChildren.cjs.js +0 -1
  492. package/dist/utils/flattenChildren.d.ts +0 -8
  493. package/dist/utils/hotkeys.cjs.js +0 -1
  494. package/dist/utils/hotkeys.d.ts +0 -27
  495. package/dist/utils/index.d.ts +0 -11
  496. package/dist/utils/intl.cjs.js +0 -1
  497. package/dist/utils/intl.d.ts +0 -10
  498. package/dist/utils/refs.cjs.js +0 -1
  499. package/dist/utils/refs.d.ts +0 -15
  500. package/dist/utils/responsive.cjs.js +0 -1
  501. package/dist/utils/responsive.d.ts +0 -43
  502. package/dist/utils/slot.cjs.js +0 -1
  503. package/dist/utils/slot.d.ts +0 -11
  504. package/dist/utils/validators.cjs.js +0 -1
  505. package/dist/utils/validators.d.ts +0 -72
package/README.md CHANGED
@@ -1,864 +1,854 @@
1
- # vjdesigns-ui
2
-
3
- An accessible React component library from VJ Designs, built to meet WCAG 2.2 AA. It covers buttons, form controls, layout, navigation, overlays, feedback and data display, with light and dark modes and five brand palettes.
4
-
5
- 📚 **Live docs and Storybook:** [component.vjdesigns.org](https://component.vjdesigns.org)
6
- 📦 **npm:** [@vjdesigns/vjdesigns-ui](https://www.npmjs.com/package/@vjdesigns/vjdesigns-ui)
7
-
8
- ---
9
-
10
- ## Installation
11
-
12
- Install the package along with React and React DOM (version 18 or 19), which the components need in order to render:
13
-
14
- ```bash
15
- npm install @vjdesigns/vjdesigns-ui react react-dom
16
- ```
17
-
18
- If your project already uses React, you only need the first package:
19
-
20
- ```bash
21
- npm install @vjdesigns/vjdesigns-ui
22
- ```
23
-
24
- ### Import the styles
25
-
26
- The component styles and shared design tokens ship as a separate stylesheet. Import it **once** at your app's entry point, or the components will render unstyled.
27
-
28
- **React:** in `main.tsx` (or `App.tsx`)
29
-
30
- ```ts
31
- import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
32
- ```
33
-
34
- **Angular:** add it to the `styles` array in `angular.json`
35
-
36
- ```json
37
- "styles": [
38
- "node_modules/@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css",
39
- "src/styles.css"
40
- ]
41
- ```
42
-
43
- **Vue:** in `main.ts`
44
-
45
- ```ts
46
- import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
47
- ```
48
-
49
- ---
50
-
51
- ## Usage
52
-
53
- The components are built with React. You can use them directly in a React project. In Angular or Vue, you mount them inside a small wrapper component, as shown below.
54
-
55
- ### React
56
-
57
- ```tsx
58
- import { useState } from "react";
59
- import { Button, CheckBox } from "@vjdesigns/vjdesigns-ui";
60
-
61
- export function SignupForm() {
62
- const [accepted, setAccepted] = useState(false);
63
-
64
- return (
65
- <form>
66
- <CheckBox
67
- label="Accept terms"
68
- checked={accepted}
69
- onCheckedChange={setAccepted}
70
- />
71
- <Button
72
- variant="solid"
73
- tone="primary"
74
- size="md"
75
- disabled={!accepted}
76
- onClick={() => console.log("Submitted")}
77
- >
78
- Submit
79
- </Button>
80
- </form>
81
- );
82
- }
83
- ```
84
-
85
- ### Next.js (App Router) and React Server Components
86
-
87
- The library works in Server Components. Interactive components (anything with state, effects, or context: `Button`, `DataGrid`, `Modal`, ...) are marked `"use client"`, so you can render them from a Server Component like any client component. Utilities (`cx`, `sortRows`, `createBrandPalette`, `getLocaleDirection`, ...) and the locale catalogs have no directive, so you can call or read them on the server too. Every component also renders on the server for the first paint.
88
-
89
- Put the providers in a small client file of your own, and render it from the root layout:
90
-
91
- ```tsx
92
- // app/providers.tsx
93
- "use client";
94
- import { LocaleProvider, ToastProvider } from "@vjdesigns/vjdesigns-ui";
95
- import es from "@vjdesigns/vjdesigns-ui/locales/es";
96
- import type { ReactNode } from "react";
97
-
98
- export function Providers({ children }: { children: ReactNode }) {
99
- return (
100
- <LocaleProvider locale="es" messages={es}>
101
- <ToastProvider>{children}</ToastProvider>
102
- </LocaleProvider>
103
- );
104
- }
105
- ```
106
-
107
- ```tsx
108
- // app/layout.tsx (a Server Component)
109
- import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
110
- import { getLocaleDirection } from "@vjdesigns/vjdesigns-ui";
111
- import { Providers } from "./providers";
112
-
113
- export default function RootLayout({ children }: { children: React.ReactNode }) {
114
- return (
115
- <html lang="es" dir={getLocaleDirection("es")}>
116
- <body>
117
- <Providers>{children}</Providers>
118
- </body>
119
- </html>
120
- );
121
- }
122
- ```
123
-
124
- Two rules of Server Components to keep in mind:
125
-
126
- - **Functions can't be passed from a Server Component to a client one.** That includes event handlers (`onClick`), DataGrid columns with `cell` or `value` functions, and the locale catalogs themselves (their plural messages are functions, which is why `LocaleProvider` goes in the client providers file above). Render those components from your own `"use client"` file.
127
- - **Compound parts can't be reached with a dot from a Server Component** (`Tabs.List`, `Menu.Item`): Next.js reports "You cannot dot into a client module". Use them inside a `"use client"` file, or use the named exports where they exist (`CardHeader`, `CardBody`, `NavbarBrand`, ...).
128
-
129
- ### Angular
130
-
131
- Make a standalone wrapper that renders the React component into its host element. The wrapper uses `createElement`, so you don't need to change your JSX or TSX settings.
132
-
133
- ```ts
134
- // vj-button.component.ts
135
- import {
136
- AfterViewInit,
137
- Component,
138
- ElementRef,
139
- EventEmitter,
140
- Input,
141
- OnChanges,
142
- OnDestroy,
143
- Output,
144
- ViewChild,
145
- } from "@angular/core";
146
- import { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from "react";
147
- import { createRoot, Root } from "react-dom/client";
148
- import {
149
- Button,
150
- type ButtonProps,
151
- type ButtonVariant,
152
- type Size,
153
- type Tone,
154
- } from "@vjdesigns/vjdesigns-ui";
155
-
156
- // Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.
157
- const ReactButton = Button as (props: ButtonProps) => ReactElement;
158
-
159
- @Component({
160
- selector: "vj-button",
161
- standalone: true,
162
- template: `<span #host></span>`,
163
- })
164
- export class VjButtonComponent implements AfterViewInit, OnChanges, OnDestroy {
165
- @ViewChild("host", { static: true }) host!: ElementRef<HTMLElement>;
166
-
167
- @Input() label = "";
168
- @Input() variant: ButtonVariant = "solid";
169
- @Input() tone: Tone = "primary";
170
- @Input() size: Size = "md";
171
- @Input() disabled = false;
172
- @Output() clicked = new EventEmitter<MouseEvent>();
173
-
174
- private root?: Root;
175
-
176
- ngAfterViewInit() {
177
- this.root = createRoot(this.host.nativeElement);
178
- this.render();
179
- }
180
-
181
- ngOnChanges() {
182
- this.render();
183
- }
184
-
185
- ngOnDestroy() {
186
- this.root?.unmount();
187
- }
188
-
189
- private render() {
190
- this.root?.render(
191
- createElement(
192
- ReactButton,
193
- {
194
- variant: this.variant,
195
- tone: this.tone,
196
- size: this.size,
197
- disabled: this.disabled,
198
- onClick: (event: ReactMouseEvent) => this.clicked.emit(event.nativeEvent),
199
- },
200
- this.label // the button's text is passed as children
201
- )
202
- );
203
- }
204
- }
205
- ```
206
-
207
- Import the wrapper wherever you need it:
208
-
209
- ```ts
210
- // app.component.ts
211
- import { Component } from "@angular/core";
212
- import { VjButtonComponent } from "./vj-button.component";
213
-
214
- @Component({
215
- selector: "app-root",
216
- standalone: true,
217
- imports: [VjButtonComponent],
218
- template: `<vj-button label="Submit" tone="primary" (clicked)="onSubmit()" />`,
219
- })
220
- export class AppComponent {
221
- onSubmit() {
222
- console.log("Submitted");
223
- }
224
- }
225
- ```
226
-
227
- ### Vue 3
228
-
229
- Make a wrapper component that mounts the React component when it loads and re-renders it whenever its props change.
230
-
231
- ```vue
232
- <!-- VjButton.vue -->
233
- <script setup lang="ts">
234
- import { onBeforeUnmount, onMounted, ref, watch } from "vue";
235
- import { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from "react";
236
- import { createRoot, type Root } from "react-dom/client";
237
- import {
238
- Button,
239
- type ButtonProps,
240
- type ButtonVariant,
241
- type Size,
242
- type Tone,
243
- } from "@vjdesigns/vjdesigns-ui";
244
-
245
- // Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.
246
- const ReactButton = Button as (props: ButtonProps) => ReactElement;
247
-
248
- const props = withDefaults(
249
- defineProps<{
250
- label: string;
251
- variant?: ButtonVariant;
252
- tone?: Tone;
253
- size?: Size;
254
- disabled?: boolean;
255
- }>(),
256
- { variant: "solid", tone: "primary", size: "md", disabled: false }
257
- );
258
-
259
- const emit = defineEmits<{ click: [event: MouseEvent] }>();
260
-
261
- const host = ref<HTMLElement | null>(null);
262
- let root: Root | undefined;
263
-
264
- function render() {
265
- root?.render(
266
- createElement(
267
- ReactButton,
268
- {
269
- variant: props.variant,
270
- tone: props.tone,
271
- size: props.size,
272
- disabled: props.disabled,
273
- onClick: (event: ReactMouseEvent) => emit("click", event.nativeEvent),
274
- },
275
- props.label // the button's text is passed as children
276
- )
277
- );
278
- }
279
-
280
- onMounted(() => {
281
- root = createRoot(host.value!);
282
- render();
283
- });
284
-
285
- watch(() => ({ ...props }), render);
286
-
287
- onBeforeUnmount(() => root?.unmount());
288
- </script>
289
-
290
- <template>
291
- <span ref="host" />
292
- </template>
293
- ```
294
-
295
- Use it like any other Vue component:
296
-
297
- ```vue
298
- <script setup lang="ts">
299
- import VjButton from "./VjButton.vue";
300
-
301
- const onSubmit = () => console.log("Submitted");
302
- </script>
303
-
304
- <template>
305
- <VjButton label="Submit" tone="primary" @click="onSubmit" />
306
- </template>
307
- ```
308
-
309
- > **Tip:** Wrap `CheckBox` and any other component the same way. Pass its props into `createElement`, and send its callbacks back out as Angular outputs or Vue emits. For `CheckBox`, that means sending `onCheckedChange` back out.
310
-
311
- ---
312
-
313
- ## Theming
314
-
315
- Wrap any part of your app in `Theme` to set the color mode, brand palette, and accent for everything inside it:
316
-
317
- ```tsx
318
- import { Theme, Button } from "@vjdesigns/vjdesigns-ui";
319
-
320
- <Theme mode="dark" brand="purple" fill>
321
- <Button>Dark, purple button</Button>
322
- </Theme>
323
- ```
324
-
325
- | Prop | Type | Default | Description |
326
- | --- | --- | --- | --- |
327
- | `mode` | `"light" \| "dark"` | inherited | Color mode for everything inside. |
328
- | `brand` | `"black" \| "blue" \| "gold" \| "green" \| "purple"`, a hex color, or `{ light, dark }` | inherited | Brand palette for buttons, links, focus rings and indicators. |
329
- | `accent` | `"brand" | "lime"`, a hex color, or `{ light, dark }` | inherited (the brand's own) | The bright highlight on badges, switches, progress bars, sliders, steppers, and active navigation. |
330
- | `fill` | `boolean` | `false` | Paints the theme's background and text color on the wrapper. |
331
-
332
- Outside React (or to theme the whole page), set the attributes on `<html>` instead:
333
-
334
- ```html
335
- <html data-theme="dark" data-brand="purple" data-accent="lime">
336
- ```
337
-
338
- ### Accent color
339
-
340
- The accent is the energetic highlight: badges, switches, progress bars, sliders, steppers, and the active link in the Navbar. By default it follows the brand, as a bright shade of the brand's own color, so it always fits:
341
-
342
- | Brand | Default accent |
343
- | --- | --- |
344
- | `blue` (default) | sky blue `#76c7ff` |
345
- | `purple` | lavender `#c0b0ff` |
346
- | `gold` | amber `#f5ad5f` |
347
- | `green` | mint `#72d4ad` |
348
- | `black` | lime `#c8f031` (black has no hue to build on) |
349
- | a custom hex | generated from that color |
350
-
351
- To choose a different one:
352
-
353
- ```tsx
354
- <Theme accent="lime">…</Theme> // the original bright yellow-green ("volt", its former name, still works)
355
- <Theme accent="#ff6b00">…</Theme> // any color
356
- <Theme accent="brand">…</Theme> // back to the brand's own, inside an area with another accent
357
- ```
358
-
359
- Accents always carry dark text. A color too dark for that is lightened (same hue) just enough to meet WCAG AA, with a warning in development. An accent you set also holds inside nested brands. In CSS, `accentCss("name", "#ff6b00")` generates a `[data-accent="name"]` rule, like `brandCss` below.
360
-
361
- ### Custom brand colors
362
-
363
- Pass any hex color as `brand` and a full palette is generated for both modes:
364
-
365
- ```tsx
366
- <Theme brand="#e11d48">…</Theme>
367
- <Theme brand={{ light: "#4338ca", dark: "#f472b6" }}>…</Theme>
368
- ```
369
-
370
- Every generated palette meets WCAG 2.2 AA. A single color is used exactly as given in the mode where it has enough contrast (dark colors in light mode, light colors in dark mode), and the other mode gets a matching shade of the same hue. If a color doesn't have enough contrast (for example, a mid-tone that fails in both modes), its lightness is shifted just enough to pass, and a warning is logged in development.
371
-
372
- To define a brand in CSS instead (for the whole page, applied before any JavaScript runs), generate a stylesheet rule with `brandCss`:
373
-
374
- ```ts
375
- import { brandCss } from "@vjdesigns/vjdesigns-ui";
376
-
377
- brandCss("acme", "#e11d48"); // '[data-brand="acme"] { --brand-light-primary: … }'
378
- ```
379
-
380
- Add the rule to your stylesheet and use `<html data-brand="acme">`. `createBrandPalette(color)` returns the generated colors as an object, if you need them directly.
381
-
382
- ### Tailwind CSS
383
-
384
- A Tailwind CSS v4 preset turns the design tokens into utilities, so your own layouts match the components. Import it after Tailwind in your CSS, and keep importing the library's stylesheet as usual:
385
-
386
- ```css
387
- @import "tailwindcss";
388
- @import "@vjdesigns/vjdesigns-ui/tailwind.css";
389
- ```
390
-
391
- ```tsx
392
- <section className="bg-surface text-text rounded-xl shadow-md p-6">
393
- <h2 className="font-display text-2xl tracking-tight">Season stats</h2>
394
- <p className="text-text-muted">Updated after every game.</p>
395
- <span className="bg-accent text-on-accent rounded-control px-3">New</span>
396
- </section>
397
- ```
398
-
399
- Every utility points at a token (`bg-primary` is `var(--color-primary)`), so Tailwind classes follow `Theme`, `data-theme`, `data-brand`, and `data-accent` exactly like the components, with no `dark:` variants needed.
400
-
401
- | Group | Utilities |
402
- | --- | --- |
403
- | Colors | `bg-`, `text-`, `border-`, `ring-`, … with `bg`, `surface` (`-raised`, `-sunken`, `-hover`, `-active`), `overlay`, `text` (`-muted`, `-disabled`, `-inverse`), `border` (`-strong`, `-input`), `focus-ring`, `link-visited`; and for `primary`, `accent`, `success`, `warning`, `danger`, `info`, `neutral`: the solid color, `-hover`, `-active`, `on-…` (text on the solid), `-subtle`, `-subtle-hover`, `-subtle-text`, `-border`. Opacity modifiers work (`bg-primary/50`). |
404
- | Charts | `bg-chart-1` to `bg-chart-8`, for fills only, in that order. Slots 3 to 5 are under 3:1 on white, so pair them with a legend, labels, or a data table. |
405
- | Type | `font-display` (headings, buttons, labels, numbers), `font-body`, `font-mono`; `text-xs` to `text-6xl` (plus `text-md`); `font-regular` to `font-black`; `leading-tight`, `-snug`, `-normal`, `-relaxed`; `tracking-tight`, `-normal`, `-wide`, `-caps` |
406
- | Shape | `rounded-control` (pill controls), `rounded-field` (text fields), `rounded-xs` to `rounded-2xl`, `rounded-pill` |
407
- | Depth | `shadow-xs` to `shadow-xl`, `blur-sm`, `blur-lg` |
408
- | Motion | `ease-spring` (enter and press), `ease-standard`, `ease-in`, `ease-out`; `duration-instant`, `-fast`, `-normal`, `-slow` (0ms under reduced motion) |
409
- | Sizes | `h-control-sm`, `-md`, `-lg` (and `w-`, `min-h-`, …), `size-target` (the 24px minimum pointer target), `max-w-xs` to `max-w-2xl` and `@xs:` to `@2xl:` container queries |
410
- | Layers | `z-sticky`, `z-overlay`, `z-modal`, `z-popover`, `z-dropdown`, `z-toast`, `z-tooltip` |
411
- | Dark mode | `dark:` follows `data-theme="dark"`, not the OS setting. |
412
-
413
- Tailwind's numeric spacing (`p-4` = 1rem) already matches the 4px token scale, and the breakpoints (`sm:` to `2xl:`) are the same as Tailwind's.
414
-
415
- Some Tailwind names change meaning with the preset: `rounded-*`, `shadow-*`, `blur-sm`/`-lg`, `ease-in`/`-out`, `font-mono`, `font-medium` to `font-black`, `leading-*`, and the `text-*` sizes take the library's values (for example, `rounded-md` is 12px and `font-black` is 800). So do the containers: `max-w-md` and `@md:` are 48rem, not Tailwind's 28rem. The library's stylesheet already gives some of these names its own values once it's loaded, even without the preset; the preset keeps the utilities and the container queries consistent.
416
-
417
- For text contrast, use the pairs the components use: `text-text` or `text-text-muted` on `bg-bg`, `bg-surface`, and the other surfaces; `text-on-primary` on `bg-primary` (likewise `on-accent`, `on-success`, …); `text-primary-subtle-text` on `bg-primary-subtle` (likewise for each tone). These pairs meet WCAG 2.2 AA in both themes and every brand. Don't use accent or chart colors for text.
418
-
419
- The preset doesn't change the components, and Tailwind's preflight (its CSS reset) doesn't override them, whichever stylesheet loads first.
420
-
421
- ---
422
-
423
- ## Languages
424
-
425
- Components have built-in text: button names like "Close" and "Next page", screen-reader announcements like "3 results available", validation messages, and date formats. Wrap your app in `LocaleProvider` to show all of it in another language:
426
-
427
- ```tsx
428
- import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
429
- import es from "@vjdesigns/vjdesigns-ui/locales/es";
430
-
431
- <LocaleProvider locale="es" messages={es}>
432
- <App />
433
- </LocaleProvider>
434
- ```
435
-
436
- `LocaleProvider` sets:
437
-
438
- - **Built-in text** for every component, from `messages`.
439
- - **Dates and numbers** in the locale's format (`23/10/2026`, `1.234,5`), and plurals that follow the language's rules.
440
- - **Writing direction**: Arabic, Hebrew, Persian, and Urdu get `dir="rtl"`, and layouts and arrow keys mirror.
441
- - **`lang`** on its wrapper, so screen readers pronounce the text correctly. Popups (menus, dialogs, tooltips) keep the language of the area that opened them.
442
-
443
- Each locale is a separate import, so your app only downloads the languages it uses. Without a `LocaleProvider`, components use English text and the browser's date and number format.
444
-
445
- This library only translates its own built-in text. Text your app passes in, like `<Button>Save</Button>`, is your app's content: translate it with your app's i18n library (react-i18next, FormatJS, and so on).
446
-
447
- ### What gets translated
448
-
449
- The language is never picked automatically from where the user lives or their browser settings. Your app chooses it by rendering a `LocaleProvider`. For example, with `<LocaleProvider locale="de" messages={de}>`:
450
-
451
- | | Translated? |
452
- | --- | --- |
453
- | Text your app passes in, like `<Button>Save</Button>` | No: your app translates it |
454
- | Built-in names, like "Close", "Next page", "Clear search" | Yes: "Schließen", "Nächste Seite", "Suche löschen" |
455
- | Screen-reader announcements, like "3 results available" | Yes: "3 Ergebnisse verfügbar" |
456
- | Validation messages, empty states, file-upload prompts | Yes |
457
- | Dates and numbers | Yes: "23.10.2026", "4,5" |
458
-
459
- To follow the user's browser language, pass it yourself: `locale={navigator.language}` together with the matching `messages` (see [Switching language at runtime](#switching-language-at-runtime)).
460
-
461
- ### Bundled languages
462
-
463
- `ar` Arabic · `bn` Bengali · `cs` Czech · `da` Danish · `de` German · `el` Greek · `es` Spanish · `fa` Persian · `fi` Finnish · `fr` French · `he` Hebrew · `hi` Hindi · `hu` Hungarian · `id` Indonesian · `it` Italian · `ja` Japanese · `ko` Korean · `nb` Norwegian Bokmål · `nl` Dutch · `pl` Polish · `pt-BR` Portuguese (Brazil) · `ro` Romanian · `ru` Russian · `sv` Swedish · `th` Thai · `tr` Turkish · `uk` Ukrainian · `ur` Urdu · `vi` Vietnamese · `zh-Hans` Chinese (Simplified) · `zh-Hant` Chinese (Traditional), plus English (the default).
464
-
465
- The translations are machine-generated and haven't been reviewed by native speakers yet. If you find a wrong or awkward phrase, override it (below) and report it so the bundled locale can be fixed. (Working on the library itself? See [Translating built-in text](#translating-built-in-text).)
466
-
467
- ### Changing a few strings
468
-
469
- Pass only the strings you want to change. Everything else falls back to the outer provider's language (English at the top):
470
-
471
- ```tsx
472
- <LocaleProvider locale="en-GB" messages={{ pagination: { next: "Onwards" } }}>
473
- ```
474
-
475
- Providers nest, so an inner provider can switch the language for one part of the page. Per-component props such as `clearLabel` or `labels` still win over the provider.
476
-
477
- ### Other languages
478
-
479
- For a language that isn't bundled, write a complete messages object. TypeScript flags any missing string. Use English as the template:
480
-
481
- ```ts
482
- import { en, plural, type Messages } from "@vjdesigns/vjdesigns-ui";
483
-
484
- const p = plural("sw");
485
- export const sw: Messages = {
486
- ...en,
487
- pagination: { ...en.pagination, next: "Ukurasa unaofuata", previous: "Ukurasa uliopita" },
488
- searchInput: {
489
- ...en.searchInput,
490
- results: (count) => p(count, { "=0": "Hakuna matokeo", one: "Tokeo #", other: "Matokeo #" }),
491
- },
492
- // ...
493
- };
494
- ```
495
-
496
- `plural(locale)` picks the right plural form for any language (`#` is the formatted number).
497
-
498
- ### Switching language at runtime
499
-
500
- List the languages your app offers as loaders, so each one is downloaded only when picked:
501
-
502
- ```tsx
503
- import { LocaleProvider, type Messages } from "@vjdesigns/vjdesigns-ui";
504
-
505
- const loaders: Record<string, () => Promise<{ default: Messages }>> = {
506
- es: () => import("@vjdesigns/vjdesigns-ui/locales/es"),
507
- fr: () => import("@vjdesigns/vjdesigns-ui/locales/fr"),
508
- ar: () => import("@vjdesigns/vjdesigns-ui/locales/ar"),
509
- };
510
-
511
- function App({ lang }: { lang: string }) {
512
- const [messages, setMessages] = useState<Messages>();
513
- useEffect(() => {
514
- const load = loaders[lang];
515
- if (load) load().then((mod) => setMessages(mod.default));
516
- else setMessages(undefined); // English
517
- }, [lang]);
518
- // Until a language loads, the previous one (or English) shows.
519
- return <LocaleProvider locale={lang} messages={messages}>…</LocaleProvider>;
520
- }
521
- ```
522
-
523
- For server rendering, also set `<html lang="…" dir="…">` on the page. `getLocaleDirection(locale)` returns `"ltr"` or `"rtl"`.
524
-
525
- ---
526
-
527
- ## Form validation
528
-
529
- > **Front-end validation is not security.** It helps people fill in a form correctly, but anyone can turn off JavaScript or send requests straight to your server. Always validate again on the server. The format checks below (`isEmail`, `isIP`, …) are plain functions you can reuse there.
530
-
531
- `useFormValidation` checks a form when it's submitted, using the browser's own rules on each input (`required`, `type="email"`, `minLength`, `pattern`, `min` / `max`) plus any rules you add. Messages follow the current language.
532
-
533
- ```tsx
534
- import {
535
- useFormValidation, rules, ErrorSummary, Field, Input, PasswordInput, Button,
536
- } from "@vjdesigns/vjdesigns-ui";
537
-
538
- function SignUp() {
539
- const form = useFormValidation({
540
- rules: {
541
- confirm: rules.matches("password", "The passwords don't match."),
542
- serverIp: rules.ip(), // IPv4 or IPv6
543
- },
544
- // Runs only when everything is valid. Return the server's errors to show them on their fields.
545
- onValid: async (values) => {
546
- const response = await api.signUp(values);
547
- return response.errors; // e.g. { username: "That username is taken." }
548
- },
549
- });
550
-
551
- return (
552
- <form {...form.formProps}>
553
- <ErrorSummary ref={form.summaryRef} errors={form.errorList} />
554
- <Field label="Email" required error={form.errors.email}>
555
- <Input name="email" type="email" />
556
- </Field>
557
- <Field label="Password" required error={form.errors.password}>
558
- <PasswordInput name="password" minLength={12} />
559
- </Field>
560
- <Field label="Confirm password" required error={form.errors.confirm}>
561
- <PasswordInput name="confirm" />
562
- </Field>
563
- <Field label="Server IP" error={form.errors.serverIp}>
564
- <Input name="serverIp" />
565
- </Field>
566
- <Button type="submit" loading={form.isSubmitting}>Create account</Button>
567
- </form>
568
- );
569
- }
570
- ```
571
-
572
- How it behaves:
573
-
574
- - **On submit**, every field is checked. If anything is wrong, the `ErrorSummary` at the top lists the problems and takes focus, so screen readers announce it. Each item links to its field. Without a summary, focus goes to the first invalid field.
575
- - **Errors are keyed by the field's `name`.** Pass `form.errors.<name>` to each `Field`'s `error`.
576
- - **After a failed submit**, an error disappears as soon as the field is fixed (while typing), and a field is fully re-checked when you leave it. It doesn't nag while you're still typing.
577
- - **Server errors** (returned from `onValid`, or set with `form.setErrors({...})`) show on their fields and stay until that field is edited.
578
- - **Emails** must have a real domain (`name@example.com`). The browser's own check also accepts `name@localhost`.
579
-
580
- ### Rules and format checks
581
-
582
- | Rule | Checks |
583
- | --- | --- |
584
- | `rules.required()` | Not empty (for controls without a native `required`) |
585
- | `rules.email()` | An email address in the usual format, with a top-level domain |
586
- | `rules.ip()` / `rules.ip({ version: 4 })` / `rules.ip({ version: 6 })` | An IPv4 or IPv6 address |
587
- | `rules.minLength(n)` / `rules.maxLength(n)` | Length in characters |
588
- | `rules.pattern(/regex/, "message")` | The whole value matches |
589
- | `rules.matches("otherField")` | Equals another field (confirm password) |
590
- | your own `(value, { values }) => message` | Anything else |
591
-
592
- Each rule takes an optional custom message. The checks behind them are exported for use anywhere, including your server:
593
-
594
- - `isEmail(value)`
595
- - `isIPv4(value)`: four numbers 0–255, no leading zeros
596
- - `isIPv6(value)`: including `::` shorthand and IPv4 tails like `::ffff:192.168.0.1`
597
- - `isIP(value, version?)`
598
-
599
- ---
600
-
601
- ## Hooks
602
-
603
- Tested hooks for everyday UI work, exported from the package root (`import { useDisclosure } from "@vjdesigns/vjdesigns-ui"`). All are safe in server rendering and tree-shakable: each costs only itself, mostly well under 1 KB. Live demos are in Storybook under Hooks.
604
-
605
- | Hook | What it does |
606
- | --- | --- |
607
- | `useDisclosure(initial?)` | Open/closed state with stable `open`, `close`, `toggle` handlers (for Modal, Drawer, Popover) |
608
- | `useToggle(values?)` | Cycles through values: a boolean, or a list like `["list", "grid"]` |
609
- | `usePrevious(value)` | The value from before its last change |
610
- | `useDebouncedValue(value, ms)` | The value, updated after it stops changing (search as you type) |
611
- | `useDebouncedCallback(fn, ms)` | A function that runs once after calls stop, with `cancel` and `flush` |
612
- | `useThrottledCallback(fn, ms)` | A function that runs at most once per interval (scroll, resize) |
613
- | `useInterval(fn, ms \| null)` / `useTimeout(fn, ms \| null)` | Timers that always call the latest function; `null` pauses |
614
- | `useLocalStorage(key, default)` / `useSessionStorage` | State saved in storage, synced across components and tabs, and never throws when storage is blocked |
615
- | `useClipboard()` | `copy(text)` with a `copied` flag, and a fallback when the Clipboard API is blocked |
616
- | `useHotkeys([[keys, fn]])` | Page shortcuts. `mod` is ⌘ or Ctrl. Plain keys don't fire while typing. `getHotkeyHandler` does the same for one element |
617
- | `useEventListener(type, fn, target?)` | An event listener that always calls the latest handler |
618
- | `useClickOutside(fn)` | Calls `fn` on a press or focus move outside the element |
619
- | `useIntersection(options)` | Whether an element is in view (lazy loading, entrance effects) |
620
- | `useElementSize()` | An element's size as it resizes |
621
- | `useVirtualizer(options)` | Renders only the visible items of a long list (what `VirtualList` uses), with variable heights and `scrollToIndex` |
622
- | `useMediaQuery(query)` / `useResponsiveValue(value)` | A synced media query, or a responsive value resolved for the viewport |
623
- | `useHydrated()` | False during server rendering, true after (avoids hydration mismatches) |
624
- | `useReducedMotion()` / `useColorScheme()` | The user's motion and color-scheme preferences |
625
- | `useOnline()` / `useDocumentVisibility()` / `useViewportSize()` | Connection, tab visibility, and viewport size |
626
- | `useControllableState`, `useFormValidation`, `useFocusTrap`, `useScrollLock`, … | The building blocks the components use, for your own components |
627
-
628
- ---
629
-
630
- ## AI assistants
631
-
632
- The package ships documentation written for AI coding assistants, generated from the source on every build, so it always matches the version you have installed:
633
-
634
- | File | What it is |
635
- | --- | --- |
636
- | `@vjdesigns/vjdesigns-ui/llms.txt` | A short index in the [llms.txt](https://llmstxt.org) format: setup essentials and one line per component |
637
- | `@vjdesigns/vjdesigns-ui/llms-full.txt` | The full reference in one file: guides, and every component's props (type, default, description), subcomponents, and examples |
638
- | `@vjdesigns/vjdesigns-ui/registry.json` | The same, as structured JSON |
639
-
640
- The files are in `node_modules/@vjdesigns/vjdesigns-ui/dist/ai/`. Point your assistant's rules or context at `llms-full.txt`.
641
-
642
- ### MCP server
643
-
644
- For assistants that support the [Model Context Protocol](https://modelcontextprotocol.io), the package includes a small MCP server with four tools:
645
-
646
- - `list_components`
647
- - `get_component`, for exact props
648
- - `search_docs`
649
- - `get_guide`
650
-
651
- It reads the docs of your installed version and needs no network access.
652
-
653
- Claude Code:
654
-
655
- ```bash
656
- claude mcp add vjdesigns-ui -- npx -p @vjdesigns/vjdesigns-ui vjdesigns-ui-mcp
657
- ```
658
-
659
- Cursor (`.cursor/mcp.json`), Claude Desktop, and other clients (VS Code's `.vscode/mcp.json` uses `"servers"` instead of `"mcpServers"`):
660
-
661
- ```json
662
- {
663
- "mcpServers": {
664
- "vjdesigns-ui": {
665
- "command": "npx",
666
- "args": ["-p", "@vjdesigns/vjdesigns-ui", "vjdesigns-ui-mcp"]
667
- }
668
- }
669
- }
670
- ```
671
-
672
- ---
673
-
674
- ## Components
675
-
676
- Every component below is exported from the package root. Full prop docs and live examples are in [Storybook](https://component.vjdesigns.org).
677
-
678
- | Category | Components |
679
- | --- | --- |
680
- | **Primitives** | Button, IconButton, ButtonGroup, Icon, Kbd, Typography |
681
- | **Layout** | Box, Container, Divider, Flex, Grid, ResizablePanels, ScrollArea, Stack |
682
- | **Forms** | CheckBox, CheckBoxGroup, ColorPicker, Combobox, DatePicker, DateRangePicker, DateTimePicker, Field, FileUpload, Input, NumberInput, PasswordInput, PinInput, Radio, Rating, SearchInput, SegmentedControl, Select, Slider, Switch, TagInput, Textarea, TimePicker, ToggleGroup |
683
- | **Navigation** | Breadcrumbs, ContextMenu, Link, Menu, Navbar, Pagination, Sidebar, SkipLink, Stepper, Tabs |
684
- | **Overlays** | CommandPalette, Drawer, HoverCard, Modal, Popover, Tooltip |
685
- | **Feedback** | Alert, Banner, ErrorSummary, Progress, Skeleton, Spinner, Toast |
686
- | **Data display** | Accordion, Avatar, Badge, Card, Carousel, Chat, Chip, CodeBlock, DataGrid, EmptyState, Image, List, Stat, Table, Timeline, TreeView, VirtualList |
687
- | **Utilities** | Portal, Theme, VisuallyHidden |
688
-
689
- ### Button
690
-
691
- ```tsx
692
- <Button variant="solid" tone="primary">Save</Button>
693
- <Button variant="outline" tone="danger" startIcon={<TrashIcon />}>Delete</Button>
694
- <Button href="/pricing" variant="link">See pricing</Button>
695
- <Button loading loadingText="Saving…">Save</Button>
696
- ```
697
-
698
- | Prop | Type | Default | Description |
699
- | --- | --- | --- | --- |
700
- | `children` | `ReactNode` | — | The visible label. |
701
- | `variant` | `"solid" \| "soft" \| "outline" \| "ghost" \| "link" \| "inverse"` | `"solid"` | Visual style. |
702
- | `tone` | `"neutral" \| "primary" \| "accent" \| "success" \| "warning" \| "danger" \| "info"` | `"primary"` | Semantic color. |
703
- | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding and type size. |
704
- | `radius` | `"none" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "pill"` | `"pill"` | Corner rounding. |
705
- | `startIcon` / `endIcon` | `ReactNode` | — | Decorative icon before or after the label. Hidden from screen readers. |
706
- | `loading` | `boolean` | `false` | Shows a spinner, sets `aria-busy` and ignores clicks. |
707
- | `loadingText` | `ReactNode` | — | Label shown next to the spinner while loading. |
708
- | `fullWidth` | `boolean` | `false` | Stretches the button to fill its container. |
709
- | `compact` | `boolean` | `false` | Tighter side padding for short labels like "OK". |
710
- | `disabled` | `boolean` | `false` | Disables the button. |
711
- | `href` | `string` | — | Renders the button as an `<a>` link with the same styling. |
712
- | `as` | `ElementType` | — | Renders as your own component, such as a React Router or Next.js `Link`. |
713
-
714
- Also accepts all standard `<button>` attributes (or `<a>` attributes when `href` is set), such as `onClick` and `type`.
715
-
716
- For icon-only buttons, use `IconButton`. `aria-label` is required:
717
-
718
- ```tsx
719
- <IconButton aria-label="Close" variant="ghost"><CloseIcon /></IconButton>
720
- ```
721
-
722
- To group related buttons, use `ButtonGroup`. It passes `variant`, `tone`, `size`, `radius` and `disabled` down to every button inside.
723
-
724
- ### CheckBox
725
-
726
- ```tsx
727
- <CheckBox label="Email me updates" description="About once a month." />
728
- <CheckBox label="Remember me" labelPosition="start" defaultChecked />
729
- ```
730
-
731
- | Prop | Type | Default | Description |
732
- | --- | --- | --- | --- |
733
- | `label` | `ReactNode` | — | Visible label. Clicking it toggles the box. Without it, pass `aria-label`. |
734
- | `description` | `ReactNode` | — | Supporting text below the label, linked with `aria-describedby`. |
735
- | `checked` | `boolean` | — | Checked state (controlled). |
736
- | `defaultChecked` | `boolean` | — | Initial checked state (uncontrolled). |
737
- | `onCheckedChange` | `(checked: boolean) => void` | — | Called with the new state when the user toggles the box. |
738
- | `indeterminate` | `boolean` | `false` | Shows a "mixed" dash, for a "select all" box whose options are partly checked. |
739
- | `labelPosition` | `"start" \| "end"` | `"end"` | Puts the label before (`start`) or after (`end`) the box. |
740
- | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Box and text size. |
741
- | `tone` | `Tone` | `"primary"` | Fill color when checked. |
742
- | `invalid` | `boolean` | `false` | Danger styling plus `aria-invalid`. |
743
- | `readOnly` | `boolean` | `false` | Keeps the box focusable but prevents toggling. |
744
-
745
- Also accepts native `<input type="checkbox">` attributes, such as `name`, `required` and `disabled`.
746
-
747
- To manage several options as one `string[]` value, use `CheckBoxGroup`:
748
-
749
- ```tsx
750
- <CheckBoxGroup label="Toppings" defaultValue={["cheese"]} onValueChange={setToppings}>
751
- <CheckBox value="cheese" label="Cheese" />
752
- <CheckBox value="peppers" label="Peppers" />
753
- </CheckBoxGroup>
754
- ```
755
-
756
- ---
757
-
758
- ## Pro
759
-
760
- Everything above is free. `@vjdesigns-pro/ui` is a commercial add-on for teams that need more from their data grids:
761
-
762
- - **DataGridPro:** everything `DataGrid` does, plus resizable columns (pointer and keyboard), saved column layouts, and columns pinned to either edge.
763
- - **CSV export:** export exactly what a grid shows, safe to open in a spreadsheet.
764
- - **Charts:** accessible `BarChart` and `LineChart`: keyboard-navigable points with spoken values, a data table view, color-blind-safe series colors, and High Contrast support.
765
- - **Account forms:** ready-made sign-in, sign-up, forgot-password, reset-password, and verification-code forms that you connect to your own backend, with validation, autofill, passkey support, and safe error messages built in.
766
- - **Figma kit:** a plugin that creates the library's variables (brands, light and dark themes, spacing, type) and shadow styles in Figma, generated from the same tokens as the code, plus W3C design token files.
767
-
768
- It uses the same tokens, themes, languages, and accessibility standard as the free package.
769
-
770
- ---
771
-
772
- ## Development
773
-
774
- ```bash
775
- npm run storybook # run Storybook locally at http://localhost:6006
776
- npm run build # type-check and build the library to dist/
777
- npm run build-storybook # build a static Storybook site
778
- ```
779
-
780
- Components live under `src/components/<category>/<Name>/`, with each component's implementation, CSS module and Storybook stories kept together. Shared design tokens live in `src/styles/tokens.css`. The build bundles all styles into `dist/vjdesigns-ui.css`.
781
-
782
- ### Translating built-in text
783
-
784
- You write each built-in message once, in English, and a script translates it into every bundled language with the Claude API.
785
-
786
- **1. Edit the English.** Add, reword, or remove the message in [`src/i18n/en.ts`](src/i18n/en.ts). For a new message, also add it to the `Messages` type in [`src/i18n/types.ts`](src/i18n/types.ts) with a short comment saying where it appears. The translator reads that comment, so it helps to name the screen or the control.
787
-
788
- ```ts
789
- // src/i18n/types.ts
790
- chat: {
791
- /** Button that stops a reply while it streams. */
792
- stop: string;
793
- };
794
-
795
- // src/i18n/en.ts
796
- chat: {
797
- stop: "Stop response",
798
- },
799
- ```
800
-
801
- **2. Translate.**
802
-
803
- ```bash
804
- npm run i18n:translate
805
- ```
806
-
807
- The script finds the English messages that are new or reworded since the last run, translates only those into all 31 locales, and removes keys English no longer has. Then it runs `check-locales.mjs` and the type-check. It never touches messages you didn't change, so hand-corrected translations are kept.
808
-
809
- **3. Review and commit.** Look over `git diff src/i18n`, then commit the locale files together with `src/i18n/en.snapshot.json`. The snapshot records which English text has been translated. It's how the next run knows what changed, so commit it with the translations.
810
-
811
- **Setup (once).** Run `npm install`. The script uses `@anthropic-ai/sdk`, a dev dependency that the published package doesn't include. You also need a Claude API key from [platform.claude.com](https://platform.claude.com), set in your shell:
812
-
813
- ```bash
814
- export ANTHROPIC_API_KEY=sk-ant-... # macOS, Linux, Git Bash
815
- $env:ANTHROPIC_API_KEY = "sk-ant-..." # PowerShell
816
- ```
817
-
818
- Don't commit the key or put it in a `.env` file that ships with the library. The script only runs on your machine, and the translations ship as plain files, so the library never calls the API at runtime. Each run sends only the changed messages, so a typical run costs a few cents.
819
-
820
- **Options**
821
-
822
- | Command | What it does |
823
- | --- | --- |
824
- | `npm run i18n:translate -- --dry-run` | Lists what would be translated in each locale, without calling the API |
825
- | `npm run i18n:translate -- --locales de,fr` | Translates only these locales (the snapshot isn't updated, so a later full run still covers the rest) |
826
- | `npm run i18n:translate -- --accept` | Records the current English as translated without translating, for edits that don't change the meaning (a typo or punctuation fix) |
827
- | `npm run i18n:translate -- --concurrency 1` | Translates one locale at a time, if you hit rate limits (default: 4) |
828
- | `npm run i18n:translate -- --effort medium` | Uses less model effort, which is cheaper and faster (default: `high`) |
829
- | `npm run i18n:translate -- --skip-checks` | Skips the locale check and type-check afterwards |
830
-
831
- **If English changes without a translation run**, `node scripts/check-locales.mjs` fails and names the messages, so other languages can't silently keep the old meaning. Run `npm run i18n:translate`, or use `--accept` if the change doesn't affect translations.
832
-
833
- **Adding a language.** Copy an existing locale file to `src/i18n/locales/<code>.ts`, keep its header (the imports and the `p` and `n` helpers, with the new code), and empty the messages object: `export const messages: Messages = {};`. Then run `npm run i18n:translate -- --locales <code>`. It translates every message the new file is missing. The build picks up the new file automatically (`@vjdesigns/vjdesigns-ui/locales/<code>`). Add the language to [Bundled languages](#bundled-languages) too.
834
-
835
- **How it works.** The script ([`scripts/translate-locales.mjs`](scripts/translate-locales.mjs)) reads the catalogs as TypeScript source and sends Claude each message's English source, its type and comment from `types.ts`, the locale's current translation if there is one, and the locale's existing translations in the same section, so terminology stays consistent. Claude returns TypeScript for each message. Plurals go through the locale's `p()` helper with that language's own plural forms (Russian has four, Arabic six). The script checks that every answer is valid TypeScript of the right kind (text, a function with the same parameters, or an array of the same length), asks again once for any that aren't, then writes the answers into the locale files in English order. Messages that still fail are listed and left unchanged, and the snapshot isn't updated, so re-running retries them.
836
-
837
- The translations are machine-made. Corrections from native speakers are welcome: edit the locale file directly. The script won't overwrite your fix unless the English for that message changes.
838
-
839
- ### Releasing
840
-
841
- ```bash
842
- npm whoami # check you're logged in (if not: npm login)
843
- npm run build
844
- npm version patch # or minor / major
845
- npm publish
846
- git push --follow-tags
847
- ```
848
-
849
- See [RELEASING.md](RELEASING.md) for the full process, including how to update the projects that use the library and fixes for common errors.
850
-
851
- ---
852
-
853
- ## Access to the production Storybook
854
-
855
- 1. Go to [component.vjdesigns.org](https://component.vjdesigns.org/).
856
- 2. Enter your email in the Cloudflare prompt to receive a 6-digit access code.
857
-
858
- <img width="1917" height="927" alt="Cloudflare access prompt for component.vjdesigns.org" src="https://github.com/user-attachments/assets/bfe58737-52d2-4bf3-b7f7-72ba5ee54969" />
859
-
860
- ---
861
-
862
- ## License
863
-
864
- [ISC](LICENSE) © 2026 VJDesigns. The Pro package (`pro/`) has its own commercial license.
1
+ # vjdesigns-ui
2
+
3
+ An accessible React 19 component library from VJ Designs, built to meet WCAG 2.2 AA. It has more than 80 components (buttons, form controls, layout, navigation, overlays, feedback and data display), with light and dark modes, five brand palettes, 31 languages, right-to-left support, and no runtime dependencies. Need data grids, charts, planners, or ready-made pages? See [Pro](#pro).
4
+
5
+ 🌐 **Website and Pro:** [vjdesigns-ui.org](https://vjdesigns-ui.org)
6
+ 📚 **Live docs and Storybook:** [component.vjdesigns.org](https://component.vjdesigns.org)
7
+ 📦 **npm:** [@vjdesigns/vjdesigns-ui](https://www.npmjs.com/package/@vjdesigns/vjdesigns-ui)
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ Install the package along with React and React DOM. The library requires **React 19**, which the components need in order to render:
14
+
15
+ ```bash
16
+ npm install @vjdesigns/vjdesigns-ui react react-dom
17
+ ```
18
+
19
+ If your project already uses React, you only need the first package:
20
+
21
+ ```bash
22
+ npm install @vjdesigns/vjdesigns-ui
23
+ ```
24
+
25
+ ### Browser support
26
+
27
+ The components support the current and previous major versions of evergreen browsers, with these minimums:
28
+
29
+ | Browser | Minimum version |
30
+ | --- | --- |
31
+ | Chrome, Edge, and other Chromium browsers | 111 |
32
+ | Firefox | 121 |
33
+ | Safari (macOS and iOS) | 16.2 |
34
+
35
+ These are set by the CSS the components rely on: `color-mix()`, container queries, `:has()` (which draws some keyboard focus rings), and the `inert` attribute. Internet Explorer and legacy (non-Chromium) Edge aren't supported.
36
+
37
+ A few newer features are used only where available, with a fallback elsewhere: `field-sizing` for auto-growing `Textarea` (measured in JavaScript otherwise), the `scrollend` event in `Carousel`, and `hidden="until-found"` for find-in-page in `Accordion` and `Collapsible`.
38
+
39
+ ### Import the styles
40
+
41
+ The component styles and shared design tokens ship as a separate stylesheet. Import it **once** at your app's entry point, or the components will render unstyled.
42
+
43
+ **React:** in `main.tsx` (or `App.tsx`)
44
+
45
+ ```ts
46
+ import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
47
+ ```
48
+
49
+ **Angular:** add it to the `styles` array in `angular.json`
50
+
51
+ ```json
52
+ "styles": [
53
+ "node_modules/@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css",
54
+ "src/styles.css"
55
+ ]
56
+ ```
57
+
58
+ **Vue:** in `main.ts`
59
+
60
+ ```ts
61
+ import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Usage
67
+
68
+ The components are built with React. You can use them directly in a React project. In Angular or Vue, you mount them inside a small wrapper component, as shown below.
69
+
70
+ ### React
71
+
72
+ ```tsx
73
+ import { useState } from "react";
74
+ import { Button, CheckBox } from "@vjdesigns/vjdesigns-ui";
75
+
76
+ export function SignupForm() {
77
+ const [accepted, setAccepted] = useState(false);
78
+
79
+ return (
80
+ <form>
81
+ <CheckBox
82
+ label="Accept terms"
83
+ checked={accepted}
84
+ onCheckedChange={setAccepted}
85
+ />
86
+ <Button
87
+ variant="solid"
88
+ tone="primary"
89
+ size="md"
90
+ disabled={!accepted}
91
+ onClick={() => console.log("Submitted")}
92
+ >
93
+ Submit
94
+ </Button>
95
+ </form>
96
+ );
97
+ }
98
+ ```
99
+
100
+ ### Next.js (App Router) and React Server Components
101
+
102
+ The library works in Server Components. Interactive components (anything with state, effects, or context: `Button`, `DataGrid`, `Modal`, ...) are marked `"use client"`, so you can render them from a Server Component like any client component. Utilities (`cx`, `sortRows`, `createBrandPalette`, `getLocaleDirection`, ...) and the locale catalogs have no directive, so you can call or read them on the server too. Every component also renders on the server for the first paint.
103
+
104
+ Put the providers in a small client file of your own, and render it from the root layout:
105
+
106
+ ```tsx
107
+ // app/providers.tsx
108
+ "use client";
109
+ import { LocaleProvider, ToastProvider } from "@vjdesigns/vjdesigns-ui";
110
+ import es from "@vjdesigns/vjdesigns-ui/locales/es";
111
+ import type { ReactNode } from "react";
112
+
113
+ export function Providers({ children }: { children: ReactNode }) {
114
+ return (
115
+ <LocaleProvider locale="es" messages={es}>
116
+ <ToastProvider>{children}</ToastProvider>
117
+ </LocaleProvider>
118
+ );
119
+ }
120
+ ```
121
+
122
+ ```tsx
123
+ // app/layout.tsx (a Server Component)
124
+ import "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css";
125
+ import { getLocaleDirection } from "@vjdesigns/vjdesigns-ui";
126
+ import { Providers } from "./providers";
127
+
128
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
129
+ return (
130
+ <html lang="es" dir={getLocaleDirection("es")}>
131
+ <body>
132
+ <Providers>{children}</Providers>
133
+ </body>
134
+ </html>
135
+ );
136
+ }
137
+ ```
138
+
139
+ Two rules of Server Components to keep in mind:
140
+
141
+ - **Functions can't be passed from a Server Component to a client one.** That includes event handlers (`onClick`), DataGrid columns with `cell` or `value` functions, and the locale catalogs themselves (their plural messages are functions, which is why `LocaleProvider` goes in the client providers file above). Render those components from your own `"use client"` file.
142
+ - **Compound parts can't be reached with a dot from a Server Component** (`Tabs.List`, `Menu.Item`): Next.js reports "You cannot dot into a client module". Use them inside a `"use client"` file, or use the named exports where they exist (`CardHeader`, `CardBody`, `NavbarBrand`, ...).
143
+
144
+ ### Angular
145
+
146
+ Make a standalone wrapper that renders the React component into its host element. The wrapper uses `createElement`, so you don't need to change your JSX or TSX settings.
147
+
148
+ ```ts
149
+ // vj-button.component.ts
150
+ import {
151
+ AfterViewInit,
152
+ Component,
153
+ ElementRef,
154
+ EventEmitter,
155
+ Input,
156
+ OnChanges,
157
+ OnDestroy,
158
+ Output,
159
+ ViewChild,
160
+ } from "@angular/core";
161
+ import { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from "react";
162
+ import { createRoot, Root } from "react-dom/client";
163
+ import {
164
+ Button,
165
+ type ButtonProps,
166
+ type ButtonVariant,
167
+ type Size,
168
+ type Tone,
169
+ } from "@vjdesigns/vjdesigns-ui";
170
+
171
+ // Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.
172
+ const ReactButton = Button as (props: ButtonProps) => ReactElement;
173
+
174
+ @Component({
175
+ selector: "vj-button",
176
+ standalone: true,
177
+ template: `<span #host></span>`,
178
+ })
179
+ export class VjButtonComponent implements AfterViewInit, OnChanges, OnDestroy {
180
+ @ViewChild("host", { static: true }) host!: ElementRef<HTMLElement>;
181
+
182
+ @Input() label = "";
183
+ @Input() variant: ButtonVariant = "solid";
184
+ @Input() tone: Tone = "primary";
185
+ @Input() size: Size = "md";
186
+ @Input() disabled = false;
187
+ @Output() clicked = new EventEmitter<MouseEvent>();
188
+
189
+ private root?: Root;
190
+
191
+ ngAfterViewInit() {
192
+ this.root = createRoot(this.host.nativeElement);
193
+ this.render();
194
+ }
195
+
196
+ ngOnChanges() {
197
+ this.render();
198
+ }
199
+
200
+ ngOnDestroy() {
201
+ this.root?.unmount();
202
+ }
203
+
204
+ private render() {
205
+ this.root?.render(
206
+ createElement(
207
+ ReactButton,
208
+ {
209
+ variant: this.variant,
210
+ tone: this.tone,
211
+ size: this.size,
212
+ disabled: this.disabled,
213
+ onClick: (event: ReactMouseEvent) => this.clicked.emit(event.nativeEvent),
214
+ },
215
+ this.label // the button's text is passed as children
216
+ )
217
+ );
218
+ }
219
+ }
220
+ ```
221
+
222
+ Import the wrapper wherever you need it:
223
+
224
+ ```ts
225
+ // app.component.ts
226
+ import { Component } from "@angular/core";
227
+ import { VjButtonComponent } from "./vj-button.component";
228
+
229
+ @Component({
230
+ selector: "app-root",
231
+ standalone: true,
232
+ imports: [VjButtonComponent],
233
+ template: `<vj-button label="Submit" tone="primary" (clicked)="onSubmit()" />`,
234
+ })
235
+ export class AppComponent {
236
+ onSubmit() {
237
+ console.log("Submitted");
238
+ }
239
+ }
240
+ ```
241
+
242
+ ### Vue 3
243
+
244
+ Make a wrapper component that mounts the React component when it loads and re-renders it whenever its props change.
245
+
246
+ ```vue
247
+ <!-- VjButton.vue -->
248
+ <script setup lang="ts">
249
+ import { onBeforeUnmount, onMounted, ref, watch } from "vue";
250
+ import { createElement, type MouseEvent as ReactMouseEvent, type ReactElement } from "react";
251
+ import { createRoot, type Root } from "react-dom/client";
252
+ import {
253
+ Button,
254
+ type ButtonProps,
255
+ type ButtonVariant,
256
+ type Size,
257
+ type Tone,
258
+ } from "@vjdesigns/vjdesigns-ui";
259
+
260
+ // Button has overloaded types (for `href` and `as`). Narrowing it here lets createElement type-check.
261
+ const ReactButton = Button as (props: ButtonProps) => ReactElement;
262
+
263
+ const props = withDefaults(
264
+ defineProps<{
265
+ label: string;
266
+ variant?: ButtonVariant;
267
+ tone?: Tone;
268
+ size?: Size;
269
+ disabled?: boolean;
270
+ }>(),
271
+ { variant: "solid", tone: "primary", size: "md", disabled: false }
272
+ );
273
+
274
+ const emit = defineEmits<{ click: [event: MouseEvent] }>();
275
+
276
+ const host = ref<HTMLElement | null>(null);
277
+ let root: Root | undefined;
278
+
279
+ function render() {
280
+ root?.render(
281
+ createElement(
282
+ ReactButton,
283
+ {
284
+ variant: props.variant,
285
+ tone: props.tone,
286
+ size: props.size,
287
+ disabled: props.disabled,
288
+ onClick: (event: ReactMouseEvent) => emit("click", event.nativeEvent),
289
+ },
290
+ props.label // the button's text is passed as children
291
+ )
292
+ );
293
+ }
294
+
295
+ onMounted(() => {
296
+ root = createRoot(host.value!);
297
+ render();
298
+ });
299
+
300
+ watch(() => ({ ...props }), render);
301
+
302
+ onBeforeUnmount(() => root?.unmount());
303
+ </script>
304
+
305
+ <template>
306
+ <span ref="host" />
307
+ </template>
308
+ ```
309
+
310
+ Use it like any other Vue component:
311
+
312
+ ```vue
313
+ <script setup lang="ts">
314
+ import VjButton from "./VjButton.vue";
315
+
316
+ const onSubmit = () => console.log("Submitted");
317
+ </script>
318
+
319
+ <template>
320
+ <VjButton label="Submit" tone="primary" @click="onSubmit" />
321
+ </template>
322
+ ```
323
+
324
+ > **Tip:** Wrap `CheckBox` and any other component the same way. Pass its props into `createElement`, and send its callbacks back out as Angular outputs or Vue emits. For `CheckBox`, that means sending `onCheckedChange` back out.
325
+
326
+ ---
327
+
328
+ ## Theming
329
+
330
+ Wrap any part of your app in `Theme` to set the color mode, brand palette, and accent for everything inside it:
331
+
332
+ ```tsx
333
+ import { Theme, Button } from "@vjdesigns/vjdesigns-ui";
334
+
335
+ <Theme mode="dark" brand="purple" fill>
336
+ <Button>Dark, purple button</Button>
337
+ </Theme>
338
+ ```
339
+
340
+ | Prop | Type | Default | Description |
341
+ | --- | --- | --- | --- |
342
+ | `mode` | `"light" \| "dark"` | inherited | Color mode for everything inside. |
343
+ | `brand` | `"black" \| "blue" \| "gold" \| "green" \| "purple"`, a hex color, or `{ light, dark }` | inherited | Brand palette for buttons, links, focus rings and indicators. |
344
+ | `accent` | `"brand" | "lime"`, a hex color, or `{ light, dark }` | inherited (the brand's own) | The bright highlight on badges, switches, progress bars, sliders, steppers, and active navigation. |
345
+ | `fill` | `boolean` | `false` | Paints the theme's background and text color on the wrapper. |
346
+
347
+ Outside React (or to theme the whole page), set the attributes on `<html>` instead:
348
+
349
+ ```html
350
+ <html data-theme="dark" data-brand="purple" data-accent="lime">
351
+ ```
352
+
353
+ ### Accent color
354
+
355
+ The accent is the energetic highlight: badges, switches, progress bars, sliders, steppers, and the active link in the Navbar. By default it follows the brand, as a bright shade of the brand's own color, so it always fits:
356
+
357
+ | Brand | Default accent |
358
+ | --- | --- |
359
+ | `blue` (default) | sky blue `#76c7ff` |
360
+ | `purple` | lavender `#c0b0ff` |
361
+ | `gold` | amber `#f5ad5f` |
362
+ | `green` | mint `#72d4ad` |
363
+ | `black` | lime `#c8f031` (black has no hue to build on) |
364
+ | a custom hex | generated from that color |
365
+
366
+ To choose a different one:
367
+
368
+ ```tsx
369
+ <Theme accent="lime">…</Theme> // the original bright yellow-green ("volt", its former name, still works)
370
+ <Theme accent="#ff6b00">…</Theme> // any color
371
+ <Theme accent="brand">…</Theme> // back to the brand's own, inside an area with another accent
372
+ ```
373
+
374
+ Accents always carry dark text. A color too dark for that is lightened (same hue) just enough to meet WCAG AA, with a warning in development. An accent you set also holds inside nested brands. In CSS, `accentCss("name", "#ff6b00")` generates a `[data-accent="name"]` rule, like `brandCss` below.
375
+
376
+ ### Custom brand colors
377
+
378
+ Pass any hex color as `brand` and a full palette is generated for both modes:
379
+
380
+ ```tsx
381
+ <Theme brand="#e11d48">…</Theme>
382
+ <Theme brand={{ light: "#4338ca", dark: "#f472b6" }}>…</Theme>
383
+ ```
384
+
385
+ Every generated palette meets WCAG 2.2 AA. A single color is used exactly as given in the mode where it has enough contrast (dark colors in light mode, light colors in dark mode), and the other mode gets a matching shade of the same hue. If a color doesn't have enough contrast (for example, a mid-tone that fails in both modes), its lightness is shifted just enough to pass, and a warning is logged in development.
386
+
387
+ To define a brand in CSS instead (for the whole page, applied before any JavaScript runs), generate a stylesheet rule with `brandCss`:
388
+
389
+ ```ts
390
+ import { brandCss } from "@vjdesigns/vjdesigns-ui";
391
+
392
+ brandCss("acme", "#e11d48"); // '[data-brand="acme"] { --brand-light-primary: … }'
393
+ ```
394
+
395
+ Add the rule to your stylesheet and use `<html data-brand="acme">`. `createBrandPalette(color)` returns the generated colors as an object, if you need them directly.
396
+
397
+ ### Tailwind CSS
398
+
399
+ A Tailwind CSS v4 preset turns the design tokens into utilities, so your own layouts match the components. Import it after Tailwind in your CSS, and keep importing the library's stylesheet as usual:
400
+
401
+ ```css
402
+ @import "tailwindcss";
403
+ @import "@vjdesigns/vjdesigns-ui/tailwind.css";
404
+ ```
405
+
406
+ ```tsx
407
+ <section className="bg-surface text-text rounded-xl shadow-md p-6">
408
+ <h2 className="font-display text-2xl tracking-tight">Season stats</h2>
409
+ <p className="text-text-muted">Updated after every game.</p>
410
+ <span className="bg-accent text-on-accent rounded-control px-3">New</span>
411
+ </section>
412
+ ```
413
+
414
+ Every utility points at a token (`bg-primary` is `var(--color-primary)`), so Tailwind classes follow `Theme`, `data-theme`, `data-brand`, and `data-accent` exactly like the components, with no `dark:` variants needed.
415
+
416
+ | Group | Utilities |
417
+ | --- | --- |
418
+ | Colors | `bg-`, `text-`, `border-`, `ring-`, … with `bg`, `surface` (`-raised`, `-sunken`, `-hover`, `-active`), `overlay`, `text` (`-muted`, `-disabled`, `-inverse`), `border` (`-strong`, `-input`), `focus-ring`, `link-visited`; and for `primary`, `accent`, `success`, `warning`, `danger`, `info`, `neutral`: the solid color, `-hover`, `-active`, `on-…` (text on the solid), `-subtle`, `-subtle-hover`, `-subtle-text`, `-border`. Opacity modifiers work (`bg-primary/50`). |
419
+ | Charts | `bg-chart-1` to `bg-chart-8`, for fills only, in that order. Slots 3 to 5 are under 3:1 on white, so pair them with a legend, labels, or a data table. |
420
+ | Type | `font-display` (headings, buttons, labels, numbers), `font-body`, `font-mono`; `text-xs` to `text-6xl` (plus `text-md`); `font-regular` to `font-black`; `leading-tight`, `-snug`, `-normal`, `-relaxed`; `tracking-tight`, `-normal`, `-wide`, `-caps` |
421
+ | Shape | `rounded-control` (pill controls), `rounded-field` (text fields), `rounded-xs` to `rounded-2xl`, `rounded-pill` |
422
+ | Depth | `shadow-xs` to `shadow-xl`, `blur-sm`, `blur-lg` |
423
+ | Motion | `ease-spring` (enter and press), `ease-standard`, `ease-in`, `ease-out`; `duration-instant`, `-fast`, `-normal`, `-slow` (0ms under reduced motion) |
424
+ | Sizes | `h-control-sm`, `-md`, `-lg` (and `w-`, `min-h-`, …), `size-target` (the 24px minimum pointer target), `max-w-xs` to `max-w-2xl` and `@xs:` to `@2xl:` container queries |
425
+ | Layers | `z-sticky`, `z-overlay`, `z-modal`, `z-popover`, `z-dropdown`, `z-toast`, `z-tooltip` |
426
+ | Dark mode | `dark:` follows `data-theme="dark"`, not the OS setting. |
427
+
428
+ Tailwind's numeric spacing (`p-4` = 1rem) already matches the 4px token scale, and the breakpoints (`sm:` to `2xl:`) are the same as Tailwind's.
429
+
430
+ Some Tailwind names change meaning with the preset: `rounded-*`, `shadow-*`, `blur-sm`/`-lg`, `ease-in`/`-out`, `font-mono`, `font-medium` to `font-black`, `leading-*`, and the `text-*` sizes take the library's values (for example, `rounded-md` is 12px and `font-black` is 800). So do the containers: `max-w-md` and `@md:` are 48rem, not Tailwind's 28rem. The library's stylesheet already gives some of these names its own values once it's loaded, even without the preset; the preset keeps the utilities and the container queries consistent.
431
+
432
+ For text contrast, use the pairs the components use: `text-text` or `text-text-muted` on `bg-bg`, `bg-surface`, and the other surfaces; `text-on-primary` on `bg-primary` (likewise `on-accent`, `on-success`, …); `text-primary-subtle-text` on `bg-primary-subtle` (likewise for each tone). These pairs meet WCAG 2.2 AA in both themes and every brand. Don't use accent or chart colors for text.
433
+
434
+ The preset doesn't change the components, and Tailwind's preflight (its CSS reset) doesn't override them, whichever stylesheet loads first.
435
+
436
+ ---
437
+
438
+ ## Languages
439
+
440
+ Components have built-in text: button names like "Close" and "Next page", screen-reader announcements like "3 results available", validation messages, and date formats. Wrap your app in `LocaleProvider` to show all of it in another language:
441
+
442
+ ```tsx
443
+ import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
444
+ import es from "@vjdesigns/vjdesigns-ui/locales/es";
445
+
446
+ <LocaleProvider locale="es" messages={es}>
447
+ <App />
448
+ </LocaleProvider>
449
+ ```
450
+
451
+ `LocaleProvider` sets:
452
+
453
+ - **Built-in text** for every component, from `messages`.
454
+ - **Dates and numbers** in the locale's format (`23/10/2026`, `1.234,5`), and plurals that follow the language's rules.
455
+ - **Writing direction**: Arabic, Hebrew, Persian, and Urdu get `dir="rtl"`, and layouts and arrow keys mirror.
456
+ - **`lang`** on its wrapper, so screen readers pronounce the text correctly. Popups (menus, dialogs, tooltips) keep the language of the area that opened them.
457
+
458
+ Each locale is a separate import, so your app only downloads the languages it uses. Without a `LocaleProvider`, components use English text and the browser's date and number format.
459
+
460
+ This library only translates its own built-in text. Text your app passes in, like `<Button>Save</Button>`, is your app's content: translate it with your app's i18n library (react-i18next, FormatJS, and so on).
461
+
462
+ ### What gets translated
463
+
464
+ The language is never picked automatically from where the user lives or their browser settings. Your app chooses it by rendering a `LocaleProvider`. For example, with `<LocaleProvider locale="de" messages={de}>`:
465
+
466
+ | | Translated? |
467
+ | --- | --- |
468
+ | Text your app passes in, like `<Button>Save</Button>` | No: your app translates it |
469
+ | Built-in names, like "Close", "Next page", "Clear search" | Yes: "Schließen", "Nächste Seite", "Suche löschen" |
470
+ | Screen-reader announcements, like "3 results available" | Yes: "3 Ergebnisse verfügbar" |
471
+ | Validation messages, empty states, file-upload prompts | Yes |
472
+ | Dates and numbers | Yes: "23.10.2026", "4,5" |
473
+
474
+ To follow the user's browser language, pass it yourself: `locale={navigator.language}` together with the matching `messages` (see [Switching language at runtime](#switching-language-at-runtime)).
475
+
476
+ ### Bundled languages
477
+
478
+ `ar` Arabic · `bn` Bengali · `cs` Czech · `da` Danish · `de` German · `el` Greek · `es` Spanish · `fa` Persian · `fi` Finnish · `fr` French · `he` Hebrew · `hi` Hindi · `hu` Hungarian · `id` Indonesian · `it` Italian · `ja` Japanese · `ko` Korean · `nb` Norwegian Bokmål · `nl` Dutch · `pl` Polish · `pt-BR` Portuguese (Brazil) · `ro` Romanian · `ru` Russian · `sv` Swedish · `th` Thai · `tr` Turkish · `uk` Ukrainian · `ur` Urdu · `vi` Vietnamese · `zh-Hans` Chinese (Simplified) · `zh-Hant` Chinese (Traditional), plus English (the default).
479
+
480
+ The translations are machine-generated and haven't been reviewed by native speakers yet. If you find a wrong or awkward phrase, override it (below) and report it so the bundled locale can be fixed. (Working on the library itself? See [Translating built-in text](#translating-built-in-text).)
481
+
482
+ ### Changing a few strings
483
+
484
+ Pass only the strings you want to change. Everything else falls back to the outer provider's language (English at the top):
485
+
486
+ ```tsx
487
+ <LocaleProvider locale="en-GB" messages={{ pagination: { next: "Onwards" } }}>
488
+ ```
489
+
490
+ Providers nest, so an inner provider can switch the language for one part of the page. Per-component props such as `clearLabel` or `labels` still win over the provider.
491
+
492
+ ### Other languages
493
+
494
+ For a language that isn't bundled, write a complete messages object. TypeScript flags any missing string. Use English as the template:
495
+
496
+ ```ts
497
+ import { en, plural, type Messages } from "@vjdesigns/vjdesigns-ui";
498
+
499
+ const p = plural("sw");
500
+ export const sw: Messages = {
501
+ ...en,
502
+ pagination: { ...en.pagination, next: "Ukurasa unaofuata", previous: "Ukurasa uliopita" },
503
+ searchInput: {
504
+ ...en.searchInput,
505
+ results: (count) => p(count, { "=0": "Hakuna matokeo", one: "Tokeo #", other: "Matokeo #" }),
506
+ },
507
+ // ...
508
+ };
509
+ ```
510
+
511
+ `plural(locale)` picks the right plural form for any language (`#` is the formatted number).
512
+
513
+ ### Switching language at runtime
514
+
515
+ List the languages your app offers as loaders, so each one is downloaded only when picked:
516
+
517
+ ```tsx
518
+ import { LocaleProvider, type Messages } from "@vjdesigns/vjdesigns-ui";
519
+
520
+ const loaders: Record<string, () => Promise<{ default: Messages }>> = {
521
+ es: () => import("@vjdesigns/vjdesigns-ui/locales/es"),
522
+ fr: () => import("@vjdesigns/vjdesigns-ui/locales/fr"),
523
+ ar: () => import("@vjdesigns/vjdesigns-ui/locales/ar"),
524
+ };
525
+
526
+ function App({ lang }: { lang: string }) {
527
+ const [messages, setMessages] = useState<Messages>();
528
+ useEffect(() => {
529
+ const load = loaders[lang];
530
+ if (load) load().then((mod) => setMessages(mod.default));
531
+ else setMessages(undefined); // English
532
+ }, [lang]);
533
+ // Until a language loads, the previous one (or English) shows.
534
+ return <LocaleProvider locale={lang} messages={messages}>…</LocaleProvider>;
535
+ }
536
+ ```
537
+
538
+ For server rendering, also set `<html lang="…" dir="…">` on the page. `getLocaleDirection(locale)` returns `"ltr"` or `"rtl"`.
539
+
540
+ ---
541
+
542
+ ## Form validation
543
+
544
+ > **Front-end validation is not security.** It helps people fill in a form correctly, but anyone can turn off JavaScript or send requests straight to your server. Always validate again on the server. The format checks below (`isEmail`, `isIP`, …) are plain functions you can reuse there.
545
+
546
+ `useFormValidation` checks a form when it's submitted, using the browser's own rules on each input (`required`, `type="email"`, `minLength`, `pattern`, `min` / `max`) plus any rules you add. Messages follow the current language.
547
+
548
+ ```tsx
549
+ import {
550
+ useFormValidation, rules, ErrorSummary, Field, Input, PasswordInput, Button,
551
+ } from "@vjdesigns/vjdesigns-ui";
552
+
553
+ function SignUp() {
554
+ const form = useFormValidation({
555
+ rules: {
556
+ confirm: rules.matches("password", "The passwords don't match."),
557
+ serverIp: rules.ip(), // IPv4 or IPv6
558
+ },
559
+ // Runs only when everything is valid. Return the server's errors to show them on their fields.
560
+ onValid: async (values) => {
561
+ const response = await api.signUp(values);
562
+ return response.errors; // e.g. { username: "That username is taken." }
563
+ },
564
+ });
565
+
566
+ return (
567
+ <form {...form.formProps}>
568
+ <ErrorSummary ref={form.summaryRef} errors={form.errorList} />
569
+ <Field label="Email" required error={form.errors.email}>
570
+ <Input name="email" type="email" />
571
+ </Field>
572
+ <Field label="Password" required error={form.errors.password}>
573
+ <PasswordInput name="password" minLength={12} />
574
+ </Field>
575
+ <Field label="Confirm password" required error={form.errors.confirm}>
576
+ <PasswordInput name="confirm" />
577
+ </Field>
578
+ <Field label="Server IP" error={form.errors.serverIp}>
579
+ <Input name="serverIp" />
580
+ </Field>
581
+ <Button type="submit" loading={form.isSubmitting}>Create account</Button>
582
+ </form>
583
+ );
584
+ }
585
+ ```
586
+
587
+ How it behaves:
588
+
589
+ - **On submit**, every field is checked. If anything is wrong, the `ErrorSummary` at the top lists the problems and takes focus, so screen readers announce it. Each item links to its field. Without a summary, focus goes to the first invalid field.
590
+ - **Errors are keyed by the field's `name`.** Pass `form.errors.<name>` to each `Field`'s `error`.
591
+ - **After a failed submit**, an error disappears as soon as the field is fixed (while typing), and a field is fully re-checked when you leave it. It doesn't nag while you're still typing.
592
+ - **Server errors** (returned from `onValid`, or set with `form.setErrors({...})`) show on their fields and stay until that field is edited.
593
+ - **Emails** must have a real domain (`name@example.com`). The browser's own check also accepts `name@localhost`.
594
+
595
+ ### Rules and format checks
596
+
597
+ | Rule | Checks |
598
+ | --- | --- |
599
+ | `rules.required()` | Not empty (for controls without a native `required`) |
600
+ | `rules.email()` | An email address in the usual format, with a top-level domain |
601
+ | `rules.ip()` / `rules.ip({ version: 4 })` / `rules.ip({ version: 6 })` | An IPv4 or IPv6 address |
602
+ | `rules.minLength(n)` / `rules.maxLength(n)` | Length in characters |
603
+ | `rules.pattern(/regex/, "message")` | The whole value matches |
604
+ | `rules.matches("otherField")` | Equals another field (confirm password) |
605
+ | your own `(value, { values }) => message` | Anything else |
606
+
607
+ Each rule takes an optional custom message. The checks behind them are exported for use anywhere, including your server:
608
+
609
+ - `isEmail(value)`
610
+ - `isIPv4(value)`: four numbers 0–255, no leading zeros
611
+ - `isIPv6(value)`: including `::` shorthand and IPv4 tails like `::ffff:192.168.0.1`
612
+ - `isIP(value, version?)`
613
+
614
+ ---
615
+
616
+ ## Hooks
617
+
618
+ Tested hooks for everyday UI work, exported from the package root (`import { useDisclosure } from "@vjdesigns/vjdesigns-ui"`). All are safe in server rendering and tree-shakable: each costs only itself, mostly well under 1 KB. Live demos are in Storybook under Hooks.
619
+
620
+ | Hook | What it does |
621
+ | --- | --- |
622
+ | `useDisclosure(initial?)` | Open/closed state with stable `open`, `close`, `toggle` handlers (for Modal, Drawer, Popover) |
623
+ | `useToggle(values?)` | Cycles through values: a boolean, or a list like `["list", "grid"]` |
624
+ | `usePrevious(value)` | The value from before its last change |
625
+ | `useDebouncedValue(value, ms)` | The value, updated after it stops changing (search as you type) |
626
+ | `useDebouncedCallback(fn, ms)` | A function that runs once after calls stop, with `cancel` and `flush` |
627
+ | `useThrottledCallback(fn, ms)` | A function that runs at most once per interval (scroll, resize) |
628
+ | `useInterval(fn, ms \| null)` / `useTimeout(fn, ms \| null)` | Timers that always call the latest function; `null` pauses |
629
+ | `useLocalStorage(key, default)` / `useSessionStorage` | State saved in storage, synced across components and tabs, and never throws when storage is blocked |
630
+ | `useClipboard()` | `copy(text)` with a `copied` flag, and a fallback when the Clipboard API is blocked |
631
+ | `useHotkeys([[keys, fn]])` | Page shortcuts. `mod` is ⌘ or Ctrl. Plain keys don't fire while typing. `getHotkeyHandler` does the same for one element |
632
+ | `useEventListener(type, fn, target?)` | An event listener that always calls the latest handler |
633
+ | `useClickOutside(fn)` | Calls `fn` on a press or focus move outside the element |
634
+ | `useIntersection(options)` | Whether an element is in view (lazy loading, entrance effects) |
635
+ | `useElementSize()` | An element's size as it resizes |
636
+ | `useVirtualizer(options)` | Renders only the visible items of a long list (what `VirtualList` uses), with variable heights and `scrollToIndex` |
637
+ | `useMediaQuery(query)` / `useResponsiveValue(value)` | A synced media query, or a responsive value resolved for the viewport |
638
+ | `useHydrated()` | False during server rendering, true after (avoids hydration mismatches) |
639
+ | `useReducedMotion()` / `useColorScheme()` | The user's motion and color-scheme preferences |
640
+ | `useOnline()` / `useDocumentVisibility()` / `useViewportSize()` | Connection, tab visibility, and viewport size |
641
+ | `useControllableState`, `useFormValidation`, `useFocusTrap`, `useScrollLock`, … | The building blocks the components use, for your own components |
642
+
643
+ ---
644
+
645
+ ## AI assistants
646
+
647
+ The package ships documentation written for AI coding assistants, generated from the source on every build, so it always matches the version you have installed:
648
+
649
+ | File | What it is |
650
+ | --- | --- |
651
+ | `@vjdesigns/vjdesigns-ui/llms.txt` | A short index in the [llms.txt](https://llmstxt.org) format: setup essentials and one line per component |
652
+ | `@vjdesigns/vjdesigns-ui/llms-full.txt` | The full reference in one file: guides, and every component's props (type, default, description), subcomponents, and examples |
653
+ | `@vjdesigns/vjdesigns-ui/registry.json` | The same, as structured JSON |
654
+
655
+ The files are in `node_modules/@vjdesigns/vjdesigns-ui/dist/ai/`. Point your assistant's rules or context at `llms-full.txt`.
656
+
657
+ ### MCP server
658
+
659
+ For assistants that support the [Model Context Protocol](https://modelcontextprotocol.io), the package includes a small MCP server with four tools:
660
+
661
+ - `list_components`
662
+ - `get_component`, for exact props
663
+ - `search_docs`
664
+ - `get_guide`
665
+
666
+ It reads the docs of your installed version and needs no network access.
667
+
668
+ Claude Code:
669
+
670
+ ```bash
671
+ claude mcp add vjdesigns-ui -- npx -p @vjdesigns/vjdesigns-ui vjdesigns-ui-mcp
672
+ ```
673
+
674
+ Cursor (`.cursor/mcp.json`), Claude Desktop, and other clients (VS Code's `.vscode/mcp.json` uses `"servers"` instead of `"mcpServers"`):
675
+
676
+ ```json
677
+ {
678
+ "mcpServers": {
679
+ "vjdesigns-ui": {
680
+ "command": "npx",
681
+ "args": ["-p", "@vjdesigns/vjdesigns-ui", "vjdesigns-ui-mcp"]
682
+ }
683
+ }
684
+ }
685
+ ```
686
+
687
+ ---
688
+
689
+ ## Components
690
+
691
+ Every component below is exported from the package root. Full prop docs and live examples are in [Storybook](https://component.vjdesigns.org).
692
+
693
+ | Category | Components |
694
+ | --- | --- |
695
+ | **Primitives** | Button, CopyButton, IconButton, ButtonGroup, Icon, Kbd, Typography |
696
+ | **Layout** | Box, Container, Divider, Flex, Grid, ResizablePanels, ScrollArea, Stack |
697
+ | **Forms** | CheckBox, CheckBoxGroup, ColorPicker, Combobox, DatePicker, DateRangePicker, DateTimePicker, Field, FileUpload, Input, NumberInput, PasswordInput, PinInput, Radio, Rating, SearchInput, SegmentedControl, Select, Slider, Switch, TagInput, Textarea, TimePicker, ToggleGroup |
698
+ | **Navigation** | Breadcrumbs, ContextMenu, Link, Menu, Navbar, Pagination, Sidebar, SkipLink, Stepper, Tabs, Toolbar |
699
+ | **Overlays** | CommandPalette, Drawer, HoverCard, Modal, Popover, Tooltip |
700
+ | **Feedback** | Alert, Banner, ErrorSummary, Progress, Skeleton, Spinner, Toast |
701
+ | **Data display** | Accordion, Avatar, Badge, Card, Carousel, Chat, Chip, CodeBlock, Collapsible, Countdown, DataGrid, EmptyState, Image, List, Stat, Table, Timeline, TreeView, VirtualList |
702
+ | **Utilities** | Portal, Theme, VisuallyHidden |
703
+
704
+ ### Button
705
+
706
+ ```tsx
707
+ <Button variant="solid" tone="primary">Save</Button>
708
+ <Button variant="outline" tone="danger" startIcon={<TrashIcon />}>Delete</Button>
709
+ <Button href="/pricing" variant="link">See pricing</Button>
710
+ <Button loading loadingText="Saving…">Save</Button>
711
+ ```
712
+
713
+ | Prop | Type | Default | Description |
714
+ | --- | --- | --- | --- |
715
+ | `children` | `ReactNode` | — | The visible label. |
716
+ | `variant` | `"solid" \| "soft" \| "outline" \| "ghost" \| "link" \| "inverse"` | `"solid"` | Visual style. |
717
+ | `tone` | `"neutral" \| "primary" \| "accent" \| "success" \| "warning" \| "danger" \| "info"` | `"primary"` | Semantic color. |
718
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding and type size. |
719
+ | `radius` | `"none" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl" \| "pill"` | `"pill"` | Corner rounding. |
720
+ | `startIcon` / `endIcon` | `ReactNode` | — | Decorative icon before or after the label. Hidden from screen readers. |
721
+ | `loading` | `boolean` | `false` | Shows a spinner, sets `aria-busy` and ignores clicks. |
722
+ | `loadingText` | `ReactNode` | — | Label shown next to the spinner while loading. |
723
+ | `fullWidth` | `boolean` | `false` | Stretches the button to fill its container. |
724
+ | `compact` | `boolean` | `false` | Tighter side padding for short labels like "OK". |
725
+ | `disabled` | `boolean` | `false` | Disables the button. |
726
+ | `href` | `string` | — | Renders the button as an `<a>` link with the same styling. |
727
+ | `as` | `ElementType` | — | Renders as your own component, such as a React Router or Next.js `Link`. |
728
+
729
+ Also accepts all standard `<button>` attributes (or `<a>` attributes when `href` is set), such as `onClick` and `type`.
730
+
731
+ For icon-only buttons, use `IconButton`. `aria-label` is required:
732
+
733
+ ```tsx
734
+ <IconButton aria-label="Close" variant="ghost"><CloseIcon /></IconButton>
735
+ ```
736
+
737
+ To group related buttons, use `ButtonGroup`. It passes `variant`, `tone`, `size`, `radius` and `disabled` down to every button inside.
738
+
739
+ ### CheckBox
740
+
741
+ ```tsx
742
+ <CheckBox label="Email me updates" description="About once a month." />
743
+ <CheckBox label="Remember me" labelPosition="start" defaultChecked />
744
+ ```
745
+
746
+ | Prop | Type | Default | Description |
747
+ | --- | --- | --- | --- |
748
+ | `label` | `ReactNode` | — | Visible label. Clicking it toggles the box. Without it, pass `aria-label`. |
749
+ | `description` | `ReactNode` | — | Supporting text below the label, linked with `aria-describedby`. |
750
+ | `checked` | `boolean` | — | Checked state (controlled). |
751
+ | `defaultChecked` | `boolean` | — | Initial checked state (uncontrolled). |
752
+ | `onCheckedChange` | `(checked: boolean) => void` | — | Called with the new state when the user toggles the box. |
753
+ | `indeterminate` | `boolean` | `false` | Shows a "mixed" dash, for a "select all" box whose options are partly checked. |
754
+ | `labelPosition` | `"start" \| "end"` | `"end"` | Puts the label before (`start`) or after (`end`) the box. |
755
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Box and text size. |
756
+ | `tone` | `Tone` | `"primary"` | Fill color when checked. |
757
+ | `invalid` | `boolean` | `false` | Danger styling plus `aria-invalid`. |
758
+ | `readOnly` | `boolean` | `false` | Keeps the box focusable but prevents toggling. |
759
+
760
+ Also accepts native `<input type="checkbox">` attributes, such as `name`, `required` and `disabled`.
761
+
762
+ To manage several options as one `string[]` value, use `CheckBoxGroup`:
763
+
764
+ ```tsx
765
+ <CheckBoxGroup label="Toppings" defaultValue={["cheese"]} onValueChange={setToppings}>
766
+ <CheckBox value="cheese" label="Cheese" />
767
+ <CheckBox value="peppers" label="Peppers" />
768
+ </CheckBoxGroup>
769
+ ```
770
+
771
+ For a "select all" box, pass its label as `selectAll`. The group adds the parent box, keeps its checked and mixed states in sync, and links the options to it, so screen readers announce them as belonging to it. Disabled options keep their state.
772
+
773
+ ```tsx
774
+ <CheckBoxGroup label="Pizza order" selectAll="All toppings" name="toppings">
775
+ <CheckBox value="cheese" label="Cheese" />
776
+ <CheckBox value="peppers" label="Peppers" />
777
+ </CheckBoxGroup>
778
+ ```
779
+
780
+ ### Chat: rendering replies safely
781
+
782
+ By default `Chat` shows each message as plain text, which is always safe. If you pass `renderContent` to render Markdown, treat every message as untrusted, including the model's replies, since a prompt injection can make a model write anything:
783
+
784
+ - Render to React elements, never an HTML string: don't use `dangerouslySetInnerHTML` or your Markdown renderer's raw-HTML option. If you must render HTML, sanitize it first (for example with DOMPurify).
785
+ - Allow only `http:`, `https:`, and `mailto:` link URLs, and give external links `rel="noopener noreferrer"`.
786
+ - Don't load remote images from replies automatically: an image URL can send conversation data to another server.
787
+
788
+ ---
789
+
790
+ ## Pro
791
+
792
+ **Everything above is free. [`@vjdesigns-pro/ui`](https://vjdesigns-ui.org) adds the large, hard-to-build parts most apps eventually need:** an advanced data grid, charts, scheduling and planning views, and ready-made pages. They use the same tokens, themes, languages, and accessibility standard as the free package, so they look and behave like the rest of your app from the first render.
793
+
794
+ ### Why teams choose Pro
795
+
796
+ - **Skip the hardest weeks of the build.** Data grids with pinned columns and inline editing, drag-and-drop planners, and a full dashboard frame are the components that take longest to get right. Pro gives you finished, tested versions to connect to your data.
797
+ - **Accessible where it's hardest.** Most libraries stop at buttons and forms. In Pro, every chart can be explored by keyboard, reads its values aloud, and can switch to a data table. Every drag-and-drop interaction (Kanban cards, calendar events, Gantt bars) also works from the keyboard. Every story is tested against WCAG 2.2 AA in light and dark mode.
798
+ - **One design system, not a patchwork.** There's no third-party chart, calendar, or spreadsheet library with its own look to fight. Pro follows your brand, accent color, theme, language, and reading direction automatically.
799
+ - **Nothing extra to install or audit.** Pro has no runtime dependencies. Excel export writes real `.xlsx` files without a spreadsheet library, and charts draw without a charting library.
800
+ - **Design and code stay in sync.** The Figma kit is generated from the same tokens as the components, so a designer's file and the shipped app can't drift apart.
801
+ - **A license that fits how you ship.** Licensed per developer. The apps you build can go to any number of end users, who need no license of their own, and versions released while your license is active keep working in the apps you've shipped.
802
+
803
+ ### What's included
804
+
805
+ | Area | What you get |
806
+ | --- | --- |
807
+ | **Data** | `DataGridPro`: resizable, pinned, reorderable, and hideable columns; column menus; filters with chips; row grouping with subtotals; tree data; master-detail rows; inline editing with validation; copy and paste of cell ranges; loading while scrolling. **CSV export** that's safe to open in a spreadsheet, and **Excel export** to real `.xlsx` files with typed cells. |
808
+ | **Charts** | Bar (grouped and stacked), Line, Area, Pie, Donut, Scatter, Heatmap, Gauge, and Sparkline, with zoom. |
809
+ | **Planning** | `Scheduler` (month, week, day, and agenda views; repeating events), `Kanban` (work-in-progress limits), and `Gantt` (dependencies and milestones; day, week, and month scales). |
810
+ | **App templates** | A dashboard frame with 3 layouts and 7 grid templates; sign-in, sign-up, password reset, and verification code forms with passkey support; an onboarding wizard and guided product tours; team and billing pages; error pages (404, 500, 403, maintenance, offline); and a complete AI chat app. |
811
+ | **Marketing** | Hero, feature grid, pricing table (monthly or yearly, with prices formatted for each locale), testimonials, FAQ, call to action, and footer. |
812
+ | **Sports** | Standings, a game schedule with calendar export, game cards, box scores, rosters, player profiles, tryout registration, and a ticket picker. |
813
+ | **Design** | A Figma kit with variables for every brand, theme, and accent, shadow styles, and W3C design token files. |
814
+
815
+ ### Free or Pro?
816
+
817
+ | | Free | Pro |
818
+ | --- | :-: | :-: |
819
+ | 80+ components, hooks, theming, 31 languages, form validation | ✓ | ✓ |
820
+ | `DataGrid`: sorting, filtering, selection, pagination, server-side data | ✓ | ✓ |
821
+ | Advanced grid: pinning, resizing, grouping, tree data, editing, copy and paste | | ✓ |
822
+ | CSV and Excel export | | ✓ |
823
+ | Charts | | ✓ |
824
+ | Scheduler, Kanban, and Gantt | | ✓ |
825
+ | Dashboard, account, onboarding, product tour, billing, error, and chat templates | | ✓ |
826
+ | Marketing and sports components | | ✓ |
827
+ | Figma kit | | ✓ |
828
+
829
+ Pro builds on the free package rather than replacing it, so you can start free and add Pro later without rewriting anything. `DataGridPro` takes every `DataGrid` prop, so upgrading a grid is a one-word change.
830
+
831
+ ### Get Pro
832
+
833
+ See plans and buy a license at **[vjdesigns-ui.org](https://vjdesigns-ui.org)**. After purchase you'll get a license key and install instructions. Pro installs next to this package with a few lines in your project's `.npmrc`.
834
+
835
+ ---
836
+
837
+ ## Support
838
+
839
+ Found a bug or need a feature? [Open an issue](https://github.com/vjdesigns/vjdesigns-ui-issues/issues). Release notes for every version are in [CHANGELOG.md](CHANGELOG.md).
840
+
841
+ ---
842
+
843
+ ## Access to the production Storybook
844
+
845
+ 1. Go to [component.vjdesigns.org](https://component.vjdesigns.org/).
846
+ 2. Enter your email in the Cloudflare prompt to receive a 6-digit access code.
847
+
848
+ <img width="1917" height="927" alt="Cloudflare access prompt for component.vjdesigns.org" src="https://github.com/user-attachments/assets/bfe58737-52d2-4bf3-b7f7-72ba5ee54969" />
849
+
850
+ ---
851
+
852
+ ## License
853
+
854
+ [ISC](LICENSE) © 2026 VJDesigns. Pro (`@vjdesigns-pro/ui`) has its own commercial license; see [vjdesigns-ui.org](https://vjdesigns-ui.org).