@sanity/ui 5.0.0-alpha.22 → 5.0.0-alpha.24

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 (377) hide show
  1. package/README.md +10 -0
  2. package/dist/index.d.ts +15 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +76 -59
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles.css +1 -1
  7. package/docs/components/avatar-counter.dsds.yaml +78 -0
  8. package/docs/components/avatar-stack.dsds.yaml +96 -0
  9. package/docs/components/avatar.dsds.yaml +115 -0
  10. package/docs/components/badge.dsds.yaml +126 -0
  11. package/docs/components/box.dsds.yaml +223 -0
  12. package/docs/components/button.dsds.yaml +296 -0
  13. package/docs/components/card.dsds.yaml +317 -0
  14. package/docs/components/checkbox.dsds.yaml +204 -0
  15. package/docs/components/code.dsds.yaml +169 -0
  16. package/docs/components/container.dsds.yaml +189 -0
  17. package/docs/components/dialog.dsds.yaml +343 -0
  18. package/docs/components/divider.dsds.yaml +93 -0
  19. package/docs/components/eyebrow.dsds.yaml +198 -0
  20. package/docs/components/flex.dsds.yaml +237 -0
  21. package/docs/components/grid.dsds.yaml +217 -0
  22. package/docs/components/h-stack.dsds.yaml +127 -0
  23. package/docs/components/heading.dsds.yaml +233 -0
  24. package/docs/components/hotkeys.dsds.yaml +60 -0
  25. package/docs/components/icon-button.dsds.yaml +227 -0
  26. package/docs/components/icon.dsds.yaml +275 -0
  27. package/docs/components/indicator-stack.dsds.yaml +98 -0
  28. package/docs/components/indicator.dsds.yaml +108 -0
  29. package/docs/components/inline.dsds.yaml +127 -0
  30. package/docs/components/kbd.dsds.yaml +59 -0
  31. package/docs/components/link.dsds.yaml +108 -0
  32. package/docs/components/list-button-item.dsds.yaml +103 -0
  33. package/docs/components/list-item-image.dsds.yaml +82 -0
  34. package/docs/components/list-item-text.dsds.yaml +80 -0
  35. package/docs/components/list-item.dsds.yaml +148 -0
  36. package/docs/components/list.dsds.yaml +162 -0
  37. package/docs/components/popover.dsds.yaml +214 -0
  38. package/docs/components/press-area.dsds.yaml +279 -0
  39. package/docs/components/radio.dsds.yaml +198 -0
  40. package/docs/components/select.dsds.yaml +214 -0
  41. package/docs/components/skip-to-content.dsds.yaml +110 -0
  42. package/docs/components/spinner.dsds.yaml +119 -0
  43. package/docs/components/switch.dsds.yaml +202 -0
  44. package/docs/components/tab.dsds.yaml +54 -0
  45. package/docs/components/tabs-list.dsds.yaml +56 -0
  46. package/docs/components/tabs-panel.dsds.yaml +54 -0
  47. package/docs/components/tabs.dsds.yaml +104 -0
  48. package/docs/components/text-area.dsds.yaml +170 -0
  49. package/docs/components/text-input.dsds.yaml +189 -0
  50. package/docs/components/text.dsds.yaml +268 -0
  51. package/docs/components/tooltip-group.dsds.yaml +90 -0
  52. package/docs/components/tooltip.dsds.yaml +216 -0
  53. package/docs/components/v-stack.dsds.yaml +155 -0
  54. package/docs/components/visually-hidden.dsds.yaml +112 -0
  55. package/docs/evals/cases.yaml +1319 -0
  56. package/docs/examples/checkbox-2.tsx +57 -0
  57. package/docs/examples/confirmation-dialogs-1.tsx +27 -0
  58. package/docs/examples/confirmation-dialogs-2.tsx +55 -0
  59. package/docs/examples/confirmation-dialogs-3.tsx +28 -0
  60. package/docs/examples/confirmation-dialogs-4.tsx +38 -0
  61. package/docs/examples/popover-1.tsx +48 -0
  62. package/docs/examples/popover-2.tsx +53 -0
  63. package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
  64. package/docs/foundations/color-guidelines.dsds.yaml +308 -0
  65. package/docs/foundations/content-guidelines.dsds.yaml +285 -0
  66. package/docs/foundations/semantics.dsds.yaml +125 -0
  67. package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
  68. package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
  69. package/docs/icons/icon-access-denied.dsds.yaml +40 -0
  70. package/docs/icons/icon-activity.dsds.yaml +40 -0
  71. package/docs/icons/icon-add-circle.dsds.yaml +14 -0
  72. package/docs/icons/icon-add-comment.dsds.yaml +34 -0
  73. package/docs/icons/icon-add-document.dsds.yaml +34 -0
  74. package/docs/icons/icon-add-user.dsds.yaml +30 -0
  75. package/docs/icons/icon-add.dsds.yaml +57 -0
  76. package/docs/icons/icon-api.dsds.yaml +17 -0
  77. package/docs/icons/icon-archive.dsds.yaml +44 -0
  78. package/docs/icons/icon-arrow-down.dsds.yaml +38 -0
  79. package/docs/icons/icon-arrow-left.dsds.yaml +32 -0
  80. package/docs/icons/icon-arrow-right.dsds.yaml +32 -0
  81. package/docs/icons/icon-arrow-top-right.dsds.yaml +32 -0
  82. package/docs/icons/icon-arrow-up.dsds.yaml +44 -0
  83. package/docs/icons/icon-asterisk.dsds.yaml +18 -0
  84. package/docs/icons/icon-bar-chart.dsds.yaml +40 -0
  85. package/docs/icons/icon-basket.dsds.yaml +14 -0
  86. package/docs/icons/icon-bell.dsds.yaml +30 -0
  87. package/docs/icons/icon-bill.dsds.yaml +40 -0
  88. package/docs/icons/icon-binary-document.dsds.yaml +30 -0
  89. package/docs/icons/icon-block-content.dsds.yaml +30 -0
  90. package/docs/icons/icon-block-element.dsds.yaml +32 -0
  91. package/docs/icons/icon-blockquote.dsds.yaml +32 -0
  92. package/docs/icons/icon-bold.dsds.yaml +28 -0
  93. package/docs/icons/icon-bolt.dsds.yaml +18 -0
  94. package/docs/icons/icon-book.dsds.yaml +34 -0
  95. package/docs/icons/icon-bookmark-filled.dsds.yaml +14 -0
  96. package/docs/icons/icon-bookmark.dsds.yaml +14 -0
  97. package/docs/icons/icon-bottle.dsds.yaml +18 -0
  98. package/docs/icons/icon-bug.dsds.yaml +28 -0
  99. package/docs/icons/icon-bulb-filled.dsds.yaml +14 -0
  100. package/docs/icons/icon-bulb-outline.dsds.yaml +30 -0
  101. package/docs/icons/icon-calendar.dsds.yaml +36 -0
  102. package/docs/icons/icon-case.dsds.yaml +18 -0
  103. package/docs/icons/icon-chart-upward.dsds.yaml +40 -0
  104. package/docs/icons/icon-checkmark-circle.dsds.yaml +40 -0
  105. package/docs/icons/icon-checkmark.dsds.yaml +36 -0
  106. package/docs/icons/icon-chevron-down.dsds.yaml +46 -0
  107. package/docs/icons/icon-chevron-left.dsds.yaml +42 -0
  108. package/docs/icons/icon-chevron-right.dsds.yaml +42 -0
  109. package/docs/icons/icon-chevron-up.dsds.yaml +44 -0
  110. package/docs/icons/icon-circle.dsds.yaml +28 -0
  111. package/docs/icons/icon-clipboard-image.dsds.yaml +30 -0
  112. package/docs/icons/icon-clipboard.dsds.yaml +34 -0
  113. package/docs/icons/icon-clock.dsds.yaml +39 -0
  114. package/docs/icons/icon-close-circle.dsds.yaml +18 -0
  115. package/docs/icons/icon-close.dsds.yaml +51 -0
  116. package/docs/icons/icon-code-block.dsds.yaml +38 -0
  117. package/docs/icons/icon-code.dsds.yaml +40 -0
  118. package/docs/icons/icon-cog.dsds.yaml +38 -0
  119. package/docs/icons/icon-collapse.dsds.yaml +40 -0
  120. package/docs/icons/icon-color-wheel.dsds.yaml +30 -0
  121. package/docs/icons/icon-comment.dsds.yaml +38 -0
  122. package/docs/icons/icon-component.dsds.yaml +18 -0
  123. package/docs/icons/icon-compose-sparkles.dsds.yaml +36 -0
  124. package/docs/icons/icon-compose.dsds.yaml +38 -0
  125. package/docs/icons/icon-confetti.dsds.yaml +18 -0
  126. package/docs/icons/icon-controls.dsds.yaml +36 -0
  127. package/docs/icons/icon-copy.dsds.yaml +31 -0
  128. package/docs/icons/icon-credit-card.dsds.yaml +18 -0
  129. package/docs/icons/icon-crop.dsds.yaml +32 -0
  130. package/docs/icons/icon-cube.dsds.yaml +36 -0
  131. package/docs/icons/icon-dashboard.dsds.yaml +34 -0
  132. package/docs/icons/icon-database.dsds.yaml +40 -0
  133. package/docs/icons/icon-desktop.dsds.yaml +31 -0
  134. package/docs/icons/icon-diamond.dsds.yaml +18 -0
  135. package/docs/icons/icon-document-pdf.dsds.yaml +34 -0
  136. package/docs/icons/icon-document-remove.dsds.yaml +30 -0
  137. package/docs/icons/icon-document-sheet.dsds.yaml +34 -0
  138. package/docs/icons/icon-document-text.dsds.yaml +30 -0
  139. package/docs/icons/icon-document-video.dsds.yaml +30 -0
  140. package/docs/icons/icon-document-word.dsds.yaml +34 -0
  141. package/docs/icons/icon-document-zip.dsds.yaml +30 -0
  142. package/docs/icons/icon-document.dsds.yaml +52 -0
  143. package/docs/icons/icon-documents.dsds.yaml +30 -0
  144. package/docs/icons/icon-dot.dsds.yaml +32 -0
  145. package/docs/icons/icon-double-chevron-down.dsds.yaml +38 -0
  146. package/docs/icons/icon-double-chevron-left.dsds.yaml +34 -0
  147. package/docs/icons/icon-double-chevron-right.dsds.yaml +34 -0
  148. package/docs/icons/icon-double-chevron-up.dsds.yaml +36 -0
  149. package/docs/icons/icon-double-quote.dsds.yaml +14 -0
  150. package/docs/icons/icon-download.dsds.yaml +40 -0
  151. package/docs/icons/icon-drag-handle.dsds.yaml +28 -0
  152. package/docs/icons/icon-drop.dsds.yaml +30 -0
  153. package/docs/icons/icon-earth-americas.dsds.yaml +34 -0
  154. package/docs/icons/icon-earth-globe.dsds.yaml +34 -0
  155. package/docs/icons/icon-edit.dsds.yaml +34 -0
  156. package/docs/icons/icon-ellipsis-horizontal.dsds.yaml +32 -0
  157. package/docs/icons/icon-ellipsis-vertical.dsds.yaml +14 -0
  158. package/docs/icons/icon-empty.dsds.yaml +28 -0
  159. package/docs/icons/icon-enter-right.dsds.yaml +18 -0
  160. package/docs/icons/icon-enter.dsds.yaml +18 -0
  161. package/docs/icons/icon-envelope.dsds.yaml +34 -0
  162. package/docs/icons/icon-equal.dsds.yaml +14 -0
  163. package/docs/icons/icon-error-filled.dsds.yaml +14 -0
  164. package/docs/icons/icon-error-outline.dsds.yaml +38 -0
  165. package/docs/icons/icon-error-screen.dsds.yaml +14 -0
  166. package/docs/icons/icon-expand.dsds.yaml +36 -0
  167. package/docs/icons/icon-eye-closed.dsds.yaml +38 -0
  168. package/docs/icons/icon-eye-open.dsds.yaml +38 -0
  169. package/docs/icons/icon-face-happy.dsds.yaml +14 -0
  170. package/docs/icons/icon-face-indifferent.dsds.yaml +14 -0
  171. package/docs/icons/icon-face-sad.dsds.yaml +14 -0
  172. package/docs/icons/icon-feedback.dsds.yaml +30 -0
  173. package/docs/icons/icon-filter.dsds.yaml +38 -0
  174. package/docs/icons/icon-folder.dsds.yaml +36 -0
  175. package/docs/icons/icon-generate.dsds.yaml +18 -0
  176. package/docs/icons/icon-github.dsds.yaml +14 -0
  177. package/docs/icons/icon-groq.dsds.yaml +31 -0
  178. package/docs/icons/icon-hash.dsds.yaml +18 -0
  179. package/docs/icons/icon-heart-filled.dsds.yaml +18 -0
  180. package/docs/icons/icon-heart.dsds.yaml +18 -0
  181. package/docs/icons/icon-help-circle.dsds.yaml +38 -0
  182. package/docs/icons/icon-highlight.dsds.yaml +18 -0
  183. package/docs/icons/icon-home.dsds.yaml +28 -0
  184. package/docs/icons/icon-ice-cream.dsds.yaml +18 -0
  185. package/docs/icons/icon-image-remove.dsds.yaml +32 -0
  186. package/docs/icons/icon-image.dsds.yaml +36 -0
  187. package/docs/icons/icon-images.dsds.yaml +34 -0
  188. package/docs/icons/icon-inbox.dsds.yaml +14 -0
  189. package/docs/icons/icon-info-filled.dsds.yaml +14 -0
  190. package/docs/icons/icon-info-outline.dsds.yaml +38 -0
  191. package/docs/icons/icon-inline-element.dsds.yaml +32 -0
  192. package/docs/icons/icon-inline.dsds.yaml +18 -0
  193. package/docs/icons/icon-insert-above.dsds.yaml +32 -0
  194. package/docs/icons/icon-insert-below.dsds.yaml +32 -0
  195. package/docs/icons/icon-italic.dsds.yaml +28 -0
  196. package/docs/icons/icon-joystick.dsds.yaml +18 -0
  197. package/docs/icons/icon-json.dsds.yaml +36 -0
  198. package/docs/icons/icon-launch.dsds.yaml +34 -0
  199. package/docs/icons/icon-leave.dsds.yaml +35 -0
  200. package/docs/icons/icon-lemon.dsds.yaml +18 -0
  201. package/docs/icons/icon-link-removed.dsds.yaml +30 -0
  202. package/docs/icons/icon-link.dsds.yaml +36 -0
  203. package/docs/icons/icon-linkedin.dsds.yaml +14 -0
  204. package/docs/icons/icon-list.dsds.yaml +14 -0
  205. package/docs/icons/icon-lock.dsds.yaml +39 -0
  206. package/docs/icons/icon-logo-js.dsds.yaml +18 -0
  207. package/docs/icons/icon-logo-ts.dsds.yaml +18 -0
  208. package/docs/icons/icon-marker-removed.dsds.yaml +14 -0
  209. package/docs/icons/icon-marker.dsds.yaml +14 -0
  210. package/docs/icons/icon-master-detail.dsds.yaml +28 -0
  211. package/docs/icons/icon-menu.dsds.yaml +40 -0
  212. package/docs/icons/icon-microphone-slash.dsds.yaml +14 -0
  213. package/docs/icons/icon-microphone.dsds.yaml +14 -0
  214. package/docs/icons/icon-mobile-device.dsds.yaml +32 -0
  215. package/docs/icons/icon-moon.dsds.yaml +30 -0
  216. package/docs/icons/icon-number.dsds.yaml +30 -0
  217. package/docs/icons/icon-ok-hand.dsds.yaml +18 -0
  218. package/docs/icons/icon-olist.dsds.yaml +36 -0
  219. package/docs/icons/icon-overage.dsds.yaml +42 -0
  220. package/docs/icons/icon-package.dsds.yaml +34 -0
  221. package/docs/icons/icon-panel-left.dsds.yaml +38 -0
  222. package/docs/icons/icon-panel-right.dsds.yaml +40 -0
  223. package/docs/icons/icon-pause.dsds.yaml +32 -0
  224. package/docs/icons/icon-pin-filled.dsds.yaml +28 -0
  225. package/docs/icons/icon-pin-removed.dsds.yaml +14 -0
  226. package/docs/icons/icon-pin.dsds.yaml +32 -0
  227. package/docs/icons/icon-play.dsds.yaml +32 -0
  228. package/docs/icons/icon-plug.dsds.yaml +35 -0
  229. package/docs/icons/icon-presentation.dsds.yaml +18 -0
  230. package/docs/icons/icon-progress50.dsds.yaml +14 -0
  231. package/docs/icons/icon-progress75.dsds.yaml +14 -0
  232. package/docs/icons/icon-projects.dsds.yaml +14 -0
  233. package/docs/icons/icon-publish.dsds.yaml +38 -0
  234. package/docs/icons/icon-read-only.dsds.yaml +36 -0
  235. package/docs/icons/icon-redo.dsds.yaml +38 -0
  236. package/docs/icons/icon-refresh.dsds.yaml +38 -0
  237. package/docs/icons/icon-remove-circle.dsds.yaml +14 -0
  238. package/docs/icons/icon-remove.dsds.yaml +30 -0
  239. package/docs/icons/icon-reset.dsds.yaml +40 -0
  240. package/docs/icons/icon-restore.dsds.yaml +45 -0
  241. package/docs/icons/icon-retrieve.dsds.yaml +14 -0
  242. package/docs/icons/icon-retry.dsds.yaml +14 -0
  243. package/docs/icons/icon-revert.dsds.yaml +14 -0
  244. package/docs/icons/icon-robot.dsds.yaml +17 -0
  245. package/docs/icons/icon-rocket.dsds.yaml +34 -0
  246. package/docs/icons/icon-schema.dsds.yaml +36 -0
  247. package/docs/icons/icon-search.dsds.yaml +34 -0
  248. package/docs/icons/icon-select.dsds.yaml +38 -0
  249. package/docs/icons/icon-share.dsds.yaml +36 -0
  250. package/docs/icons/icon-sort.dsds.yaml +40 -0
  251. package/docs/icons/icon-sparkle.dsds.yaml +26 -0
  252. package/docs/icons/icon-sparkles.dsds.yaml +34 -0
  253. package/docs/icons/icon-spinner.dsds.yaml +38 -0
  254. package/docs/icons/icon-split-horizontal.dsds.yaml +32 -0
  255. package/docs/icons/icon-split-vertical.dsds.yaml +30 -0
  256. package/docs/icons/icon-square.dsds.yaml +18 -0
  257. package/docs/icons/icon-stack-compact.dsds.yaml +30 -0
  258. package/docs/icons/icon-stack.dsds.yaml +44 -0
  259. package/docs/icons/icon-star-filled.dsds.yaml +48 -0
  260. package/docs/icons/icon-star.dsds.yaml +51 -0
  261. package/docs/icons/icon-stop.dsds.yaml +32 -0
  262. package/docs/icons/icon-strikethrough.dsds.yaml +28 -0
  263. package/docs/icons/icon-string.dsds.yaml +38 -0
  264. package/docs/icons/icon-sun.dsds.yaml +30 -0
  265. package/docs/icons/icon-sync.dsds.yaml +36 -0
  266. package/docs/icons/icon-tablet-device.dsds.yaml +30 -0
  267. package/docs/icons/icon-tag.dsds.yaml +32 -0
  268. package/docs/icons/icon-tags.dsds.yaml +36 -0
  269. package/docs/icons/icon-target.dsds.yaml +14 -0
  270. package/docs/icons/icon-task.dsds.yaml +30 -0
  271. package/docs/icons/icon-terminal.dsds.yaml +30 -0
  272. package/docs/icons/icon-text.dsds.yaml +32 -0
  273. package/docs/icons/icon-th-large.dsds.yaml +34 -0
  274. package/docs/icons/icon-th-list.dsds.yaml +30 -0
  275. package/docs/icons/icon-thumbs-down.dsds.yaml +27 -0
  276. package/docs/icons/icon-thumbs-up.dsds.yaml +30 -0
  277. package/docs/icons/icon-tiers.dsds.yaml +18 -0
  278. package/docs/icons/icon-timeline.dsds.yaml +32 -0
  279. package/docs/icons/icon-toggle-arrow-right.dsds.yaml +39 -0
  280. package/docs/icons/icon-token.dsds.yaml +30 -0
  281. package/docs/icons/icon-transfer.dsds.yaml +32 -0
  282. package/docs/icons/icon-translate.dsds.yaml +32 -0
  283. package/docs/icons/icon-trash.dsds.yaml +34 -0
  284. package/docs/icons/icon-trend-upward.dsds.yaml +42 -0
  285. package/docs/icons/icon-triangle-outline.dsds.yaml +18 -0
  286. package/docs/icons/icon-trolley.dsds.yaml +18 -0
  287. package/docs/icons/icon-truncate.dsds.yaml +18 -0
  288. package/docs/icons/icon-twitter.dsds.yaml +18 -0
  289. package/docs/icons/icon-ulist.dsds.yaml +36 -0
  290. package/docs/icons/icon-unarchive.dsds.yaml +32 -0
  291. package/docs/icons/icon-underline.dsds.yaml +28 -0
  292. package/docs/icons/icon-undo.dsds.yaml +34 -0
  293. package/docs/icons/icon-unknown.dsds.yaml +36 -0
  294. package/docs/icons/icon-unlink.dsds.yaml +32 -0
  295. package/docs/icons/icon-unlock.dsds.yaml +41 -0
  296. package/docs/icons/icon-unpublish.dsds.yaml +38 -0
  297. package/docs/icons/icon-upload.dsds.yaml +40 -0
  298. package/docs/icons/icon-user.dsds.yaml +34 -0
  299. package/docs/icons/icon-users.dsds.yaml +34 -0
  300. package/docs/icons/icon-versions.dsds.yaml +14 -0
  301. package/docs/icons/icon-video.dsds.yaml +32 -0
  302. package/docs/icons/icon-warning-filled.dsds.yaml +14 -0
  303. package/docs/icons/icon-warning-outline.dsds.yaml +38 -0
  304. package/docs/icons/icon-wrench.dsds.yaml +18 -0
  305. package/docs/icons.dsds.yaml +768 -0
  306. package/docs/index.dsds.yaml +506 -0
  307. package/docs/overview/api-essentials.dsds.yaml +221 -0
  308. package/docs/overview/component-reference.dsds.yaml +213 -0
  309. package/docs/overview/installation.dsds.yaml +254 -0
  310. package/docs/overview/quick-start.dsds.yaml +317 -0
  311. package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
  312. package/docs/patterns/error-messaging.dsds.yaml +58 -0
  313. package/docs/patterns/forms.dsds.yaml +362 -0
  314. package/docs/patterns/layouts.dsds.yaml +403 -0
  315. package/docs/patterns/loading-states.dsds.yaml +41 -0
  316. package/docs/patterns/messaging.dsds.yaml +72 -0
  317. package/docs/patterns/navigation.dsds.yaml +153 -0
  318. package/docs/patterns/responsive.dsds.yaml +590 -0
  319. package/docs/tokens/color.dsds.yaml +1158 -0
  320. package/docs/tokens/container-widths.dsds.yaml +131 -0
  321. package/docs/tokens/content.dsds.yaml +258 -0
  322. package/docs/tokens/content.tokens.json +180 -0
  323. package/docs/tokens/dtcg/README.md +41 -0
  324. package/docs/tokens/dtcg/css/color.css +107 -0
  325. package/docs/tokens/dtcg/css/container.css +12 -0
  326. package/docs/tokens/dtcg/css/fontFamily.css +10 -0
  327. package/docs/tokens/dtcg/css/fontWeight.css +10 -0
  328. package/docs/tokens/dtcg/css/index.css +12 -0
  329. package/docs/tokens/dtcg/css/radius.css +14 -0
  330. package/docs/tokens/dtcg/css/semantic.css +42 -0
  331. package/docs/tokens/dtcg/css/shadow.css +22 -0
  332. package/docs/tokens/dtcg/css/space.css +16 -0
  333. package/docs/tokens/dtcg/css/typography.css +67 -0
  334. package/docs/tokens/dtcg/json/color.tokens.json +911 -0
  335. package/docs/tokens/dtcg/json/container.tokens.json +44 -0
  336. package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
  337. package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
  338. package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
  339. package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
  340. package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
  341. package/docs/tokens/dtcg/json/space.tokens.json +72 -0
  342. package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
  343. package/docs/tokens/font-family.dsds.yaml +79 -0
  344. package/docs/tokens/font-weight.dsds.yaml +103 -0
  345. package/docs/tokens/radius.dsds.yaml +153 -0
  346. package/docs/tokens/semantic.dsds.yaml +397 -0
  347. package/docs/tokens/shadow.dsds.yaml +125 -0
  348. package/docs/tokens/space.dsds.yaml +185 -0
  349. package/docs/tokens/typography.dsds.yaml +316 -0
  350. package/llms.txt +108 -0
  351. package/package.json +6 -3
  352. package/skills/sanity-ui-5/SKILL.md +158 -0
  353. package/skills/sanity-ui-5/references/component-choice.md +37 -0
  354. package/skills/sanity-ui-5/references/components.md +145 -0
  355. package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
  356. package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
  357. package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
  358. package/skills/sanity-ui-5/references/setup.md +177 -0
  359. package/skills/sanity-ui-5/references/silent-failures.md +33 -0
  360. package/skills/sanity-ui-5/references/taste.md +53 -0
  361. package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
  362. package/src/components/button/Button.tsx +14 -3
  363. package/src/components/button/button.css +23 -25
  364. package/src/components/button/button.props.ts +4 -0
  365. package/src/components/code/code.props.ts +3 -2
  366. package/src/components/eyebrow/Eyebrow.tsx +8 -3
  367. package/src/components/eyebrow/eyebrow.props.ts +10 -2
  368. package/src/components/heading/Heading.tsx +1 -1
  369. package/src/components/heading/heading.props.ts +4 -3
  370. package/src/components/popover/Popover.tsx +4 -3
  371. package/src/components/popover/popover.css +5 -3
  372. package/src/components/popover/popover.props.ts +9 -0
  373. package/src/components/text/text.props.ts +6 -1
  374. package/src/css/classes/system/typography.css +6 -6
  375. package/src/css/tokens/semantic.css +7 -7
  376. package/src/props/typography.ts +1 -5
  377. package/src/version.ts +2 -2
