@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,202 @@
1
+ kind: component
2
+ id: switch
3
+ name: Switch
4
+ description: A toggle control for binary on/off settings that take immediate effect.
5
+ metadata:
6
+ tags: [switch, toggle, boolean, form, on/off, setting, enable, disable]
7
+ status:
8
+ status: beta
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: when-to-use
13
+ title: When to use
14
+ items:
15
+ - level: should
16
+ statement: "Toggling a boolean setting that takes effect immediately (for example, 'Enable notifications')."
17
+ - level: should-not
18
+ statement: When choosing between more than two options. Use Select or Radio instead.
19
+ alternatives:
20
+ - to: select
21
+ - to: radio
22
+ - level: should-not
23
+ statement: To display an indeterminate state. Switch only has two options. Use Checkbox instead.
24
+ alternatives:
25
+ - to: checkbox
26
+ - kind: guidelines
27
+ for: agent
28
+ framing: when-to-use
29
+ title: When to use
30
+ items:
31
+ - level: should-not
32
+ statement: Don't use Switch when changes are deferred until form submission, or when selection does not trigger an immediate reaction. Use Checkbox instead.
33
+ alternatives:
34
+ - to: checkbox
35
+ - level: should-not
36
+ statement: Don't use Switch for choosing between named options. Use Radio instead.
37
+ alternatives:
38
+ - to: radio
39
+ - kind: guidelines
40
+ for: all
41
+ framing: how-to-use
42
+ items:
43
+ - level: must
44
+ statement: Give every Switch an accessible name. Link a visible label element to it with id and htmlFor, or use aria-label or aria-labelledby when there is no visible text to link.
45
+ refines:
46
+ - to: forms#pair-with-visible-label
47
+ - level: must-not
48
+ statement: Use Switch without an accessible name. A nameless switch is announced as an unlabeled switch.
49
+ - level: must
50
+ statement: The label should describe the on state using present-tense verb phrases. 'Enable feature flags', 'Show archived items'.
51
+ - refs:
52
+ - to: forms#pair-checked-with-onchange
53
+ rel: same-as
54
+ - refs:
55
+ - to: forms#stack-fields-vertically
56
+ rel: same-as
57
+ - refs:
58
+ - to: shared-foundations#error-state-never-disabled
59
+ rel: same-as
60
+ - level: must-not
61
+ statement: Don't pair Switch with a confirm button or action. Toggling a switch should immediately trigger the action.
62
+ - refs:
63
+ - to: forms#no-mixed-controlled-uncontrolled
64
+ rel: same-as
65
+ - kind: guidelines
66
+ for: agent
67
+ framing: how-to-use
68
+ items:
69
+ - id: switch-has-accessible-name
70
+ level: must
71
+ statement: Every Switch has an accessible name from a linked label element, aria-label or aria-labelledby. Switch has no label prop.
72
+ checkedBy: manual
73
+ - level: must
74
+ statement: Changes commit on onChange. Don't defer them to a Save button, and don't add one beside a Switch.
75
+ - refs:
76
+ - to: forms#error-prop-needs-visible-message
77
+ rel: same-as
78
+ - level: must-not
79
+ statement: "Writing a label that describes the off state ('Hide notifications'). Instead: Write the label for the on state ('Enable notifications')."
80
+ - kind: guidelines
81
+ for: all
82
+ title: Content
83
+ tags: [content]
84
+ items:
85
+ - refs:
86
+ - to: content-guidelines#sentence-case-all-system-set
87
+ rel: same-as
88
+ - refs:
89
+ - to: forms#label-short
90
+ rel: same-as
91
+ - level: should
92
+ statement: Labels should use present-tense verbs. "Enable notifications" not "Notifications enabled". The label describes the action of turning it on.
93
+ - level: should
94
+ statement: Pair the on state with the positive outcome. ("Show archived items", not "Hide archived items".)
95
+ - refs:
96
+ - to: forms#label-no-trailing-period
97
+ rel: same-as
98
+ - refs:
99
+ - to: forms#label-no-trailing-colon
100
+ rel: same-as
101
+ - kind: guidelines
102
+ for: all
103
+ title: Accessibility
104
+ description: 'Target conformance: WCAG Level AA.'
105
+ tags: [accessibility]
106
+ items:
107
+ - level: must
108
+ statement: The Switch has no name of its own (WCAG 4.1.2). Name it through a linked label element, aria-label or aria-labelledby.
109
+ - level: should
110
+ statement: 'With hasError, the Switch sets aria-invalid on the input and shows error styling on the track. Pair it with a visible error message that the input describes.'
111
+ - refs:
112
+ - to: forms#aria-label-overrides-name
113
+ rel: same-as
114
+ - refs:
115
+ - to: forms#aria-labelledby-references-name
116
+ rel: same-as
117
+ - refs:
118
+ - to: forms#label-available-to-screen-readers
119
+ rel: same-as
120
+ - refs:
121
+ - to: forms#error-described-in-text
122
+ rel: same-as
123
+ - refs:
124
+ - to: forms#border-contrast
125
+ rel: same-as
126
+ - kind: section
127
+ for: all
128
+ freeform:
129
+ - title: Example — commit on toggle
130
+ body: |-
131
+ ```
132
+ import { Switch } from '@sanity/ui'
133
+
134
+ <Switch
135
+ id="notifications"
136
+ checked={settings.notifications}
137
+ onChange={(e) => save({ notifications: e.currentTarget.checked })}
138
+ />
139
+ <label htmlFor="notifications">Enable notifications</label>
140
+ ```
141
+
142
+ Use `checked` and `onChange` to control the switch from React state. A Switch commits on `onChange`. The `id` and `htmlFor` pair gives the switch its name. Use `aria-label` instead when the text can't be rendered visibly.
143
+ alternatives:
144
+ - to: checkbox
145
+ note: multi-select or boolean within a form that's submitted later
146
+ - to: radio
147
+ note: single-select within a small group
148
+ refs:
149
+ - href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=31902-62
150
+ rel: design
151
+ role: Figma component (v5)
152
+ sourceFiles:
153
+ - platform: react
154
+ file: packages/ui/src/components/switch/Switch.tsx
155
+ imports:
156
+ - platform: react
157
+ code: import { Switch } from '@sanity/ui'
158
+ package: '@sanity/ui'
159
+ traits:
160
+ - traitType: state
161
+ kind: boolean
162
+ id: 'off'
163
+ description: Standard unchecked state with dot on the left.
164
+ - traitType: state
165
+ kind: boolean
166
+ id: 'on'
167
+ description: Track filled, dot on the right.
168
+ - traitType: state
169
+ kind: boolean
170
+ id: focused
171
+ description: Focus ring around the track on :focus-visible.
172
+ - traitType: state
173
+ kind: boolean
174
+ id: disabled
175
+ description: Muted track and dot, removed from tab order.
176
+ - traitType: state
177
+ kind: boolean
178
+ id: hasError
179
+ description: Red track styling and aria-invalid on the input for a validation error.
180
+ $extensions:
181
+ com.sanity.ui:
182
+ implementationStatus:
183
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
184
+ implemented: true
185
+ migrationGuide:
186
+ context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
187
+ guidance: |-
188
+ The v5 Switch is the input itself, with no label wrapper. It has no visible text and no name of its own. In v3, a separate `<label htmlFor>` named the Switch. In v5, link a label element with `id` and `htmlFor`, or use `aria-label` or `aria-labelledby`.
189
+
190
+ | v3 pattern | v5 pattern | Notes |
191
+ | :---- | :---- | :---- |
192
+ | `<label htmlFor="x">Label</label><Switch id="x" />` | `<Switch id="x" /><label htmlFor="x">Label</label>` | Same association. Use `Text as="label"` if you need the Sanity UI text styles |
193
+ | `<Switch checked />` | `<Switch checked />` | Same `checked`/`onChange` API |
194
+ | All native `<input>` attributes (`name`, `value`, `required`, `aria-*`) | Forwarded unchanged | Pass them as before |
195
+
196
+ ### Breaking changes
197
+
198
+ - **`indeterminate` removed.** Switch has two states only. Use Checkbox for a mixed state.
199
+
200
+ ### Codemod
201
+
202
+ Run `pnpx @sanity/ui-codemod latest:switch --paths <paths> --toPackage @sanity/ui`. It updates the import and warns about `indeterminate`. It does not rewrite `label` props or wrapping label elements. Fix those by hand.
@@ -0,0 +1,54 @@
1
+ kind: component
2
+ id: tab
3
+ name: Tabs.Tab
4
+ description: A button that selects one Tabs.Panel. Use it inside Tabs.List.
5
+ metadata:
6
+ tags: [tabs, tablist, tabpanel, navigation, views, tab, sections]
7
+ status:
8
+ status: beta
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: how-to-use
13
+ items:
14
+ - level: must
15
+ statement: When `tone` is not set to neutral, use the `icon` prop to visually reinforce the state of a tab.
16
+ - level: should
17
+ statement: Keep tab labels short, 1 to 3 words.
18
+ - level: should-not
19
+ statement: Don't use icon unless it's necessary to communicate the content related to that tab. Tabs.Tab renders icon before label.
20
+ - level: must-not
21
+ statement: Don't use tone for decorative purposes. tone must only communicate an important state related to the content it reveals.
22
+ - kind: guidelines
23
+ for: agent
24
+ framing: how-to-use
25
+ items:
26
+ - level: must-not
27
+ statement: Don't set id or aria-controls on Tabs.Tab. It builds both from value.
28
+
29
+ refs:
30
+ - to: tabs
31
+ rel: relates-to
32
+ note: The family this tab belongs to.
33
+ - to: tabs-list
34
+ rel: relates-to
35
+ note: Holds the Tabs.Tab buttons in a row.
36
+ - to: tabs-panel
37
+ rel: relates-to
38
+ note: The content this tab selects.
39
+ - href: https://www.figma.com/design/NWmchNlsNdG66VBaCsTdSL/pjo-ui4-component-buildout?node-id=23902-5282
40
+ rel: design
41
+ role: Figma component
42
+
43
+ sourceFiles:
44
+ - platform: react
45
+ file: packages/ui/src/components/tabs/Tabs.tsx
46
+ imports:
47
+ - platform: react
48
+ code: import { Tabs } from '@sanity/ui'
49
+ package: '@sanity/ui'
50
+ $extensions:
51
+ com.sanity.ui:
52
+ implementationStatus:
53
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
54
+ implemented: true
@@ -0,0 +1,56 @@
1
+ kind: component
2
+ id: tabs-list
3
+ name: Tabs.List
4
+ description: The row that holds the Tabs.Tab buttons. It renders with role="tablist", lays its tabs out in a row, and moves focus between them with the arrow keys.
5
+ metadata:
6
+ tags: [tabs, tablist, tabpanel, navigation, views, tab, sections]
7
+ status:
8
+ status: beta
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: how-to-use
13
+ items:
14
+ - id: pre-select-default-tab-user
15
+ level: must
16
+ statement: Set Tabs value to one of the Tab values. This shows a panel on first render.
17
+ - level: must
18
+ statement: Show at least 2 tabs. A single tab provides no benefit.
19
+ - level: must-not
20
+ statement: Don't use more than 10 tabs. If more are needed, consider breaking the page up into smaller separate pages.
21
+ - level: must-not
22
+ statement: Don't pass onKeyDown to Tabs.List. The component ignores it and uses its own arrow-key handler.
23
+ - kind: guidelines
24
+ for: all
25
+ title: Accessibility
26
+ tags: [accessibility]
27
+ items:
28
+ - level: must
29
+ statement: Give Tabs.List an aria-label or aria-labelledby. The type requires one of them.
30
+
31
+ refs:
32
+ - to: tabs
33
+ rel: relates-to
34
+ note: The family this list belongs to.
35
+ - to: tab
36
+ rel: relates-to
37
+ note: The buttons this list holds.
38
+ - to: tabs-panel
39
+ rel: relates-to
40
+ note: The content each tab selects.
41
+ - href: https://www.figma.com/design/NWmchNlsNdG66VBaCsTdSL/pjo-ui4-component-buildout?node-id=23902-5282
42
+ rel: design
43
+ role: Figma component
44
+
45
+ sourceFiles:
46
+ - platform: react
47
+ file: packages/ui/src/components/tabs/Tabs.tsx
48
+ imports:
49
+ - platform: react
50
+ code: import { Tabs } from '@sanity/ui'
51
+ package: '@sanity/ui'
52
+ $extensions:
53
+ com.sanity.ui:
54
+ implementationStatus:
55
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
56
+ implemented: true
@@ -0,0 +1,54 @@
1
+ kind: component
2
+ id: tabs-panel
3
+ name: Tabs.Panel
4
+ description: The content for one tab. It shows when its value matches the selected Tabs value, and stays hidden otherwise.
5
+ metadata:
6
+ tags: [tabs, tablist, tabpanel, navigation, views, tab, sections]
7
+ status:
8
+ status: beta
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: how-to-use
13
+ items:
14
+ - id: tabpanel-tabindex
15
+ level: must
16
+ statement: Tab.Panel has a default tabindex of 0 to enable focusing when there is no focusable content. Tab panels with focusable content should unset the panel’s tabindex so that the panel’s first focusable component receives focus instead.
17
+ - id: tabpanel-value-matches-tab
18
+ level: must
19
+ statement: Give Tabs.Panel the same value as its Tabs.Tab.
20
+ - id: don-conditionally-render-tabpanels-hidden
21
+ level: must-not
22
+ statement: "Don't render Tabs.Panel conditionally. Unselected panels stay mounted with display none. Their content keeps its state."
23
+ - level: should
24
+ statement: Use layout props such as padding on Tabs.Panel for spacing inside the panel.
25
+ - kind: guidelines
26
+ for: agent
27
+ framing: how-to-use
28
+ items:
29
+ - level: must-not
30
+ statement: Don't set id or aria-labelledby on Tabs.Panel. It sets both from value.
31
+
32
+ refs:
33
+ - to: tabs
34
+ rel: relates-to
35
+ note: The family this panel belongs to.
36
+ - to: tabs-list
37
+ rel: relates-to
38
+ note: The row that holds the tabs.
39
+ - to: tab
40
+ rel: relates-to
41
+ note: The button that selects this panel.
42
+
43
+ sourceFiles:
44
+ - platform: react
45
+ file: packages/ui/src/components/tabs/Tabs.tsx
46
+ imports:
47
+ - platform: react
48
+ code: import { Tabs } from '@sanity/ui'
49
+ package: '@sanity/ui'
50
+ $extensions:
51
+ com.sanity.ui:
52
+ implementationStatus:
53
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
54
+ implemented: true
@@ -0,0 +1,104 @@
1
+ kind: component
2
+ id: tabs
3
+ name: Tabs
4
+ description: 'A family of components that switch between separate but related content sections. Tabs has three parts, each with its own entry: Tabs.List, Tabs.Tab and Tabs.Panel.'
5
+ metadata:
6
+ tags: [tabs, tablist, tabpanel, navigation, views, tab, sections]
7
+ status:
8
+ status: beta
9
+ uses:
10
+ - to: tabs-list
11
+ - to: tab
12
+ - to: tabs-panel
13
+ sections:
14
+ - kind: guidelines
15
+ for: all
16
+ framing: when-to-use
17
+ title: When to use
18
+ items:
19
+ - level: should
20
+ statement: "When switching between different yet related views in the same context (for example, 'Content', 'Preview', 'History' in an inspector panel)."
21
+ - level: should
22
+ statement: Organizing sections within a settings or configuration screen.
23
+ - level: should
24
+ statement: Breaking a dense detail view into digestible categories without navigating away.
25
+ - level: should-not
26
+ statement: Navigating between separate pages or top-level routes. Use sidebar navigation or links instead.
27
+ alternatives:
28
+ - to: navigation
29
+ - to: link
30
+ - level: should-not
31
+ statement: Content that should all be visible at once. Use VStack to lay out sections vertically.
32
+ alternatives:
33
+ - to: v-stack
34
+ - level: should-not
35
+ statement: Changing how one view presents the content it already shows. Examples include a density toggle, a sort order, a chart time range. Use Select instead.
36
+ alternatives:
37
+ - to: select
38
+ - kind: guidelines
39
+ for: agent
40
+ framing: when-to-use
41
+ title: When to use
42
+ items:
43
+ - level: should-not
44
+ statement: "Don't use Tabs when the selection changes how a single view renders. Use Select or Radio instead."
45
+ alternatives:
46
+ - to: select
47
+ - to: radio
48
+ - kind: guidelines
49
+ for: all
50
+ framing: how-to-use
51
+ items:
52
+ - level: must
53
+ statement: Render Tabs with a value and an onValueChange handler. Tabs is controlled. The parent holds the selected value.
54
+ - level: must
55
+ statement: Give each Tabs.Tab and each Tabs.Panel the value of the tab it pairs with.
56
+ - level: must
57
+ statement: Keep each value unique within one Tabs. Tabs uses value to link each tab to its panel. A repeated value links the wrong pair.
58
+ - level: must-not
59
+ statement: 'Don''t use two values that differ only in spaces, such as "Draft notes" and "Draft-notes". Tabs turns spaces into hyphens in the ids it builds. Both values produce the same id.'
60
+ - level: must-not
61
+ statement: "Don't render Tabs.Tab or Tabs.Panel outside Tabs. They read the selected value from Tabs and throw an error without it."
62
+ - level: must-not
63
+ statement: Don't nest tabs within tabs.
64
+ - kind: guidelines
65
+ for: agent
66
+ framing: how-to-use
67
+ title: Child parts
68
+ items:
69
+ - level: must
70
+ statement: Tabs has three subcomponents, Tabs.List, Tabs.Tab and Tabs.Panel. Each has its own entry, `tabs-list`, `tab` and `tabs-panel`. Read each one's entry in `docs/components/` before you write it. Its props are not listed here.
71
+ - level: must
72
+ statement: Don't write a subcomponent's props from memory or from this entry. This entry does not list them.
73
+ - kind: guidelines
74
+ for: all
75
+ title: Accessibility
76
+ tags: [accessibility]
77
+ items:
78
+ - level: should
79
+ statement: Use Tabs.List, Tabs.Tab and Tabs.Panel together. They set the roles, ids and focus behavior that link each tab to its panel.
80
+ alternatives:
81
+ - to: link
82
+ refs:
83
+ - to: tabs-list
84
+ rel: relates-to
85
+ note: The row that holds the Tabs.Tab buttons.
86
+ - to: tab
87
+ rel: relates-to
88
+ note: The button that selects a Tabs.Panel.
89
+ - to: tabs-panel
90
+ rel: relates-to
91
+ note: The content for one tab.
92
+
93
+ sourceFiles:
94
+ - platform: react
95
+ file: packages/ui/src/components/tabs/Tabs.tsx
96
+ imports:
97
+ - platform: react
98
+ code: import { Tabs } from '@sanity/ui'
99
+ package: '@sanity/ui'
100
+ $extensions:
101
+ com.sanity.ui:
102
+ implementationStatus:
103
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
104
+ implemented: true
@@ -0,0 +1,170 @@
1
+ kind: component
2
+ id: text-area
3
+ name: TextArea
4
+ description: A multi-line text field for longer freeform text, like descriptions and comments.
5
+ metadata:
6
+ tags: [textarea, form, input, multiline, text, text input, description, comment]
7
+ status:
8
+ status: beta
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: when-to-use
13
+ title: When to use
14
+ items:
15
+ - level: should
16
+ statement: For multi-line freeform text input — descriptions, comments, summaries.
17
+ - level: should-not
18
+ statement: For single-line freeform text input. Use TextInput instead.
19
+ alternatives:
20
+ - to: text-input
21
+ - level: should-not
22
+ statement: For rich text editing. Use a dedicated editor component.
23
+ - kind: guidelines
24
+ for: all
25
+ framing: how-to-use
26
+ items:
27
+ - refs:
28
+ - to: forms#pair-with-visible-label
29
+ rel: same-as
30
+ - level: must
31
+ statement: Mark an invalid field with `hasError`. It renders no message. Add the error text yourself and link it with `aria-describedby`.
32
+ - refs:
33
+ - to: error-messaging#name-what-failed
34
+ rel: same-as
35
+ - refs:
36
+ - to: forms#error-described-in-text
37
+ rel: same-as
38
+ - refs:
39
+ - to: forms#mark-optional-fields
40
+ rel: same-as
41
+ - refs:
42
+ - to: forms#stack-fields-vertically
43
+ rel: same-as
44
+ - level: should
45
+ statement: Set `rows` to fit amount of expected text. The default is 5.
46
+ - level: should
47
+ statement: Use `autoResize` when vertical space is limited and/or the length of text entered can greatly vary. Pair it with `maxHeight`, such as `maxHeight="10rem"`. A long entry then scrolls instead of pushing the page down.
48
+ - level: should
49
+ statement: Use `density="loose"` in forms with wide spacing. `regular` is the default. Give every field in one form the same density.
50
+ - level: should
51
+ statement: Use placeholders that are fully visible within the bounds of the input.
52
+ - refs:
53
+ - to: shared-foundations#error-state-never-disabled
54
+ rel: same-as
55
+ - refs:
56
+ - to: forms#placeholder-not-a-label
57
+ rel: same-as
58
+ - level: must-not
59
+ statement: Don't use `readOnly` for long text people need to read or copy. A read-only TextArea ignores the pointer and mouse users can't scroll or select its text. Show the text with Text instead.
60
+ alternatives:
61
+ - to: text
62
+ - kind: guidelines
63
+ for: agent
64
+ framing: how-to-use
65
+ items:
66
+ - level: must-not
67
+ statement: Don't set `rows` to give an `autoResize` field a starting height. The field sizes to its content and starts one line tall. Browsers without CSS `field-sizing` ignore `autoResize` and use `rows`.
68
+ - level: must-not
69
+ statement: Don't set `aria-invalid` on TextArea by hand. TextArea writes `aria-invalid` from `hasError` after your props and overwrites a hand-set value. Use `hasError`.
70
+ - level: must-not
71
+ statement: >-
72
+ Don't pass layout or spacing props to TextArea. It takes the native textarea attributes plus `autoResize`, `density`, `hasError` and `maxHeight`. `margin`, `padding`, `flexGrow` and the like are TypeScript errors. TextArea always fills its container's width. Size it and space it from a wrapping Box or Flex.
73
+ - kind: guidelines
74
+ for: all
75
+ title: Accessibility
76
+ tags: [accessibility]
77
+ items:
78
+ - refs:
79
+ - to: forms#label-available-to-screen-readers
80
+ rel: same-as
81
+ - to: forms#programmatic-name-required
82
+ rel: same-as
83
+ - to: forms#border-contrast
84
+ rel: same-as
85
+ - to: forms#placeholder-contrast
86
+ rel: same-as
87
+ - to: forms#error-prop-needs-visible-message
88
+ rel: same-as
89
+ - to: forms#field-group-name
90
+ rel: same-as
91
+ alternatives:
92
+ - to: text-input
93
+ refs:
94
+ - href: https://www.figma.com/design/NWmchNlsNdG66VBaCsTdSL/pjo-ui4-component-buildout?node-id=38-85
95
+ rel: design
96
+ role: Figma component
97
+ sourceFiles:
98
+ - platform: react
99
+ file: packages/ui/src/components/text-area/TextArea.tsx
100
+ imports:
101
+ - platform: react
102
+ code: import { TextArea } from '@sanity/ui'
103
+ package: '@sanity/ui'
104
+ traits:
105
+ - traitType: state
106
+ kind: boolean
107
+ id: enabled
108
+ description: Resting state. Backdrop background with a high separator border. The border carries the states below; the background only moves for `disabled` and `readOnly`.
109
+ - traitType: state
110
+ kind: boolean
111
+ id: hovered
112
+ description: The border shifts one lightness step — darker in light mode, lighter in dark mode. In the error state it shifts from the error border.
113
+ - traitType: state
114
+ kind: boolean
115
+ id: focused
116
+ description: Focus outline on `:focus-visible`, offset from the border.
117
+ - traitType: state
118
+ kind: boolean
119
+ id: disabled
120
+ description: 'Inert background and a low separator border, with the text in the inert foreground color. `pointer-events: none` makes the field unclickable.'
121
+ - traitType: state
122
+ kind: boolean
123
+ id: read-only
124
+ description: 'Set with `readOnly`. Same inert background and low border as `disabled`, but the text keeps its normal color. `pointer-events: none` stops the mouse from scrolling or selecting the text. The field can still take keyboard focus.'
125
+ - traitType: state
126
+ kind: boolean
127
+ id: error
128
+ description: Set with the `hasError` prop, which adds `aria-invalid="true"` to the textarea. The error styling keys off that attribute. The border turns the error separator color and the text the error foreground color. It carries no message — supply that yourself.
129
+ - traitType: variant
130
+ kind: enum
131
+ id: density
132
+ description: Sets the field's padding. The type size stays at body size 1.
133
+ values:
134
+ - id: regular
135
+ description: Default. Horizontal padding {space-2}, vertical padding {space-1}.
136
+ - id: loose
137
+ description: Horizontal padding {space-3}, vertical padding {space-2}. For forms with wide spacing.
138
+ - traitType: variant
139
+ kind: boolean
140
+ id: autoResize
141
+ description: Grows and shrinks the field with its content, through CSS `field-sizing`. Ignores `rows`. Cap it with `maxHeight`, a CSS length that can vary by breakpoint.
142
+ $extensions:
143
+ com.sanity.ui:
144
+ implementationStatus:
145
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
146
+ implemented: true
147
+ migrationGuide:
148
+ context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
149
+ guidance: |-
150
+ TextArea is now a plain native textarea, without the sizing props. One `density` prop sets the spacing, and a boolean named `hasError` marks validation. `autoResize` and `maxHeight` are new.
151
+
152
+ ### Detailed list of differences
153
+
154
+ | v3 pattern | v5 pattern | Notes |
155
+ | :---- | :---- | :---- |
156
+ | `<TextArea fontSize={2} weight="medium" />` | `<TextArea />` | The type size is fixed at body size 1, in regular weight |
157
+ | `<TextArea padding={3} />` | `<TextArea density="loose" />` | `density` is `regular` or `loose`. Neither value reproduces a v3 `padding={3}` exactly |
158
+ | `<TextArea radius={2} border={false} />` | `<TextArea />` | The radius is fixed at step 2, and the border is always drawn |
159
+ | `<TextArea customValidity="Required" />` | `<TextArea hasError />` plus your own message | `hasError` sets `aria-invalid` and recolors the border and text. It renders no text |
160
+ | `<TextArea rows={…} />` | `<TextArea rows={…} />` | Unchanged. The default is now 5 |
161
+ | No v3 equivalent | `<TextArea autoResize maxHeight="10rem" />` | Grows with the content, up to `maxHeight` |
162
+ | All other native `<textarea>` attributes | Forwarded unchanged | Pass them as before |
163
+
164
+ ### Breaking changes
165
+
166
+ - **The v3 styling props are TypeScript errors.** `fontSize`, `weight`, `padding`, `radius`, `border` and `customValidity` are not TextArea props.
167
+ - **`hasError` replaces `customValidity`.** The old prop set the native validation message. The new one is styling plus `aria-invalid`. You own the message and where it appears.
168
+ - **`aria-invalid` follows `hasError`.** A hand-set `aria-invalid` is overwritten. Set `hasError` instead.
169
+ - **No resize handle.** People can't drag the corner to resize the field. Set `rows`, or use `autoResize`.
170
+ - **The width is no longer yours to set on the component.** TextArea fills its container. Size it from the parent.