@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,169 @@
1
+ # Props and imports
2
+
3
+ Read this file when you write props, space or size elements, or import icons.
4
+
5
+ ## Contents
6
+
7
+ - Value types: spacing, sizing, and scales
8
+ - Which component accepts which prop
9
+ - Prop names that people get wrong
10
+ - Responsive arrays
11
+ - Color and tokens
12
+ - Imports
13
+ - Things to leave alone
14
+
15
+ ## Value types: spacing, sizing, and scales
16
+
17
+ Spacing and sizing take different value types. Both are correct on the same element:
18
+
19
+ ```tsx
20
+ <Box padding={2} width="300px" />
21
+ ```
22
+
23
+ | Kind | Props | Value | Example |
24
+ | -------------- | ------------------------------------------------------------------- | -------------------------------- | ------------------- |
25
+ | Spacing | `padding`, `margin`, `gap`, `rowGap`, `columnGap` | Integer step, 0 to 9 | `padding={3}` |
26
+ | Position | `top`, `right`, `bottom`, `left`, `inset` | Integer step 0 to 9, or `"auto"` | `top={0}` |
27
+ | Sizing | `width`, `height`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight` | CSS string, including `"0"` | `width="140px"` |
28
+ | Flex values | `flexGrow`, `flexShrink` | Number | `flexGrow={1}` |
29
+ | Flex basis | `flexBasis` | CSS string | `flexBasis="260px"` |
30
+ | Radius | `radius` | Step 0 to 6, or `"full"` | `radius={2}` |
31
+ | Shadow | `shadow` | Step 0 to 5 | `shadow={1}` |
32
+ | Type size | `size` on Text (0 to 4), Heading (0 to 5), Code, Eyebrow | Step | `size={1}` |
33
+ | Icon size | `size` on Icon (0 to 4) | Step | `size={2}` |
34
+ | Container size | `size` on Container (0 to 5) | Step | `size={3}` |
35
+ | Tone | `tone` | Key | `tone="critical"` |
36
+
37
+ Things that fail:
38
+
39
+ - `padding="2"` is a type error. A string is not a step.
40
+ - `padding` does not take pixels. The scale is not linear. `top={4}` is step 4, not four pixels.
41
+ - `width={140}` is a type error. Write `width="140px"`.
42
+ - `flexGrow={true}` is a type error. Pass a number.
43
+ - `<Text size={20}>` is a type error. Size is a step.
44
+ - A hex color or any CSS color in `tone` is a type error.
45
+
46
+ The flexbox shrink idiom mixes both types. Write `<Flex flexGrow={1} minHeight="0">`. `flexGrow` is a number and `minHeight` is a string.
47
+
48
+ Choose `shadow` by the surface's role:
49
+
50
+ | Step | Use for |
51
+ | ---- | -------------------------------------- |
52
+ | 0 | A flat surface |
53
+ | 1 | A resting card |
54
+ | 2 | A hovered card or small raised element |
55
+ | 3 | A popover, dropdown, or menu |
56
+ | 4 | A modal or overlay |
57
+ | 5 | A top-layer surface |
58
+
59
+ Never write a `box-shadow` in `style`.
60
+
61
+ Read `docs/tokens/dtcg/json/` for the real values behind each step. Pass `space`, `radius`, `shadow`, `typography`, `font-family`, `font-weight`, `container`, `semantic`, or a color name such as `blue`.
62
+
63
+ ## Which component accepts which prop
64
+
65
+ | Component | Accepts | Does not accept |
66
+ | --------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
67
+ | Box, Container, Flex, Grid | `padding`, `margin`, sizing, position, `border`, `overflow`, `tone`, `shadow`, `radius` | Text styles |
68
+ | Box | The props above | `flexDirection`, `alignItems`, `justifyContent`, `flexWrap` (these belong to Flex) |
69
+ | Card | `density`, `tone`, `as` | `padding`, `gap`, `radius`, `flexGrow`, `minWidth`, `overflow`, `onClick` |
70
+ | VStack, HStack | `as`, `gap` | Everything else |
71
+ | Text | `size`, `weight`, `tone`, `muted`, `truncate`, `trim`, margin props | Other layout props |
72
+ | Heading | `as` (required), `size`, `tone`, `truncate`, `trim`, margin props | `weight`, `muted`, other layout props |
73
+ | Button, IconButton | Their own props, plus native button attributes | `padding`, `margin`, `width`, `height`, `flexGrow`, `alignSelf` |
74
+ | Icon | `icon`, `size`, `tone`, `aria-label` | Layout props |
75
+ | TextInput, TextArea, Select | `density`, `hasError`, native attributes | `fontSize`, `padding`, `radius`, `space`, `customValidity`, icons or slots on TextInput |
76
+ | Checkbox, Radio, Switch | Native input attributes (Checkbox and Switch also take `hasError`) | `label`, margin props |
77
+
78
+ When a component rejects a prop, wrap it in a `Box` or `Flex` and put the prop there.
79
+
80
+ Do not wrap a component in a `Box` only to add spacing the component withholds. That repeats the override one level out. Pick the nearest value the component offers.
81
+
82
+ Key props by component, as of alpha.20:
83
+
84
+ - **Button:** `text`, `level` (`primary`, `secondary`, `tertiary`), `tone` (`neutral`, `critical`), `iconStart`, `iconEnd`, `loading`, `density` (`regular`, `loose`), `fullWidth`, `as`.
85
+ - **IconButton:** `icon` and `aria-label`, both required, plus `level`, `tone`, `loading`, `density`.
86
+ - **Badge:** `text`, `iconStart`, `tone`.
87
+ - **Dialog:** `open`, `onClose`, `header`, `size`.
88
+ - **Tooltip:** `content`, `placement`, `portal`, and one child.
89
+ - **Tabs:** `value` and `onValueChange` on `Tabs`. `value` on each `Tabs.Tab` and `Tabs.Panel`.
90
+ - **Link:** `href`, `openInNewTab`, `underlined`.
91
+ - **Avatar:** `name` (required), `src`, `size` (0 to 2), `color`.
92
+ - **List.ButtonItem:** `selected`, `as`, `density`, `start`, `end`.
93
+
94
+ Read `docs/components/<id>.dsds.yaml` for the full list and the rules for each.
95
+
96
+ ## Prop names that people get wrong
97
+
98
+ | Component | Wrong | Right |
99
+ | --------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------- |
100
+ | Flex | `direction`, `align`, `justify`, `wrap` | `flexDirection`, `alignItems`, `justifyContent`, `flexWrap` |
101
+ | Grid | `columns`, `rows`, `autoRows`, `gapX`, `gapY` | `gridTemplateColumns`, `gridTemplateRows`, `gridAutoRows`, `columnGap`, `rowGap` |
102
+ | Icon | `symbol`, `as={SomeIcon}` | `icon={SomeIcon}` |
103
+ | Tooltip | `text`, `trigger` | `content`, with the trigger as the child |
104
+ | Container | `width={3}` | `size={3}` |
105
+ | IconButton | `label`, `size` | `aria-label` (it has no `size`) |
106
+ | SkipToContent | `hash` | `href="#main-content"` and `label` |
107
+ | Button | `tone="primary"`, `"positive"`, `"caution"` | `level="primary"`, and `tone` of `neutral` or `critical` only |
108
+ | Stack (v3) | `space` | `VStack` with `gap` |
109
+ | Heading | `as="p"` or `as="div"` | `as` of `h1` to `h6` only |
110
+ | Select, TextInput, TextArea | `customValidity`, `fontSize`, `padding` | `hasError`, `density` |
111
+
112
+ Set `as` on every Heading. Without it, Heading renders an `<h2>`, whatever the context.
113
+
114
+ Do not write a prop at its default value. `<Card density="regular">` renders the same as `<Card>`.
115
+
116
+ Avoid spreading props from a loosely typed object:
117
+
118
+ ```tsx
119
+ const p: Record<string, unknown> = {direction: 'row'}
120
+ <Flex {...p} /> // skips type checking; the wrong name does nothing
121
+ ```
122
+
123
+ If a new prop has no visible effect, look for a spread like this first.
124
+
125
+ ## Responsive arrays
126
+
127
+ A responsive array has up to six slots, one per breakpoint: `[base, 360px, 600px, 900px, 1200px, 1800px]`. Each value applies from that `min-width` up. Slots past the sixth are ignored.
128
+
129
+ ```tsx
130
+ <Flex flexDirection={['column', undefined, 'row']} gap={[2, undefined, 3]} />
131
+ ```
132
+
133
+ An `undefined` slot behaves in one of two ways:
134
+
135
+ - For step and keyword props, such as `padding` and `flexDirection`, it keeps the previous breakpoint's value.
136
+ - For CSS string and number props, such as `width`, `flexBasis`, and `gridTemplateColumns`, it resets the value. Write every slot up to the last one you set.
137
+
138
+ ## Color and tokens
139
+
140
+ - Use `tone` for meaning. Do not pass colors.
141
+ - In custom markup that no component covers, use the semantic custom properties. They follow light and dark mode on their own:
142
+ - `var(--background-low)` for a surface
143
+ - `var(--foreground-high)` and `var(--foreground-low)` for text
144
+ - `var(--separator-low)` for a border
145
+ - The names `--card-border-color`, `--card-bg-color`, and `--card-fg-color` do not exist. A declaration that uses them does nothing.
146
+ - Do not override a component's own color, spacing, or radius through custom properties. They let custom markup match the system. They do not restyle its components.
147
+ - Light and dark colors resolve through the CSS `light-dark()` function.
148
+
149
+ ## Imports
150
+
151
+ ```tsx
152
+ import {Box, Button, Card, Flex, List, Text} from '@sanity/ui'
153
+ import {SearchIcon} from '@sanity/icons/Search'
154
+ ```
155
+
156
+ - Import each icon from its own path. The path drops the `Icon` suffix: `@sanity/icons/Search`.
157
+ - Do not import an icon from `@sanity/icons`. The root ships a type-only stub. The import passes `tsc` and fails in the browser.
158
+ - To choose an icon, search `docs/icons.dsds.yaml` by purpose. It lists every icon with its import path and other names.
159
+ - Import `List` alone and use `List.Item`, `List.ItemText`, `List.ItemImage`, and `List.ButtonItem`. `ListItem` is not an export.
160
+ - Tabs works the same way: `Tabs`, `Tabs.List`, `Tabs.Tab`, `Tabs.Panel`.
161
+ - v5 has no `ThemeProvider`, no `studioTheme`, and no runtime scheme toggle. Importing them is a type error.
162
+
163
+ ## Things to leave alone
164
+
165
+ - Do not restyle a design system component with `style={{…}}` or `className`. Inline styles skip the token system, break in dark mode, and drift from other instances.
166
+ - Use `style` only for a value with no prop path. Examples are a transform, a gradient, an aspect ratio, or a custom property. On a native element with no Sanity UI equivalent, such as `<table>` or `<fieldset>`, `style` is correct.
167
+ - Do not use `as` to turn a layout primitive into a `button`, `dialog`, `select`, `details`, `summary`, or `fieldset`. They do not meet the keyboard, focus, and ARIA needs of those elements.
168
+ - Do not use inline text styles. Box, Container, Flex, and Grid set no font size, weight, or color. Use Text or Heading.
169
+ - Reach for the component before the native element: `Text` for `p` and `span`, `Heading` for `h1` to `h6`, `Button` for `button`, `Link` for `a`, `List` for `ul`, and `Divider` for `hr`.
@@ -0,0 +1,177 @@
1
+ # Setting up Sanity UI 5
2
+
3
+ Read this file when you create a project, fix an unstyled page, fix a build error, or check versions.
4
+
5
+ ## Contents
6
+
7
+ - Requirements
8
+ - Fast path: the setup CLI
9
+ - Install by hand
10
+ - The entry file
11
+ - Project files
12
+ - Check what your copy exports
13
+ - Common failures
14
+
15
+ ## Requirements
16
+
17
+ | Need | Value |
18
+ | ------------------- | ----------------------------------------------------------- |
19
+ | React and React DOM | `^19.2` |
20
+ | Node | `>=20.19 <22` or `>=22.12` (22.0 to 22.11 is not supported) |
21
+ | TypeScript | 5 or later, with `"moduleResolution": "bundler"` |
22
+ | `@sanity/icons` | 5.2.1 or later |
23
+
24
+ `@sanity/icons` and `react-refractor` install on their own as dependencies of `@sanity/ui`. Add `@sanity/icons` to your own `package.json` only when your code imports icons.
25
+
26
+ ## Fast path: the setup CLI
27
+
28
+ The package ships a setup CLI. It writes the dependencies, the stylesheet import, and `tsconfig.json`.
29
+
30
+ ```sh
31
+ npx sanity-ui doctor # check the project and list fixes
32
+ ```
33
+
34
+ Flags: `--dry` (print the plan only), `--yes` or `-y` (accept every default), `--cwd <dir>` (run in another folder).
35
+
36
+ Run `doctor` before you inspect an entry file by hand. It checks the stylesheet import, `tsconfig.json`, the install state of the packages, and the React and Node versions in one pass.
37
+
38
+ ## Install by hand
39
+
40
+ Install the v5 line with the `alpha` tag, or with the exact version you were given.
41
+
42
+ ```sh
43
+ npm install @sanity/ui@alpha @sanity/icons
44
+ ```
45
+
46
+ Never install the bare name `@sanity/ui`. Its `latest` tag points to the UI 4 line, and it resolves to the wrong major with no error.
47
+
48
+ For a React 18 project, add overrides to `package.json` before you install:
49
+
50
+ ```json
51
+ {"overrides": {"react": "^19.2", "react-dom": "^19.2"}}
52
+ ```
53
+
54
+ Use `--legacy-peer-deps` only when overrides are not an option. A bare install in a React 18 project fails with `ERESOLVE`.
55
+
56
+ Add these to `devDependencies`: `typescript`, `@types/react`, `@types/react-dom`, and in a Vite project `@vitejs/plugin-react`.
57
+
58
+ ## The entry file
59
+
60
+ Put both imports in the app's entry file, the polyfills first.
61
+
62
+ ```tsx
63
+ import '@sanity/ui/polyfills'
64
+ import '@sanity/ui/styles.css'
65
+ ```
66
+
67
+ Each line has a job:
68
+
69
+ - **The stylesheet is required.** Without it every component renders as plain HTML, and nothing reports an error.
70
+ - **The polyfills are required for Tooltip and Dialog.** Tooltips never show in browsers without the Interest Invokers API. A Dialog backdrop click stops closing the dialog in Safari. Escape and the close button still work.
71
+ - **The stylesheet goes before your own CSS.** Sanity UI puts only its global reset in a cascade layer, `sui.global`. Your CSS overrides the reset. Component styles are not layered. At equal specificity, the stylesheet imported later wins.
72
+
73
+ Write the path as `@sanity/ui/styles.css`. The forms `@sanity/ui/dist/styles.css` and `@sanity/ui/styles` fail at the dev server. The page never renders and no console error explains why.
74
+
75
+ Set `lang="en"` on the `<html>` element in `index.html`.
76
+
77
+ v5 needs no provider. There is no `ThemeProvider`.
78
+
79
+ ## Project files
80
+
81
+ For a new Vite project, start from these files.
82
+
83
+ `package.json`
84
+
85
+ ```json
86
+ {
87
+ "name": "my-app",
88
+ "private": true,
89
+ "version": "0.0.1",
90
+ "type": "module",
91
+ "scripts": {
92
+ "dev": "vite",
93
+ "build": "tsc --noEmit && vite build"
94
+ },
95
+ "dependencies": {
96
+ "react": "^19.2",
97
+ "react-dom": "^19.2",
98
+ "@sanity/ui": "alpha",
99
+ "@sanity/icons": "^5.2.1"
100
+ },
101
+ "devDependencies": {
102
+ "typescript": "^5",
103
+ "vite": "^6",
104
+ "@vitejs/plugin-react": "^4",
105
+ "@types/react": "^19",
106
+ "@types/react-dom": "^19"
107
+ }
108
+ }
109
+ ```
110
+
111
+ `vite.config.ts`
112
+
113
+ ```ts
114
+ import {defineConfig} from 'vite'
115
+ import react from '@vitejs/plugin-react'
116
+
117
+ export default defineConfig({
118
+ plugins: [react()],
119
+ })
120
+ ```
121
+
122
+ `tsconfig.json`: write it first, as written. It is the file the CLI writes.
123
+
124
+ ```json
125
+ {
126
+ "compilerOptions": {
127
+ "target": "ES2022",
128
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
129
+ "module": "esnext",
130
+ "moduleResolution": "bundler",
131
+ "jsx": "react-jsx",
132
+ "strict": true,
133
+ "esModuleInterop": true,
134
+ "skipLibCheck": true,
135
+ "resolveJsonModule": true,
136
+ "isolatedModules": true,
137
+ "moduleDetection": "force"
138
+ },
139
+ "include": ["src", "app"]
140
+ }
141
+ ```
142
+
143
+ Rules for this file:
144
+
145
+ - Keep `"jsx": "react-jsx"`. Without it, every component fails with `TS17004`.
146
+ - Keep `"app"` in `include`, even with no `app` folder. A missing folder is not an error while `src` has files.
147
+ - Add no other `compilerOptions` keys. An unknown key fails the build with `TS5023`.
148
+ - Do not change the file to fix a build. The cause is usually in `src/`.
149
+ - Do not run a bare `tsc`. The config has no `noEmit`. It writes `.js` files beside your sources, and Vite loads those. Type-check with `tsc --noEmit`.
150
+
151
+ Other toolchains, such as Next.js or Remix, keep their own `tsconfig.json`. The two imports still go in the app's entry file.
152
+
153
+ ## Check what your copy exports
154
+
155
+ The docs can describe components your installed copy does not export yet. List the real exports:
156
+
157
+ ```sh
158
+ node -e "console.log(Object.keys(require('@sanity/ui')))"
159
+ ```
160
+
161
+ To check an export, run `node -e "console.log(Object.keys(require('@sanity/ui')))"` in the project. The list is the installed package's export list. If a doc and the package disagree, the package wins.
162
+
163
+ ## Common failures
164
+
165
+ | Symptom | Cause | Fix |
166
+ | ---------------------------------------------- | ------------------------------ | -------------------------------------------------- |
167
+ | Page renders as plain HTML, no error | Missing `styles.css` import | Add both entry imports |
168
+ | Dev server fails and the page never renders | Wrong stylesheet path | Use `@sanity/ui/styles.css` |
169
+ | Tooltip never appears | Missing polyfills import | Import `@sanity/ui/polyfills` above the stylesheet |
170
+ | `TS17004` on every component | Missing `"jsx": "react-jsx"` | Restore the `tsconfig.json` above |
171
+ | `TS7016` for `react` | Missing `@types/react` | Add `@types/react` and `@types/react-dom` |
172
+ | `TS5023: Unknown compiler option` | Invented `compilerOptions` key | Remove it |
173
+ | `ERR_MODULE_NOT_FOUND` on `dev` | Missing `@vitejs/plugin-react` | Add it to `devDependencies` |
174
+ | `ERESOLVE` on install | React 18 project | Add overrides, or `--legacy-peer-deps` |
175
+ | `.js` files appear beside `.tsx` files | Bare `tsc` | Delete them, then run `tsc --noEmit` |
176
+ | Icon import passes `tsc`, fails in the browser | Import from the package root | Import from `@sanity/icons/<Name>` |
177
+ | Component imports fail as unavailable | Component is not exported yet | See `components.md` |
@@ -0,0 +1,33 @@
1
+ # Silent failures — the catalog
2
+
3
+ This file is the catalog. These patterns fail with no error, warning, or type feedback. When a layout breaks or a style goes missing with zero console output, check here first. Wrong props on Sanity UI 5 components are mostly type errors. Run `tsc --noEmit` before you read this list.
4
+
5
+ | # | Trigger | Symptom | Fix |
6
+ | --- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
7
+ | 1 | No `as` on `Heading` in v3 code, where the default was `<div>` | In v5 this is a type error. Ported code that skips `as` fails `tsc` | Set `as` to the level. Use `size` for the visual size. |
8
+ | 2 | v3 props on v5 components, such as `direction` on Flex or `space` on Stack | v5 reports most of these as type errors. Props that reach the DOM can be ignored | Migrate each prop. See `migrating-from-v3.md` |
9
+ | 3 | No `import '@sanity/ui/styles.css'` in `main.tsx` | Every component renders as unstyled HTML | Add the import to `main.tsx` |
10
+ | 4 | A `var(--tone-*)` variable, such as `--tone-surface`, which no version defines | The value resolves to nothing; background or border is invisible | Use `var(--background-low)`, `var(--separator-low)`, or `var(--foreground-high)`. They work everywhere and follow the nearest tone |
11
+ | 5 | A single-quoted string with an apostrophe | A Vite build error that is easy to miss | Use a template literal or double quotes |
12
+ | 6 | A tone value the component does not accept, such as `default` on Text or `positive` on Button | A type error in v5 | See `tone-and-color.md` for the values each component takes |
13
+
14
+ ## Caught by the type checker
15
+
16
+ These are not silent in Sanity UI 5. `tsc --noEmit` reports a type error for each one.
17
+
18
+ - Layout props on `Card`, such as `flexGrow`, `minWidth`, `overflow`, or `padding`. Wrap the Card in `Box` or `Flex`: `<Box flexGrow={1}><Card /></Box>`.
19
+ - `flexGrow`, `flexShrink`, or `flexBasis` on `VStack` or `HStack`. Use `<Flex flexDirection="column" gap={3}>`, or wrap the stack in `<Box flexGrow={1}>`.
20
+ - A `Heading` with no `as`. Set `as` to `h1` through `h6`.
21
+ - A tone the component does not take, such as `tone="default"` on Text or `tone="positive"` on Button.
22
+
23
+ If your project does not run the type checker, run it. Without it, these look like silent failures.
24
+
25
+ ## The diagnostic habit
26
+
27
+ When something looks wrong and there is no error:
28
+
29
+ - Did you run `tsc --noEmit`? It catches layout props on `Card` and flex props on `VStack` and `HStack`.
30
+ - Is `Heading` missing an `as`? Add it.
31
+ - Are layout primitives imported from the v3 line? Switch to v5.
32
+ - Is `styles.css` imported in `main.tsx`? Add it.
33
+ - Is a `var(--tone-*)` variable in the code? No version defines it. Use `var(--background-low)` or a similar semantic variable.
@@ -0,0 +1,53 @@
1
+ # Taste: judgment for Sanity UI 5
2
+
3
+ Read this file when you choose a tone, set density or spacing, pick between two components that both work, or review UI for quality. The docs say what is correct. This file says what is good.
4
+
5
+ ## Contents
6
+
7
+ - The Sanity stance
8
+ - Tone and color
9
+ - Spacing and density
10
+ - Component choice
11
+ - Build with the grain
12
+ - When the docs and this file disagree
13
+
14
+ ## The Sanity stance
15
+
16
+ - **Restraint is the discipline.** There is one good way to do a thing, not five. When two patterns both work, the simpler one is the Sanity one. Range comes from composing primitives, not from reaching for more components.
17
+ - **The base is a white wall.** A near-monochrome base makes one bold move count. Ration the accent. A toned or colored element should mean something. If everything is colored, nothing reads.
18
+ - **The system fails quietly in a few places.** A missing stylesheet import leaves the page unstyled. A prop spread from a loosely typed object skips type checking. Most other wrong props are type errors in v5, so `tsc --noEmit` catches them. Knowing what each primitive accepts is the discipline. `silent-failures.md` lists the rest.
19
+ - **Primitives do one job.** `Box` handles spacing, border, tone, and radius. It does not handle flex or clicks. `VStack` and `HStack` expose only `as` and `gap`. When you need more, step up to `Flex` or compose. Do not force a prop onto a primitive that ignores it.
20
+
21
+ Generic output is the usual failure here, not breakage. The output is correct and consistent, but it looks like everything else. Aim past that.
22
+
23
+ ## Tone and color
24
+
25
+ Use a tone for its meaning, not for a raw color. The five semantic tones are `neutral`, `positive`, `suggest`, `caution`, and `critical`.
26
+
27
+ - **`suggest` is the AI-hint tone.** Use it when the UI marks something the agent produced or proposed.
28
+ - **Tone values differ by component.** Card, Box, Flex, Grid, and Container also take `default`. Button takes only `neutral` and `critical`. A wrong tone is a type error. The full table is in `tone-and-color.md`.
29
+ - **Ration the accent.** Default to neutral surfaces. Spend color where it carries weight.
30
+
31
+ ## Spacing and density
32
+
33
+ - **The spacing scale is integers 0 to 9.** Spacing props (`padding`, `margin`, `gap`) take an integer step. Sizing props (`width`, `maxWidth`) take a CSS string. Mixing the two is a type error.
34
+ - **Density over padding on Card.** Card spacing comes from `density` (`compact`, `regular`, `loose`). Pick density by how much information the surface holds, not by nudging pixels. `padding` on a Card is a type error.
35
+
36
+ ## Component choice
37
+
38
+ Picking the right component is taste. The wrong one still renders, and nothing flags it. `component-choice.md` has the full matrix. The main calls:
39
+
40
+ - **`data-table` or `sortable-data-table`.** Read-only display uses `data-table`. Clickable or selectable rows use `sortable-data-table`.
41
+ - **`VStack` or `HStack` or `Flex`.** A simple stack with a gap uses `VStack` or `HStack`. A flex child that grows or shrinks uses `Flex`, or a `Box` around the stack.
42
+ - **`Box` or `Card`.** Card is a toned surface with its own density. Layout props belong on a `Box` wrapping the Card, never on the Card.
43
+ - **`Button`, never `Box as="button"`.** `Box as="button"` keeps browser defaults with no prop to reset them.
44
+
45
+ ## Build with the grain
46
+
47
+ - **Props over inline styles.** Every visual attribute with a prop uses the prop. Inline styles skip the spacing scale, break dark mode, and ignore responsive arrays. Use `style` only for values with no prop, such as `gridTemplateAreas` or `clipPath`, and on native elements like a raw `<table>`.
48
+ - **Set `as` on every Heading.** A Heading with no `as` breaks the document outline. Set `as` for the level. Use `size` for the visual size.
49
+ - **Build accessibility in.** Every input gets a label. Never nest clickable elements. A Card with `onClick` must not contain a Button. These rules apply on the first build, not at review.
50
+
51
+ ## When the docs and this file disagree
52
+
53
+ The installed package's `docs/` folder is the source of what exists: the components, the props, and the rules. This file is the judgment for using them well. If a value here and a document disagree, the installed package wins. The judgment in this file still holds.
@@ -0,0 +1,55 @@
1
+ # Tone and color: full reference
2
+
3
+ Read this file when you choose a tone or set a color. The values below were checked against `@sanity/ui` 5.0.0-alpha.22.
4
+
5
+ ## The five semantic tones
6
+
7
+ Each tone carries a meaning. Use the meaning, not a raw color.
8
+
9
+ | Intent | Tone |
10
+ | -------------------------- | ---------- |
11
+ | Neutral surface or default | `neutral` |
12
+ | Success | `positive` |
13
+ | Suggestion or AI hint | `suggest` |
14
+ | Warning | `caution` |
15
+ | Error or destructive | `critical` |
16
+
17
+ `suggest` is the tone for content the agent produced or proposed. Reach for it when the UI marks an AI hint.
18
+
19
+ ## Which component takes which tone
20
+
21
+ Tone values are not the same across components. A tone the component does not take is a type error in v5.
22
+
23
+ | Components | Tones accepted |
24
+ | ---------------------------------------------- | ------------------------------------------------------------------ |
25
+ | Card, Box, Flex, Grid, Container | `default`, `neutral`, `positive`, `suggest`, `caution`, `critical` |
26
+ | Text, Heading, Icon, Eyebrow, Badge, Indicator | `neutral`, `positive`, `suggest`, `caution`, `critical` |
27
+ | Button | `neutral`, `critical` |
28
+
29
+ `default` on the layout surfaces paints the page backdrop. Use `neutral` for a plain surface.
30
+
31
+ v3 used `default` for neutral on `Button` and `Badge`. Replace it with `neutral` when you port code. The tone names are the same across the other components.
32
+
33
+ ## Watch the seams
34
+
35
+ - `tone="default"` on `Text`, `Heading`, `Icon`, `Badge`, or `Eyebrow` is a type error. Use `neutral`.
36
+ - `tone="positive"`, `"caution"`, or `"suggest"` on `Button` is a type error. Button takes `neutral` and `critical` only.
37
+ - A toned Badge, Text, or Heading should lead with the state in its words, or carry an icon. A tone alone is not enough.
38
+
39
+ ## Color restraint
40
+
41
+ - The base is near-monochrome on purpose. A restrained base makes one accent count.
42
+ - A toned or colored element should mean something. If everything is colored, nothing reads.
43
+ - Default to neutral surfaces. Spend color where it carries weight.
44
+
45
+ ## Semantic variables for custom markup
46
+
47
+ When no component covers a case, use the semantic variables. They resolve everywhere and follow the nearest tone:
48
+
49
+ - `var(--background-low)` for a surface
50
+ - `var(--separator-low)` for a border
51
+ - `var(--foreground-high)` and `var(--foreground-low)` for text
52
+
53
+ Toned elements set these variables for their children. A toned Card therefore sets its own surface and text colors on its own.
54
+
55
+ The names `--tone-surface` and `--tone-separator` are not defined by any version. A declaration that uses them does nothing.
@@ -22,11 +22,12 @@ export function Button<T extends ElementType = 'button'>({
22
22
  as,
23
23
  children,
24
24
  className,
25
- disabled,
26
25
  style,
27
26
  iconStart: IconStart,
28
27
  iconEnd: IconEnd,
29
28
  loading,
29
+ onClick,
30
+ pressed,
30
31
  text,
31
32
  ...rest
32
33
  } = getProps({density, level, tone, ...props}, buttonProps)
@@ -41,8 +42,17 @@ export function Button<T extends ElementType = 'button'>({
41
42
  )}
42
43
  style={style}
43
44
  data-ui="Button"
44
- disabled={disabled || loading}
45
- aria-busy={loading ? true : undefined}
45
+ aria-busy={loading}
46
+ aria-disabled={loading}
47
+ aria-pressed={pressed}
48
+ onClick={
49
+ loading
50
+ ? (e: Event) => {
51
+ e.preventDefault()
52
+ }
53
+ : onClick
54
+ }
55
+ type={Component === 'button' ? 'button' : undefined}
46
56
  {...rest}
47
57
  >
48
58
  {loading && (
@@ -52,6 +62,7 @@ export function Button<T extends ElementType = 'button'>({
52
62
  alignItems="center"
53
63
  justifyContent="center"
54
64
  data-ui="Button-Spinner"
65
+ aria-hidden="true"
55
66
  >
56
67
  <Spinner />
57
68
  </Flex>
@@ -4,7 +4,7 @@
4
4
  .sui-Button {
5
5
  --background-color: hsl(from var(--backdrop) h s l / var(--opacity-high));
6
6
  --foreground-color: var(--foreground-high);
7
- --hover-blend-color: var(--gray-500);
7
+ --hover-blend-color: light-dark(var(--gray-500), var(--gray-300));
8
8
  background: var(--background-color);
9
9
  box-shadow: inset 0 0 0 1px var(--border-color, transparent);
10
10
  color: var(--foreground-color);
@@ -13,10 +13,11 @@
13
13
  appearance: none;
14
14
  }
15
15
 
16
+ .sui-Button[aria-pressed="true"],
16
17
  .sui-Button:hover {
17
18
  background: color-mix(
18
19
  in srgb,
19
- var(--hover-blend-color) 12%,
20
+ var(--hover-blend-color) 25%,
20
21
  var(--background-color)
21
22
  );
22
23
  color: color-mix(
@@ -39,45 +40,31 @@
39
40
  color: inherit;
40
41
  }
41
42
 
42
- .sui-Button > [data-ui="Button-Spinner"] + * {
43
+ /* Visually hide button contents other than the spinner when loading=true */
44
+ .sui-Button[aria-busy="true"] > :not([data-ui="Button-Spinner"]) {
43
45
  opacity: 0;
44
46
  }
45
47
 
46
- /**
47
- * Disabled
48
- */
49
- .sui-Button[class*='sui-tone']:disabled {
50
- --background-color: var(--inert-background);
51
- --foreground-color: var(--inert-foreground);
52
- --border-color: transparent;
53
- pointer-events: none;
54
- }
55
-
56
48
  /**
57
49
  * Primary
58
50
  */
59
51
  .sui-button-level-primary {
60
52
  --background-color: var(--background-high-emphasized);
61
53
  --foreground-color: var(--foreground-low-emphasized);
62
- --hover-blend-color: light-dark(var(--gray-950), var(--gray-50));
54
+ --hover-blend-color: light-dark(var(--gray-50), var(--gray-600));
63
55
  }
64
56
 
57
+ .sui-Button.sui-button-level-primary[aria-pressed="true"],
65
58
  .sui-Button.sui-button-level-primary:hover {
66
- background: color-mix(
67
- in srgb,
68
- var(--hover-blend-color) 12%,
69
- var(--background-color)
70
- );
71
59
  color: var(--foreground-low-emphasized);
72
60
  }
73
61
 
62
+ /* Primary critical */
74
63
  .sui-button-level-primary.sui-tone-critical {
75
64
  --background-color: var(--background-low-emphasized);
76
- --hover-blend-color: light-dark(var(--red-950), var(--red-50));
65
+ --hover-blend-color: light-dark(var(--red-50), var(--red-700));
77
66
  }
78
67
 
79
-
80
-
81
68
  /**
82
69
  * Secondary
83
70
  */
@@ -85,16 +72,27 @@
85
72
  --border-color: var(--separator-low)
86
73
  }
87
74
 
75
+ /* Secondary critical */
88
76
  .sui-button-level-secondary.sui-tone-critical {
89
77
  --background-color: var(--background-low);
90
78
  --foreground-color: var(--foreground-low);
91
- --hover-blend-color: var(--red-500);
79
+ --hover-blend-color: light-dark(var(--red-400), var(--red-500));
92
80
  }
93
81
 
94
82
  /**
95
- * Tertiary
83
+ * Tertiary critical
96
84
  */
97
85
  .sui-button-level-tertiary.sui-tone-critical {
98
86
  --foreground-color: var(--foreground-low);
99
- --hover-blend-color: var(--red-500);
87
+ --hover-blend-color: light-dark(var(--red-400), var(--red-500));
88
+ }
89
+
90
+ /**
91
+ * Disabled
92
+ */
93
+ .sui-Button[class*='sui-tone']:disabled {
94
+ background-color: var(--inert-background);
95
+ color: var(--inert-foreground);
96
+ --border-color: transparent;
97
+ pointer-events: none;
100
98
  }
@@ -44,6 +44,10 @@ export interface ButtonProps<T extends React.ElementType = 'button'> {
44
44
  * Places Button into a loading state.
45
45
  */
46
46
  loading?: boolean
47
+ /**
48
+ * Visually styles the button in a pressed state, and sets aria-pressed to the provided value
49
+ */
50
+ pressed?: boolean
47
51
  /**
48
52
  * Sets Button's text label.
49
53
  */