@@ -0,0 +1,145 @@
1
+ # Components and patterns
2
+
3
+ Read this file when you choose a component, check whether it exists, or look for starter code.
4
+
5
+ ## Contents
6
+
7
+ - How to check a component before you use it
8
+ - What exists in alpha.20
9
+ - Not exported yet
10
+ - Which component for which job
11
+ - Constraints that bite
12
+ - Patterns: where to find them
13
+
14
+ ## How to check a component before you use it
15
+
16
+ 1. Check its status in the table below, or in `docs/overview/component-reference.dsds.yaml`.
17
+ 2. Check the export with the listing in `setup.md`. An unexported import is a build error.
18
+ 3. Read its constraints in `docs/components/<id>.dsds.yaml`.
19
+
20
+ Status values:
21
+
22
+ | Status | Meaning |
23
+ | ------------ | -------------------------------------------------------------------------- |
24
+ | stable | Exported and ready |
25
+ | beta | Exported and ready. The API may change before 5.0 |
26
+ | experimental | Exported, marked `@alpha` in the source. The API can change without notice |
27
+ | deprecated | Exported. Do not use it in new code |
28
+ | unavailable | Not exported. Importing it is a build error |
29
+
30
+ ## What exists in alpha.20
31
+
32
+ These 41 components are exported, plus the hook `useIsClient`.
33
+
34
+ | Group | Component | Status | Use it for |
35
+ | ----------- | -------------- | ------------ | ------------------------------------------------------------------------------------------- |
36
+ | Layout | Box | stable | Spacing, borders, scroll containers, landmarks |
37
+ | | Flex | stable | Row or column layout with alignment and gap |
38
+ | | Grid | stable | CSS grid with named props |
39
+ | | Container | stable | Max width and centering for content |
40
+ | | Card | stable | A surface with background, border, and tone |
41
+ | | HStack | stable | A simple row with a gap. It wraps by default |
42
+ | | VStack | stable | A simple column with a gap |
43
+ | | Divider | stable | A horizontal rule between sections |
44
+ | | Inline | deprecated | Use HStack instead |
45
+ | Text | Text | stable | Body text, captions, metadata |
46
+ | | Heading | stable | Headings. Set `as` every time |
47
+ | | Eyebrow | stable | Small uppercase text above a title |
48
+ | | Code | stable | Inline code and code blocks |
49
+ | | KBD | experimental | One keyboard key |
50
+ | | Hotkeys | experimental | A multi-key shortcut |
51
+ | | Icon | stable | A sized, tonable icon from `@sanity/icons` |
52
+ | | VisuallyHidden | stable | Text for assistive technology only |
53
+ | Actions | Button | beta | Actions, with a text label |
54
+ | | IconButton | beta | Actions with only an icon |
55
+ | | PressArea | beta | Makes a non-interactive surface a press target |
56
+ | | Link | beta | Navigation to a URL or fragment |
57
+ | | SkipToContent | beta | A skip link for keyboard users |
58
+ | Input | TextInput | beta | One line of text |
59
+ | | TextArea | beta | Multi-line text |
60
+ | | Select | beta | One choice from 5 to 20 options |
61
+ | | Radio | beta | One choice from 2 to 4 options |
62
+ | | Checkbox | beta | One or several independent choices |
63
+ | | Switch | beta | A binary setting that takes effect at once |
64
+ | Information | Badge | beta | A short status or category label |
65
+ | | Avatar | beta | A person or agent |
66
+ | | AvatarStack | beta | A group of avatars |
67
+ | | AvatarCounter | beta | A count for hidden avatars |
68
+ | | Indicator | beta | A status dot |
69
+ | | IndicatorStack | stable | Two or more adjacent status dots |
70
+ | | List | beta | Structured rows. Includes `List.Item`, `List.ItemText`, `List.ItemImage`, `List.ButtonItem` |
71
+ | Disclosure | Popover | beta | Secondary content on press |
72
+ | | Tooltip | beta | A text label on hover or focus |
73
+ | | TooltipGroup | beta | Wraps a toolbar of tooltips |
74
+ | | Dialog | beta | A blocking task or decision |
75
+ | | Tabs | beta | Switching between related sections. Includes `Tabs.List`, `Tabs.Tab`, `Tabs.Panel` |
76
+ | Feedback | Spinner | beta | A loading indicator, with a text label |
77
+
78
+ Statuses come from the documentation. Confirm each export with the listing in `setup.md`.
79
+
80
+ ## Not exported yet
81
+
82
+ Do not import these. Each import fails the build. Their docs sit in `drafts/` and describe a future API.
83
+
84
+ - Autocomplete
85
+ - Menu, MenuButton, MenuGroup, MenuItem
86
+ - SegmentedControl
87
+ - Skeleton
88
+ - Toast
89
+ - Label (v5 has no Label. Use `Text as="label"`, and `Eyebrow` for small uppercase text)
90
+ - Image
91
+
92
+ When you need one of these, build a stand-in from components that exist, and tell the user. Check the export listing again later, since the set grows.
93
+
94
+ ## Which component for which job
95
+
96
+ | Need | Use | Not |
97
+ | ------------------------------------------ | -------------------------------------------------- | -------------------------------- |
98
+ | Spacing, border, or a scroll area | Box | Card |
99
+ | A toolbar, sidebar, or nav header | Box or Flex | Card |
100
+ | Content with a background and border | Card | Box with a custom background |
101
+ | Simple column or row with a gap | VStack or HStack | Flex with defaults |
102
+ | A column that grows, scrolls, or wraps | Flex | VStack |
103
+ | Icon with text | Button with `iconStart` | Icon inside a Button |
104
+ | Icon alone | IconButton | Button with no text |
105
+ | Make a card or row clickable | PressArea around the content, or `List.ButtonItem` | `onClick` on Card or Box |
106
+ | Move to a URL | Link, or `as="a"` on a row | Button with a navigation handler |
107
+ | Run an action | Button | Link |
108
+ | Hover or focus hint, text only | Tooltip | Popover |
109
+ | Interactive floating content | Popover | Tooltip |
110
+ | Blocking decision | Dialog | Popover |
111
+ | Page title and section titles | Heading with `as` | Text with a large size |
112
+ | Large number or display text | Text with a large `size` | Heading |
113
+ | Two to four options | Radio | Select |
114
+ | Five to 20 options | Select | Radio |
115
+ | Independent options, or a deferred setting | Checkbox | Switch |
116
+ | A setting that applies immediately | Switch | Checkbox plus a Save button |
117
+
118
+ ## Constraints that bite
119
+
120
+ Read `docs/components/<id>.dsds.yaml` for the full set. These are the ones that cause the most rework.
121
+
122
+ - **Button.** Use it with a text label. Use `IconButton` for icon-only actions. Do not place a Tooltip on a disabled button. Do not disable a submit button to block an incomplete form. Allow submission and show feedback.
123
+ - **IconButton.** `icon` and `aria-label` are both required. Do not use it in a Dialog or a decision prompt. Use a Button with a visible label.
124
+ - **Tooltip.** It wraps one child, and the child must be a button, a link, or a `PressArea`. It needs the polyfills import. It must not hold links or buttons. It names nothing: `content` becomes the description, not the name.
125
+ - **Popover.** It has no `open`, `onOpen`, or `onClose` prop. Its trigger opens it, and the browser closes it on Escape or an outside click. Do not mirror its state in React state. Open it on press, not on hover. Show one at a time.
126
+ - **Dialog.** Give it an accessible name through `header` or `aria-label`. Make it dismissible. Name the action and its target in a destructive title, such as "Delete Annual report?". It needs the polyfills import.
127
+ - **Tabs.** It is controlled: pass `value` and `onValueChange`. Each tab and panel takes the same `value`, and each value is unique in one `Tabs`. Do not render `Tabs.Tab` or `Tabs.Panel` outside `Tabs`. Do not nest tabs.
128
+ - **Select.** Pass `option` and `optgroup` elements as children. Do not draw your own arrow.
129
+ - **TextInput.** Use `hasError` for the error style. It sets `aria-invalid` and renders no message. Do not set `aria-invalid` by hand. Do not set `type` to a non-text type such as `checkbox` or `file`. Do not stack more than two inputs in a row.
130
+ - **List.** It has no `density` prop. Set `density` on each item. `List.Item` always renders `<li>`. Provide `alt` on every `List.ItemImage`. Keep one interactive element in a row's start or end slot.
131
+ - **PressArea.** It renders a real `<button>` or `<a>`. Never use it as a backdrop or layout wrapper. Never pass `as="div"`. Do not style it. Put padding and background on the child. Do not nest interactive elements inside it.
132
+ - **Heading.** `as` takes `h1` to `h6` only. Use Heading for real headings, not for large text.
133
+ - **Text.** Do not use it for headings. Do not give it a non-neutral tone unless it leads with the state or sits beside a matching icon. Keep multi-line paragraphs start-aligned. Keep 4.5:1 contrast.
134
+ - **Icon.** An icon with meaning on its own needs `aria-label`. A decorative icon needs nothing, because it hides itself when it has no `aria-label`. Never put an Icon inside an interactive element.
135
+ - **Badge.** Do not use it for actions or put emoji in it. Lead a toned badge's text with the state, or add `iconStart`.
136
+ - **Avatar.** `name` is required. There is no `initials` prop. Do not size it with `style`.
137
+ - **Spinner.** Pair it with a visible text label. It has no `tone` or `muted`. Set the container's `aria-busy`. Skip it for tasks under 200ms.
138
+ - **HStack.** It accepts only `as` and `gap`. It wraps by default. Use Flex for a row that must stay on one line.
139
+ - **Indicator.** Give it a `label` when it is the only status signal. Use `IndicatorStack` for adjacent dots.
140
+ - **Link.** Do not use it to run a side effect. Use `openInNewTab` instead of setting `target` by hand.
141
+ - **VisuallyHidden.** Do not put a button or link inside it. Do not use it to hide content you will show later.
142
+
143
+ ## Patterns
144
+
145
+ Patterns cover the layouts and interactions that span components. They are in `docs/patterns/`. Read the pattern that matches the task before you build the layout from primitives. The patterns name the accessibility requirements that cause most failures.
@@ -0,0 +1,189 @@
1
+ # Forms and accessibility
2
+
3
+ Read this file before you build a form, an error state, or any interactive UI. WCAG 2.2 AA is a hard requirement. Build it in from the start.
4
+
5
+ ## Contents
6
+
7
+ - Choose the control
8
+ - Name every field
9
+ - Controlled state
10
+ - Error states
11
+ - Form copy
12
+ - Groups
13
+ - Interactive UI
14
+ - Page structure and reflow
15
+ - Tone and color
16
+ - Check your work
17
+
18
+ ## Choose the control
19
+
20
+ | User task | Control |
21
+ | ----------------------------------- | ------------------------------- |
22
+ | One of 2 to 4 options | Radio |
23
+ | One of 5 to 20 options | Select |
24
+ | One of more than 20 options | TextInput with a search pattern |
25
+ | Several options at once | Checkbox |
26
+ | A setting that takes effect at once | Switch |
27
+ | A setting submitted with a form | Checkbox, not Switch |
28
+
29
+ A Switch commits on `onChange`. Do not add a Save button beside it, and do not pair it with a confirm button.
30
+
31
+ ## Name every field
32
+
33
+ Every field needs a visible label and an accessible name. Checkbox, Radio, and Switch render no label of their own, and they have no `label` prop. Passing one is a type error. Name them in one of these ways, in this order of preference:
34
+
35
+ 1. A visible label element linked with `id` and `htmlFor`.
36
+ 2. A descriptive label wrapped in `VisuallyHidden`, when the visible text would repeat across rows.
37
+ 3. `aria-labelledby`, when the text already exists elsewhere in the DOM.
38
+ 4. `aria-label`, when none of the above fits. Include the visible text in it. Voice-control users can then target the control.
39
+
40
+ ```tsx
41
+ <VStack gap={2}>
42
+ <Text as="label" htmlFor="project" size={1} weight="medium">
43
+ Project name
44
+ </Text>
45
+ <TextInput id="project" />
46
+ </VStack>
47
+
48
+ <Flex alignItems="center" gap={2}>
49
+ <Checkbox id="terms" />
50
+ <Text as="label" htmlFor="terms" size={1}>
51
+ Accept the terms
52
+ </Text>
53
+ </Flex>
54
+
55
+ {/* A row checkbox in a table: the label is hidden, the name stays descriptive */}
56
+ <Checkbox id={`select-${doc.id}`} />
57
+ <VisuallyHidden as="label" htmlFor={`select-${doc.id}`}>
58
+ Select {doc.title}
59
+ </VisuallyHidden>
60
+ ```
61
+
62
+ Rules:
63
+
64
+ - Do not use a placeholder as the label. It disappears when the user types, and screen readers do not announce it reliably.
65
+ - Do not nest one label element inside another.
66
+ - Do not skip the link between label and input. A label with no `htmlFor` and no wrapping does not name the input.
67
+ - An input with no accessible name is a critical axe violation.
68
+ - Mark optional fields in the label, as in `Phone number (optional)`. Do not mark required fields. If most fields are optional, mark the required ones and use one convention across the form.
69
+
70
+ ## Controlled state
71
+
72
+ - Pair `checked` with `onChange` on every controlled Checkbox, Radio, and Switch. Without `onChange`, the control looks live and never updates.
73
+ - Do not set both `checked` and `defaultChecked` on one control.
74
+ - Radios in one group share a `name`. Neither Radio nor Sanity UI groups them for you.
75
+ - Lay out checkbox and radio groups vertically. Stack fields vertically as well. Place fields side by side only for a small group of related fields.
76
+
77
+ ## Error states
78
+
79
+ `hasError` sets the error style and `aria-invalid`. It renders no message. Add the message and link it with `aria-describedby`.
80
+
81
+ ```tsx
82
+ <VStack gap={2}>
83
+ <Text as="label" htmlFor="email" size={1} weight="medium">
84
+ Email address
85
+ </Text>
86
+ <TextInput id="email" hasError aria-describedby="email-error" value={value} onChange={onChange} />
87
+ <Text id="email-error" size={1} tone="critical">
88
+ Error: Enter a valid email address.
89
+ </Text>
90
+ </VStack>
91
+ ```
92
+
93
+ - Show a visible message near the field whenever `hasError` is set.
94
+ - Do not set `aria-invalid` by hand. The input writes it from `hasError`.
95
+ - Never disable an input in an error state. A disabled field cannot take focus. The user cannot reach it to fix the problem.
96
+ - Radio has no error prop. Show a message near the group and link it with `aria-describedby`.
97
+ - A disabled input needs helper text that says why it is off and what turns it on.
98
+ - A top-of-form error summary names the total, such as "3 fields need attention.", and links to the first error. Do not repeat every error in it.
99
+
100
+ ## Form copy
101
+
102
+ - Labels are noun phrases in sentence case, one to three words, with no trailing colon or period: `Phone number`, not `Enter your phone number`.
103
+ - A label is not a question, an instruction, or a request.
104
+ - A placeholder shows an example, such as `ex: Jane Cooper` or `(555) 123-4567`. Keep it short. Do not put format rules in it. Put format hints in helper text, which stays visible.
105
+ - Helper text is a complete sentence ending in a period. Keep it under 60 characters when you can. Skip it when it repeats the label or placeholder.
106
+ - Error text names what failed and states the next step. Keep it factual. Do not apologize and do not blame: write `Email address is missing an @ symbol. Use the format name@example.com.`
107
+ - Success text states what happened: `Project created.`, not `Success!`
108
+ - Button labels describe the action: `Save changes`, `Send invitation`, `Create project`. Avoid `Submit`, `OK`, and `Done`. A destructive confirmation repeats the action: `Delete project`, not `Confirm`.
109
+ - Do not mix `Cancel`, `Back`, and `Close` on one control. Cancel abandons a change. Back returns to a step. Close dismisses.
110
+ - Do not use emojis. Use an `Icon`.
111
+
112
+ ## Groups
113
+
114
+ Wrap checkbox and radio groups in a `fieldset` with a `legend`. A legend names the group only. Each field still needs its own label. Reset the fieldset's default border, padding, and margin. Put the legend text in a `Text`.
115
+
116
+ ```tsx
117
+ <fieldset style={{border: 0, padding: 0, margin: 0}}>
118
+ <legend>
119
+ <Text size={1} weight="medium">
120
+ Notify me about
121
+ </Text>
122
+ </legend>
123
+ <VStack gap={2}>
124
+ <Flex alignItems="center" gap={2}>
125
+ <Checkbox id="n-comments" />
126
+ <Text as="label" htmlFor="n-comments" size={1}>
127
+ Comments
128
+ </Text>
129
+ </Flex>
130
+ <Flex alignItems="center" gap={2}>
131
+ <Checkbox id="n-mentions" />
132
+ <Text as="label" htmlFor="n-mentions" size={1}>
133
+ Mentions
134
+ </Text>
135
+ </Flex>
136
+ </VStack>
137
+ </fieldset>
138
+ ```
139
+
140
+ The `style` on the native `fieldset` is correct. Sanity UI has no fieldset component.
141
+
142
+ ## Interactive UI
143
+
144
+ - Every icon-only control has an `aria-label` on the control. Describe the action, not the icon: `Delete document`, not `Trash`. A tooltip does not name a control.
145
+ - Do not put a Tooltip on a disabled or loading control. Keyboard users cannot reach it. If the tooltip must show, wrap the element in a `PressArea` and put the Tooltip on that.
146
+ - To keep a button focusable while it blocks an action, use `aria-disabled`, not `disabled`.
147
+ - Set `aria-pressed` on a two-state toggle button. Keep its label the same in every state and name the action, not the state.
148
+ - Do not put `onClick` on Box or Card. Use Button, or wrap the surface in `PressArea`.
149
+ - A row that navigates is a link: `as="a"` and `href`. Middle-click and "Open in new tab" then work.
150
+ - Never nest interactive elements, such as a Button inside a PressArea, or a Button inside a Link.
151
+ - Do not suppress the focus ring. Keep a visible focus indicator.
152
+ - Size touch targets at least 24 by 24 pixels.
153
+ - Use Button for any clickable control. Do not make Badge or Avatar clickable on their own.
154
+
155
+ ```tsx
156
+ <Tooltip content="Delete document">
157
+ <IconButton icon={TrashIcon} aria-label="Delete document" tone="critical" />
158
+ </Tooltip>
159
+ ```
160
+
161
+ Destructive actions use `tone="critical"`, an icon that reads as destructive, and a verb in the label that names what is lost.
162
+
163
+ ## Page structure and reflow
164
+
165
+ - Render one `<main>`. Use `as="main"`, unless an outer shell already provides one.
166
+ - Render shell regions as landmarks: `as="nav"`, `as="main"`, and `as="aside"` for an inspector.
167
+ - Put `SkipToContent` first in the layout, with an `href` that matches the main region's `id`.
168
+ - Use one `<h1>` for the page title. Do not skip heading levels. Set `as` on every Heading.
169
+ - Set `lang` on the `<html>` element.
170
+ - Build tables from native elements: `<table>`, `<thead>`, `<tbody>`, `<tr>`, `<th>`, and `<td>`. Give each a `<caption>`, which may be visually hidden. Do not use `Box as="table"` or simulate a table with Flex or Grid.
171
+ - Layouts must work at 320px with no horizontal scroll. Add `flexWrap="wrap"` to rows of two or more children. Add `minWidth="0"` to flex children that hold text. Use `maxWidth`, not `width`, for sidebars. Do not give a sidebar a fixed `width` with `flexShrink={0}` at every width.
172
+ - Use `truncate` on Text and Heading for clipped text, not custom CSS.
173
+
174
+ ## Tone and color
175
+
176
+ - Use `tone` only for a real state: `positive` for success, `caution` for a warning, `critical` for an error or destructive action, `suggest` for guidance. Everything else stays `neutral`.
177
+ - Tone is one channel. Pair it with words that lead with the state, such as `Error: Process timed out.`, or with an icon. A toned `Text` that only describes the event, such as `Timed out`, needs the icon.
178
+ - Keep text at 4.5:1 contrast and field borders at 3:1.
179
+ - Placeholder text also needs 4.5:1 contrast.
180
+ - Never rely on color alone to carry a state.
181
+
182
+ ## Check your work
183
+
184
+ 1. Run `tsc --noEmit`.
185
+ 2. Read each form component's document in `docs/components/` again, and check its rules against your code.
186
+ 3. Tab through the page. Every control must take focus, show a ring, and work with Enter or Space.
187
+ 4. Resize to 320px wide. Nothing scrolls sideways.
188
+ 5. Switch to dark mode. Nothing disappears.
189
+ 6. If axe is available, run it. Fix every critical violation.
@@ -0,0 +1,250 @@
1
+ # Migrating from Sanity UI 3 to Sanity UI 5
2
+
3
+ Read this file when you port v3 code or compare v3 and v5. It covers v3 against v5 only. Per-component detail lives in each component's `Migrating from Sanity UI 3` section, in `components/<id>.dsds.yaml`. Read `guides/migrating-v3-to-v5.dsds.yaml` for the overview.
4
+
5
+ ## Contents
6
+
7
+ - What changed
8
+ - Before you begin
9
+ - Remove the provider
10
+ - Component map
11
+ - Prop changes by component
12
+ - Manual migrations
13
+ - Codemods
14
+ - Plan the work
15
+
16
+ ## What changed
17
+
18
+ v3 and v5 publish under the same package name, `@sanity/ui`, at different majors. The bare name does not install v5. Install v5 with `@sanity/ui@alpha`.
19
+
20
+ | Area | v3 | v5 |
21
+ | -------------- | --------------------------------------------- | --------------------------------------- |
22
+ | Styling engine | `styled-components`, runtime CSS | Static CSS in one stylesheet |
23
+ | Theming | `ThemeProvider` and a JavaScript theme object | CSS custom properties |
24
+ | Setup | Wrap the app in `ThemeProvider` | Import the polyfills and the stylesheet |
25
+ | Layout styling | `style` for many cases | Layout props that map to design tokens |
26
+ | Class names | Generated | Prefixed with `sui-` |
27
+ | Dark mode | Theme scheme | CSS `light-dark()` |
28
+ | Extending | `styled(Component)` | A `className` and your own CSS |
29
+
30
+ `styled(Box)` and other styled-components extensions of Sanity UI components do not work in v5. Use a `className` and CSS.
31
+
32
+ ## Before you begin
33
+
34
+ - React 19.2 or later.
35
+ - Node `>=20.19 <22` or `>=22.12`.
36
+ - `@sanity/icons` 5.2.1 or later. Icons now come from their own paths: `import {SearchIcon} from '@sanity/icons/Search'`. The v3 and v4 root import no longer gives a usable icon.
37
+ - Set up the entry file as `setup.md` shows. Without the entry imports, v5 renders as plain HTML with no error.
38
+
39
+ ## Remove the provider
40
+
41
+ ```tsx
42
+ // v3
43
+ import {ThemeProvider, studioTheme} from '@sanity/ui'
44
+
45
+ <ThemeProvider theme={studioTheme}>
46
+ <App />
47
+ </ThemeProvider>
48
+
49
+ // v5: no provider. The entry-file imports replace it.
50
+ <App />
51
+ ```
52
+
53
+ v5 has no `ThemeProvider`, no `studioTheme`, and no runtime scheme switch. The codemods do not port theme customization. Rebuild it with CSS custom properties.
54
+
55
+ ## Component map
56
+
57
+ | v3 | v5 | Note |
58
+ | ---------------------------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------ |
59
+ | Box, Flex, Grid, Card, Container | Same names | Many props changed. See the next section |
60
+ | Stack | VStack | Accepts only `as` and `gap` |
61
+ | Inline | HStack | v5 also ships `Inline`, but it is deprecated |
62
+ | Text, Heading, Code | Same names | `textOverflow` and `accent` removed |
63
+ | Label (small uppercase text) | Eyebrow | `accent` and `textOverflow` removed |
64
+ | A separate label element for a form field | `Text as="label"` with `htmlFor` | v5 has no `Label` component |
65
+ | Tab, TabList, TabPanel | Tabs, Tabs.List, Tabs.Tab, Tabs.Panel | The v3 names are not v5 exports |
66
+ | Dialog | Dialog | Different model. Migrate by hand |
67
+ | Popover, Tooltip | Popover, Tooltip | Uncontrolled and CSS-positioned. Migrate by hand |
68
+ | TooltipDelayGroupProvider | TooltipGroup | A rendered element, not a context provider |
69
+ | Badge, Button, Checkbox, Radio, Select, Switch, Spinner, TextArea, TextInput | Same names | Props changed |
70
+ | Avatar, AvatarStack, KBD, Hotkeys | Same names | Exported in alpha.20. KBD and Hotkeys are experimental |
71
+ | Rendering an `@sanity/icons` component directly | `Icon` with `icon={SomeIcon}` | New component |
72
+ | A hand-built skip link | SkipToContent | New |
73
+ | A hand-built clickable surface | PressArea | New |
74
+ | A `Stack` of cards or a custom `ul` | List | New |
75
+ | Styled dots built from Box | Indicator and IndicatorStack | New |
76
+
77
+ New in v5, with no v3 equivalent: Divider, HStack, IconButton, IndicatorStack, Indicator, Link, List, PressArea, SkipToContent, TooltipGroup, VisuallyHidden.
78
+
79
+ No v5 counterpart yet: Autocomplete, Menu and its parts, SegmentedControl, Skeleton, Toast, Breadcrumbs, Tree, and VirtualList. Layering and portal helpers have none either. Build a stand-in from components that exist, and tell the user. List the exports of the installed package (see `setup.md`) to see whether that has changed.
80
+
81
+ ## Prop changes by component
82
+
83
+ An old prop name in v5 is either a type error or a silent no-op. Search for each one.
84
+
85
+ **Box**
86
+
87
+ | v3 | v5 |
88
+ | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
89
+ | `display="flex"` or `"grid"` | Use `Flex` or `Grid`. Box renders `display: block` |
90
+ | `flex={1}` | `flexGrow`, `flexShrink`, `flexBasis` |
91
+ | `height="fill"` or `"stretch"` | `height="100%"` or `"100vh"` |
92
+ | `sizing="border"` | `style={{boxSizing: 'border-box'}}` if needed |
93
+ | `column`, `columnStart`, `columnEnd`, `row`, `rowStart`, `rowEnd` | `gridColumn`, `gridColumnStart`, `gridColumnEnd`, `gridRow`, `gridRowStart`, `gridRowEnd` |
94
+ | Default `margin` of `0` | No default. Add `margin={0}` if you relied on it |
95
+
96
+ **Flex**
97
+
98
+ | v3 | v5 |
99
+ | --------------------------------------- | ----------------------------------------------------------- |
100
+ | `direction`, `align`, `justify`, `wrap` | `flexDirection`, `alignItems`, `justifyContent`, `flexWrap` |
101
+ | `gapX`, `gapY` | `columnGap`, `rowGap` |
102
+ | `flex={1}` | `flexGrow`, `flexShrink`, `flexBasis` |
103
+
104
+ The old names are silent no-ops. A missing `wrap` is the most common cause of 320px reflow failures.
105
+
106
+ **Grid**
107
+
108
+ | v3 | v5 |
109
+ | ---------------------------------------------------------- | ------------------------------------------------------ |
110
+ | `columns={3}` | `gridTemplateColumns="repeat(3, 1fr)"` |
111
+ | `rows={2}` | `gridTemplateRows="repeat(2, 1fr)"` |
112
+ | `autoRows`, `autoCols`, `autoFlow` | `gridAutoRows`, `gridAutoColumns`, `gridAutoFlow` |
113
+ | `gapX`, `gapY` | `columnGap`, `rowGap` |
114
+ | Child props `column`, `row`, and their start and end forms | `gridColumn`, `gridRow`, and their start and end forms |
115
+
116
+ **Card**
117
+
118
+ | v3 | v5 |
119
+ | --------------------------------------------------- | -------------------------------------------------------- |
120
+ | `padding`, `radius` | `density` (`compact`, `regular`, `loose`) |
121
+ | `shadow`, `border`, `borderTop` and the other sides | Removed. Card always has a 1px border, colored by `tone` |
122
+ | `scheme` | Removed |
123
+ | `tone="inherit"` | Removed |
124
+ | `muted`, `pressed`, `selected` | Removed. Card is not interactive |
125
+ | Layout props | Removed. Wrap the Card in a `Box` or `Flex` |
126
+
127
+ **Container**
128
+
129
+ | v3 | v5 |
130
+ | ---------------------- | ----------------------------------------------------------------------- |
131
+ | `width={3}` | `size={3}`. v5 `width` takes a CSS string only |
132
+ | Implicit `width: 100%` | Gone. Container fills a block parent |
133
+ | `width="auto"` | Omit `size` |
134
+ | Scale `1` to `5` | Scale `0` to `5`. A v3 `width={1}` maps to `size={0}`. Audit each value |
135
+
136
+ **Text, Heading, Eyebrow (v3 Label)**
137
+
138
+ | v3 | v5 |
139
+ | ------------------------------- | ------------------------------------------------------------ |
140
+ | `textOverflow="ellipsis"` | `truncate={1}` |
141
+ | `accent` | `tone="suggest"`. On Text, use a parent with a semantic tone |
142
+ | Heading default element `<div>` | `as` is required. There is no default level |
143
+ | Eyebrow default element `<div>` | Default `<span>`. Set `as="div"` to keep a block |
144
+ | Layout props on Eyebrow | Removed. Use a wrapping `Box` |
145
+
146
+ **Stack and Inline**
147
+
148
+ | v3 | v5 |
149
+ | ------------------------------------------------------- | --------------------------------------------------------------------------- |
150
+ | `<Stack space={3}>` | `<VStack gap={3}>` |
151
+ | `sizing` | Removed, no replacement |
152
+ | `padding`, `margin`, `overflow`, or flex props on Stack | Use `Flex flexDirection="column"`, since VStack accepts only `gap` and `as` |
153
+ | `<Inline space={2}>` | `<Inline gap={2}>`, or better `<HStack gap={2}>` |
154
+
155
+ **Form controls**
156
+
157
+ | v3 | v5 |
158
+ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
159
+ | `customValidity` on TextInput, TextArea, Select, Checkbox, Radio | `hasError` on TextInput, TextArea, Select, and Checkbox. It sets styling and `aria-invalid`, and you render the message. Radio has no error prop |
160
+ | `fontSize`, `padding`, `radius`, `space`, `weight`, `border` | Removed. Use `density` on TextInput, TextArea, Select |
161
+ | TextInput `icon`, `iconRight`, `suffix`, `clearButton`, `onClear` | Removed. TextInput is a plain input |
162
+ | Setting a width on the field | Removed. The field fills its container. Size the parent |
163
+ | TextArea resize handle | Removed. Set `rows` or use `autoResize` |
164
+ | Switch `indeterminate` | Removed. Use Checkbox for a mixed state |
165
+
166
+ **Others**
167
+
168
+ | Component | Change |
169
+ | --------- | --------------------------------------------------------------------- |
170
+ | Icon | `symbol` is now `icon` |
171
+ | Code | `maxWidth` and flex props removed. `as` accepts only `pre` and `span` |
172
+ | Spinner | `tone` and `muted` removed |
173
+ | Badge | `tone="default"` is gone. Use `neutral` |
174
+ | Button | `tone` accepts `neutral` and `critical` only |
175
+
176
+ ## Manual migrations
177
+
178
+ Dialog, Popover, and Tooltip need hand work. A codemod cannot do it.
179
+
180
+ **Dialog.** v3 mounts the dialog conditionally and passes a `footer` prop. v5 uses the `open` prop with subcomponents.
181
+
182
+ ```tsx
183
+ // v3
184
+ {
185
+ open && (
186
+ <Dialog footer={footerContent} {...dialogProps}>
187
+ {dialogContent}
188
+ </Dialog>
189
+ )
190
+ }
191
+
192
+ // v5
193
+ ;<Dialog open={open} {...dialogProps}>
194
+ <Dialog.Content>{dialogContent}</Dialog.Content>
195
+ <Dialog.Footer>{footerContent}</Dialog.Footer>
196
+ </Dialog>
197
+ ```
198
+
199
+ More than a dozen v3 props changed or went: `animate`, `cardRadius`, `cardShadow`, and the sizing, layering, and lifecycle props. Check each prop your code passes against `components/dialog.dsds.yaml`.
200
+
201
+ **Popover.** v3 was controlled. v5 is uncontrolled and built on the native Popover API.
202
+
203
+ - `open` is gone. The trigger opens it. You cannot drive it from state.
204
+ - `children` is the trigger and must render a `<button>`. v3 used it as a positioning reference, or `referenceElement`.
205
+ - Radius, shadow, tone, padding, overflow, width, and `arrow` are gone. Compose a `Card` inside `content` for more.
206
+ - `zOffset`, `onActivate`, and the `Layer` context are gone.
207
+
208
+ **Tooltip.** `content` keeps its name.
209
+
210
+ - There is no `disabled` prop. Render the trigger with or without the Tooltip wrapper.
211
+ - `arrow` and the card styling props are gone.
212
+ - The polyfills import is now required.
213
+ - Replace `TooltipDelayGroupProvider` with `TooltipGroup`.
214
+
215
+ ## Codemods
216
+
217
+ v5 ships codemods built with jscodeshift. They rewrite imports and transform props. They cover the mechanical work only.
218
+
219
+ ```sh
220
+ pnpx @sanity/ui-codemod latest:box --paths "src/**/*.tsx" --dry
221
+ ```
222
+
223
+ There is one command per component: `box`, `card`, `text`, `flex`, `grid`, `heading`, `container`, `code`, `stack`, `label`, and `inline`.
224
+
225
+ | Flag | Use |
226
+ | --------------- | ------------------------------------------------------------- |
227
+ | `--paths` | The files to transform. Required. Takes globs and repeats |
228
+ | `--dry` | Run without writing files. Always start here |
229
+ | `--print` | Print the output for review |
230
+ | `--fromPackage` | The source import to match, if you import v3 through an alias |
231
+ | `--toPackage` | The target import. Defaults to `@sanity/ui` |
232
+
233
+ Safe workflow:
234
+
235
+ 1. Run with `--dry` to see the scope.
236
+ 2. Run with `--print` and read the output.
237
+ 3. Run for real, one component and one surface at a time.
238
+ 4. Run your formatter. Sanity and jscodeshift disagree on spaces and semicolons.
239
+ 5. Search for comments that start with `UI-POC-CODEMOD TODO`. Resolve or delete each one before you commit.
240
+ 6. Review the diff and run the tests.
241
+
242
+ The codemods do not translate tone values across packages, port theme customization, or rewrite `styled()` wrappers. Treat the output as a first pass.
243
+
244
+ ## Plan the work
245
+
246
+ 1. Install v5 and set up the entry file.
247
+ 2. Start new features with the layout and typography primitives.
248
+ 3. Migrate Box, Flex, Grid, Text, and Heading first.
249
+ 4. Keep a list of places where v3 has no v5 counterpart.
250
+ 5. Migrate by surface, not by component type. A surface you can test and ship end to end is safer than a global find and replace.