@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,590 @@
1
+ kind: sanity.pattern
2
+ id: responsive
3
+ name: Responsive
4
+ description: A complete reference for building responsive Sanity UI layouts using spacing tokens, breakpoint arrays, reflow patterns, grid columns, sizing props, text overflow, and overflow portal rules.
5
+ metadata:
6
+ tags:
7
+ - tutorial
8
+ - responsive
9
+ - layout
10
+ - breakpoints
11
+ - spacing
12
+ - grid
13
+ - flexbox
14
+ - overflow
15
+ - wcag
16
+ - accessibility
17
+ - tokens
18
+ - Responsive<T>
19
+ - flexWrap
20
+ - minHeight
21
+ - spacing tokens
22
+ - truncate
23
+ - portal
24
+ - 320px reflow
25
+ - gridTemplateColumns
26
+ status:
27
+ status: stable
28
+ sections:
29
+ - kind: guidelines
30
+ for: all
31
+ framing: how-to-use
32
+ items:
33
+ - level: must
34
+ statement: Add `flexWrap="wrap"` to every horizontal `Flex` row (toolbar, action bar, card actions) so layouts reflow at 320px without horizontal scrolling.
35
+ - level: must
36
+ statement: Add `minWidth="0"` to any flex child that contains text. Without it the child cannot shrink below its content size, causing overflow past the viewport.
37
+ - id: inside-scrollable-container-must-failure
38
+ level: must
39
+ statement: >-
40
+ Tooltip and Popover render in the browser's top layer, so a scrollable or `overflow: hidden` ancestor does not clip them. Set their boolean `portal` prop only when an ancestor with `transform`, `filter` or `contain` breaks their positioning.
41
+ - level: must
42
+ statement: Use spacing scale tokens (0–9) for all `padding`, `margin`, `gap`, `rowGap`, and `columnGap` props — never guess with inline pixel styles.
43
+ - level: must
44
+ statement: Use `minHeight="100vh"` on the outermost layout container, not `height="100vh"`. `height` clips content that is taller than the viewport.
45
+ - level: should
46
+ statement: Use `truncate` prop on `Text` and `Heading` for text truncation.
47
+ - level: should
48
+ statement: Use `maxWidth` instead of `width` for sidebars, so the element can collapse responsively.
49
+ - level: should
50
+ statement: Use `gridTemplateColumns={['1fr', '1fr', '1fr 1fr', 'repeat(3, 1fr)']}` for responsive card grids, or `repeat(auto-fill, minmax(240px, 1fr))` for fluid grids.
51
+ - level: should
52
+ statement: 'Use `truncate` with a responsive array to show more lines on wider viewports, for example `truncate={[1, 1, 2]}`. It takes a number, so an `undefined` slot would turn truncation off at that breakpoint; fill every slot up to the last one you set.'
53
+ - level: should
54
+ statement: Inline styles are acceptable only for values with no prop or token equivalent, such as arbitrary `gridTemplateColumns` strings, `transform` offsets, or CSS custom property overrides.
55
+ - level: must-not
56
+ statement: "Do not use `style={{ padding: '12px' }}` or similar inline styles for values that map to a spacing token prop."
57
+ - level: must-not
58
+ statement: "Do not use `style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}` — use `truncate={1}` on `Heading` or `Text` instead."
59
+ - level: must-not
60
+ statement: Do not use fixed pixel widths in `gridTemplateColumns`. Use `fr`, `auto`, or `minmax()` units.
61
+ - level: must-not
62
+ statement: >-
63
+ Do not give a sidebar a fixed `width` with `flexShrink={0}` at every width. It never collapses below that width, and the layout fails reflow at 320px. Use responsive `flexBasis`, `['100%', '100%', '100%', '260px']`, so the sidebar stacks on narrow screens, or switch it to an overlay below the desktop breakpoint. Write every slot in the array: an `undefined` slot resets a string prop like `flexBasis` to its default instead of inheriting the previous value.
64
+ - kind: section
65
+ for: all
66
+ freeform:
67
+ - title: Overview
68
+ body: Sanity UI experiences should work across all devices. A Sanity interface isn't done until it's responsive. This document covers spacing tokens, breakpoint arrays, reflow patterns, grid columns, sizing props, text overflow, and overflow portal rules for building responsive layouts.
69
+ - kind: section
70
+ for: all
71
+ freeform:
72
+ - title: 'Quick reference: breakpoints'
73
+ body: |-
74
+ Every layout prop accepting `Responsive<T>` also accepts an array. Each array position maps to a `min-width` breakpoint. Position `0` is the base (no media query — applies from 0px up, including 320px).
75
+
76
+ | Array index | Min-width | Typical target |
77
+ |-------------|-----------|----------------|
78
+ | `[0]` | none (base) | 320px — narrow mobile, 400% zoom |
79
+ | `[1]` | `360px` | Standard mobile |
80
+ | `[2]` | `600px` | Large phone / small tablet |
81
+ | `[3]` | `900px` | Tablet / small laptop |
82
+ | `[4]` | `1200px` | Desktop |
83
+ | `[5]` | `1800px` | Large desktop and ultra-wide |
84
+
85
+ An array has at most six slots; anything past `[5]` is ignored. `undefined` in a slot inherits the previous breakpoint's value only for props that take a keyword or a step: spacing and position steps, `flexDirection`, `flexWrap`, `alignItems`, `justifyContent`, `display`, `overflow`, `radius` and `size`. For props that take a CSS string or a number — `flexBasis`, `width`, `height`, the min and max sizes, the `grid*` template and placement props, `flexGrow`, `flexShrink`, `zIndex` and Text's `truncate` — and for the border, `muted`, `trim` and `fullWidth` toggles, an `undefined` slot resets the prop to its default. Write every slot for those.
86
+ - kind: section
87
+ for: all
88
+ freeform:
89
+ - title: 1. Spacing scale
90
+ body: |-
91
+ Every `padding`, `margin`, `gap`, `rowGap`, and `columnGap` prop maps to a CSS token. Use them — never guess with inline styles.
92
+
93
+ The steps and their common uses are in the Space scale entry's table (`space`).
94
+
95
+ **Most common values in practice:**
96
+ - `gap={2}`, {space-2} — toolbar icon-button rows
97
+ - `gap={3}`, {space-3} — standard flex row gaps
98
+ - `padding={3}`, {space-3} — default card / nav item padding
99
+ - `padding={4}`, {space-4} — content area padding
100
+
101
+ ```tsx
102
+ {/* ✗ Undiscoverable pixel values via inline style */}
103
+ <Box style={{ padding: '12px', gap: '8px' }} />
104
+
105
+ {/* ✓ Token-based — scales with user font-size settings */}
106
+ <Box padding={3} />
107
+ <Flex gap={2} />
108
+ ```
109
+ - kind: section
110
+ for: all
111
+ freeform:
112
+ - title: 2. Breakpoints and responsive arrays
113
+ body: |-
114
+ See the **Quick reference: breakpoints** table for the pixel values. This section covers syntax and patterns.
115
+
116
+ ### Syntax
117
+
118
+ ```tsx
119
+ {/* Single value — applies at all breakpoints */}
120
+ <Box padding={3} />
121
+
122
+ {/* Array — different value per breakpoint */}
123
+ <Box padding={[2, undefined, 3, 4]} />
124
+ {/* ^ ^ ^ ^
125
+ base 360px 600px 900px */}
126
+ ```
127
+
128
+ **`undefined` inherits only for keyword and step props.** On `padding`, `gap`, `flexDirection` and the other props that take a keyword or a step, `undefined` skips a breakpoint and keeps the previous value. On a prop that takes a CSS string or a number, such as `flexBasis`, `width` or `gridTemplateColumns`, an `undefined` slot resets the prop to its default at that breakpoint. Write every slot for those props.
129
+
130
+ ```tsx
131
+ {/* ✓ Correct — undefined skips 360px, uses 'row' from 600px up */}
132
+ <Flex flexDirection={['column', undefined, 'row']} />
133
+
134
+ {/* ✗ Wrong — flexBasis falls back to auto from 360px to 599px */}
135
+ <Box flexBasis={['100%', undefined, '260px']} />
136
+
137
+ {/* ✓ Correct — every slot written */}
138
+ <Box flexBasis={['100%', '100%', '260px']} />
139
+ ```
140
+
141
+ ### Common responsive patterns
142
+
143
+ **Layout direction — column on mobile, row on desktop:**
144
+ ```tsx
145
+ <Flex flexDirection={['column', undefined, 'row']} gap={[2, undefined, 4]}>
146
+ <Box flexBasis={['100%', '100%', '260px']} flexShrink={0}>Sidebar</Box>
147
+ <Box flexGrow={1} minWidth="0">Content</Box>
148
+ </Flex>
149
+ ```
150
+
151
+ **Padding — tighter on mobile:**
152
+ ```tsx
153
+ <Box padding={[2, undefined, 4]}>
154
+ {/* 8px on mobile, 20px on 600px+ */}
155
+ </Box>
156
+ ```
157
+
158
+ **Text size — larger at wider viewports:**
159
+ ```tsx
160
+ <Heading as="h1" size={[1, undefined, undefined, 3]} />
161
+ {/* size 1 on mobile, size 3 on 900px+ */}
162
+ ```
163
+
164
+ **Alignment — centered on mobile, start on desktop:**
165
+ ```tsx
166
+ <Text align={['center', undefined, 'start']} />
167
+ ```
168
+ - kind: section
169
+ for: all
170
+ freeform:
171
+ - title: 3. 320px reflow (WCAG 1.4.10)
172
+ body: |-
173
+ Layouts must work at 320px with no horizontal scrolling. This section covers two responsive-specific cases: the wrap that never triggers, and the overlay-sidebar alternative.
174
+
175
+ ### Fixed sidebar widths — the wrap that never triggers
176
+
177
+ ```tsx
178
+ {/* ✗ FAILS — sidebar won't collapse below 260px (no flexWrap, no flexShrink) */}
179
+ <Flex>
180
+ <Box width="260px" flexShrink={0}>Sidebar</Box>
181
+ <Box flexGrow={1}>Content</Box>
182
+ </Flex>
183
+
184
+ {/* ✗ ALSO FAILS — flexWrap is set, but the wrap never triggers at 375px */}
185
+ <Flex flexWrap="wrap" minHeight="100vh">
186
+ <Box width="260px">Sidebar</Box>
187
+ <Box flexGrow={1} minWidth="0">Content</Box>
188
+ </Flex>
189
+
190
+ {/* ✓ PASSES — both children claim a full row at narrow widths; sidebar takes 260px from 900px up */}
191
+ <Flex flexWrap="wrap" minHeight="100vh">
192
+ <Box
193
+ flexBasis={['100%', '100%', '100%', '260px']}
194
+ flexShrink={0}
195
+ >
196
+ Sidebar
197
+ </Box>
198
+ <Box
199
+ flexBasis={['100%', '100%', '100%', '0']}
200
+ flexGrow={1}
201
+ minWidth="0"
202
+ overflow="hidden"
203
+ >
204
+ Content
205
+ </Box>
206
+ </Flex>
207
+ ```
208
+
209
+ **Why "ALSO FAILS" fails.** At 375px, the 260px sidebar and main column fit on one row. The main column gets only 115px. `flexWrap` moves a child to a new row only when it can't fit. Here the sizes sum to less than the viewport, so no wrap occurs.
210
+
211
+ **The fix needs responsive `flexBasis` on both children.** At narrow widths both children want a full row (basis `"100%"`), summing to 200% and forcing the wrap. At a desktop breakpoint the sidebar wants `"260px"` and main wants `"0"` plus `flexGrow`, and they sit side-by-side.
212
+
213
+ > The stack pattern keeps the sidebar visible — full-width above the main content — on mobile. For app shells where the sidebar should be hidden by default and shown via a toggle, see the popover pattern below.
214
+
215
+ ### Toolbars with many buttons
216
+
217
+ The basic toolbar rule — `flexWrap="wrap"` and `gap={2}` on the heading-plus-buttons Flex. One case not covered by the basics: a toolbar with five or more buttons can still overflow at ≤375px even with `flexWrap`. Two fixes:
218
+
219
+ - Collapse labeled buttons to icon-only on mobile with a conditional render. Button's `text` is a plain string, not a responsive prop.
220
+ - Move secondary actions (Filter, Sort) into a `Popover` overflow.
221
+
222
+ ### Mobile navigation: popover instead of stack
223
+
224
+ For app shells with sidebars hidden by default on mobile, put the nav in a Popover opened from a menu button. This is the standard for mobile navigation. The browser handles Escape and outside clicks. Requires React state for `isDesktop` plus `window.matchMedia`, not pure CSS. The example below shows only the nav logic.
225
+
226
+ ```tsx
227
+ import { useEffect, useState } from 'react'
228
+ import type { ReactNode } from 'react'
229
+ import { Box, Flex, IconButton, Popover } from '@sanity/ui'
230
+ import { MenuIcon } from '@sanity/icons/Menu'
231
+
232
+ const DESKTOP_QUERY = '(min-width: 900px)'
233
+ const NAV_ID = 'app-nav'
234
+
235
+ function matchesDesktop() {
236
+ return typeof window !== 'undefined' && window.matchMedia(DESKTOP_QUERY).matches
237
+ }
238
+
239
+ const closeNav = () => document.getElementById(NAV_ID)?.hidePopover()
240
+
241
+ function AppShell({ nav, children }: { nav: (closeNav: () => void) => ReactNode; children: ReactNode }) {
242
+ const [isDesktop, setIsDesktop] = useState(matchesDesktop)
243
+
244
+ useEffect(() => {
245
+ const mq = window.matchMedia(DESKTOP_QUERY)
246
+ const onChange = (e: MediaQueryListEvent) => {
247
+ setIsDesktop(e.matches)
248
+ if (e.matches) closeNav() // the inline nav replaces the Popover on desktop
249
+ }
250
+ mq.addEventListener('change', onChange)
251
+ return () => mq.removeEventListener('change', onChange)
252
+ }, [])
253
+
254
+ const navContent = (
255
+ <Box as="nav" aria-label="Main navigation" padding={2}>
256
+ {nav(closeNav)}
257
+ </Box>
258
+ )
259
+
260
+ return (
261
+ <Flex minHeight="100vh">
262
+ {isDesktop && (
263
+ <Flex flexDirection="column" flexBasis="260px" flexShrink={0} tone="neutral" borderRight overflowY="auto">
264
+ {navContent}
265
+ </Flex>
266
+ )}
267
+
268
+ <Flex as="main" id="main" flexGrow={1} flexBasis="0" minWidth="0" overflow="hidden">
269
+ {!isDesktop && (
270
+ <Popover id={NAV_ID} placement="bottom-start" content={navContent}>
271
+ <IconButton icon={MenuIcon} level="tertiary" aria-label="Show navigation" />
272
+ </Popover>
273
+ )}
274
+ {children}
275
+ </Flex>
276
+ </Flex>
277
+ )
278
+ }
279
+ ```
280
+
281
+ **Why each piece matters:**
282
+
283
+ - `DESKTOP_QUERY = '(min-width: 900px)'` matches the §2 breakpoint table at index `[3]` ("tablet / small laptop"). Below 900px is "tablet and mobile."
284
+ - `useState(matchesDesktop)` starts the layout in the right mode, so there is no flash of the wrong nav on first render.
285
+ - The `onChange` handler closes the Popover when the viewport widens to desktop, because the inline nav replaces it.
286
+ - `closeNav` calls `hidePopover()` on the Popover by its `id`. Passing it to the nav means picking an item closes the Popover.
287
+ - Escape and outside clicks close the Popover natively, so the example needs no Escape handler.
288
+ - `flexBasis="260px"` and `flexShrink={0}` keep the sidebar at 260px from 900px up. Below 900px the nav is in the Popover, so the fixed size never blocks reflow.
289
+ - `tone="neutral"` on the nav applies the design system's theme-aware background. Do not use `style={{ background: 'var(--card-bg-color, #fff)' }}`. The `#fff` fallback breaks dark mode.
290
+ - `borderRight` shows a border on the inline nav only.
291
+ - `{!isDesktop && <Popover>}` limits the menu button to mobile and tablet.
292
+
293
+ **When to choose which:**
294
+
295
+ - **VStack** — reading-first layouts, dashboards, content pages where the sidebar above the main content on mobile is acceptable.
296
+ - **Popover** — app-like UIs where mobile users expect navigation hidden until summoned.
297
+
298
+ ### Secondary panels: the same rule applies
299
+
300
+ The popover pattern governs the primary sidebar. The same rule applies to every secondary panel — inspector panels, detail drawers, filter columns. Any panel that should be hidden on mobile must initialize with `matchesDesktop()`, not `true`.
301
+
302
+ ```tsx
303
+ {/* ✗ Inspector stays open on mobile — never hides */}
304
+ const [inspectorOpen, setInspectorOpen] = useState(true)
305
+
306
+ {/* ✓ Inspector defaults to closed on mobile, open on desktop */}
307
+ const [inspectorOpen, setInspectorOpen] = useState(matchesDesktop)
308
+ ```
309
+
310
+ The `onChange` handler should close all such panels when the viewport narrows:
311
+
312
+ ```tsx
313
+ const onChange = (e: MediaQueryListEvent) => {
314
+ setIsDesktop(e.matches)
315
+ if (!e.matches) {
316
+ setSidebarOpen(false)
317
+ setInspectorOpen(false) // close every secondary panel on resize to mobile
318
+ }
319
+ }
320
+ ```
321
+
322
+ Toggle buttons for secondary panels follow the same rule as the menu button: gate them on `!isDesktop` if the panel should only be togglable on mobile and tablet.
323
+ - kind: section
324
+ for: all
325
+ freeform:
326
+ - title: 4. Responsive Grid columns
327
+ body: |-
328
+ Grid's `gridTemplateColumns` prop accepts a responsive array. Use `fr` units and `repeat()` — never hardcode pixel widths.
329
+
330
+ ```tsx
331
+ {/* ✓ 1 column on mobile, 2 on tablet, 3 on desktop */}
332
+ <Grid
333
+ gridTemplateColumns={['1fr', '1fr', '1fr 1fr', 'repeat(3, 1fr)']}
334
+ gap={3}
335
+ >
336
+ {items.map(item => (
337
+ <Card key={item.id}>{item.title}</Card>
338
+ ))}
339
+ </Grid>
340
+ ```
341
+
342
+ **Use `minmax()` for fluid grids that don't require exact breakpoints:**
343
+ ```tsx
344
+ {/* Auto-fills columns, minimum 240px each, maximum 1fr */}
345
+ <Grid
346
+ gridTemplateColumns="repeat(auto-fill, minmax(240px, 1fr))"
347
+ gap={3}
348
+ >
349
+ ```
350
+
351
+ **Common column patterns:**
352
+
353
+ | Layout | `gridTemplateColumns` |
354
+ |--------|----------------------|
355
+ | Full-width single column | `'1fr'` |
356
+ | Two even columns | `'1fr 1fr'` or `'repeat(2, 1fr)'` |
357
+ | Sidebar + content | `'260px 1fr'` |
358
+ | Responsive 1→2→3 | `['1fr', '1fr', '1fr 1fr', 'repeat(3, 1fr)']` |
359
+ | Auto-fill fluid | `'repeat(auto-fill, minmax(240px, 1fr))'` |
360
+
361
+ **`gridColumn` on children for spanning:**
362
+ ```tsx
363
+ {/* Featured item spans all 3 columns */}
364
+ <Grid gridTemplateColumns="repeat(3, 1fr)" gap={3}>
365
+ <Box gridColumn="1 / -1"><Card>Featured</Card></Box>
366
+ <Card>Item A</Card>
367
+ <Card>Item B</Card>
368
+ </Grid>
369
+ ```
370
+ - kind: section
371
+ for: all
372
+ freeform:
373
+ - title: '5. Sizing: width, minWidth, maxWidth'
374
+ body: |-
375
+ Prefer `min-width` and `max-width` over fixed `width` whenever content may overflow or the container needs to collapse responsively.
376
+
377
+ ### Width vs minWidth vs maxWidth
378
+
379
+ | Prop | Use when |
380
+ |------|----------|
381
+ | `width` | The element must be exactly this size (icons, avatars, fixed UI chrome) |
382
+ | `minWidth` | The element must be at least this size but can grow |
383
+ | `maxWidth` | The element must not exceed this size but can shrink |
384
+ | `minWidth="0"` | The element is a flex child containing text that may overflow |
385
+
386
+ ### `minWidth="0"` on flex children
387
+
388
+ This is the most commonly missed prop. By default, a flex child's minimum size is its content size — it won't shrink below the longest word in a heading. Setting `minWidth="0"` allows the child to shrink past its content size, enabling text truncation and preventing overflow.
389
+
390
+ ```tsx
391
+ {/* ✗ Long heading in flex row pushes layout past viewport */}
392
+ <Flex gap={3}>
393
+ <Heading as="h2">A very long document title that overflows</Heading>
394
+ <IconButton icon={CloseIcon} aria-label="Close" />
395
+ </Flex>
396
+
397
+ {/* ✓ Heading container can shrink; text truncates instead of overflowing */}
398
+ <Flex gap={3}>
399
+ <Box flexGrow={1} minWidth="0">
400
+ <Heading as="h2" truncate={1}>A very long document title that overflows</Heading>
401
+ </Box>
402
+ <Box flexShrink={0}>
403
+ <IconButton icon={CloseIcon} aria-label="Close" />
404
+ </Box>
405
+ </Flex>
406
+ ```
407
+
408
+ ### When a positive `minWidth` is the right choice
409
+
410
+ `minWidth="0"` lets a flex child shrink to nothing. For "let this row wrap when content can't fit on one line," use a positive `minWidth`:
411
+
412
+ ```tsx
413
+ {/* ✗ minWidth="0" lets the title squash to nothing and overlap the actions */}
414
+ <Flex gap={2}>
415
+ <Box flexGrow={1} minWidth="0">
416
+ <Heading as="h2">Document title</Heading>
417
+ </Box>
418
+ <Button text="Edit" />
419
+ <Button text="Delete" />
420
+ </Flex>
421
+
422
+ {/* ✓ minWidth="200px" forces the row to wrap when content can't fit */}
423
+ <Flex gap={2} flexWrap="wrap">
424
+ <Box flexGrow={1} minWidth="200px">
425
+ <Heading as="h2">Document title</Heading>
426
+ </Box>
427
+ <Button text="Edit" />
428
+ <Button text="Delete" />
429
+ </Flex>
430
+ ```
431
+
432
+ **Decision rule:**
433
+
434
+ - Truncate text to one line: `minWidth="0"` plus `truncate={1}` on the heading or text.
435
+ - Wrap the row to a new line when content doesn't fit: a positive `minWidth` like `"200px"` or `"160px"`, plus `flexWrap="wrap"` on the parent.
436
+
437
+ ### height vs minHeight
438
+
439
+ | Prop | Behavior |
440
+ |------|----------|
441
+ | `height="100vh"` | Container is exactly 100vh — content that overflows is clipped or causes scroll on the inner element only |
442
+ | `minHeight="100vh"` | Container is at least 100vh but grows when stacked content is taller |
443
+
444
+ Always use `minHeight="100vh"` on the outermost layout container. `height="100vh"` is appropriate only when the container must scroll internally (for example, a sidebar with `overflowY="auto"`).
445
+
446
+ ```tsx
447
+ {/* ✗ Sidebar stacks above content but container clips at 100vh */}
448
+ <Flex flexWrap="wrap" height="100vh">
449
+
450
+ {/* ✓ Container grows to fit stacked content at narrow widths */}
451
+ <Flex flexWrap="wrap" minHeight="100vh">
452
+ ```
453
+ - kind: section
454
+ for: all
455
+ freeform:
456
+ - title: 6. Text overflow
457
+ body: |-
458
+ Use the `truncate` prop on `Text`, `Heading`, and `Eyebrow` to limit text to a set number of lines. `truncate={1}` clips to one line with an ellipsis using `text-overflow`. Values above `1` clamp with CSS `-webkit-line-clamp`. Both work inside flex and grid containers.
459
+
460
+ Truncate metadata and support labels only: titles, file names, authors, dates. Never truncate body text, including a preview of it in a list row. Clipping changes meaning. In a list row, show the title and metadata, and leave the body for the detail view.
461
+
462
+ ```tsx
463
+ {/* ✗ Inline overflow styles bypass the spacing scale and break in flex containers */}
464
+ <Heading
465
+ as="h2"
466
+ style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}
467
+ >
468
+ Long title
469
+ </Heading>
470
+
471
+ {/* ✓ Single-line truncation */}
472
+ <Heading as="h2" truncate={1}>Long title</Heading>
473
+
474
+ {/* ✓ Multi-line clamp on a long title in a list row */}
475
+ <Text size={1} weight="semibold" truncate={2}>
476
+ {document.title}
477
+ </Text>
478
+
479
+ {/* ✗ Clamped body text. The preview cuts the sentence mid-thought. */}
480
+ <Text size={1} truncate={2} as="p">
481
+ {document.bodyPreview}
482
+ </Text>
483
+
484
+ {/* ✓ The row shows the title and metadata. The body stays in the detail view. */}
485
+ <VStack gap={2}>
486
+ <Text size={1} weight="semibold" truncate={1}>{document.title}</Text>
487
+ <Text size={1} muted truncate={1}>{document.author} · {document.updatedAt}</Text>
488
+ </VStack>
489
+ ```
490
+
491
+ **`truncate` accepts a responsive array** — you can show more lines on wider viewports:
492
+
493
+ ```tsx
494
+ {/* A title: 1 line on mobile, 2 on tablet, unclamped on desktop */}
495
+ <Text size={1} weight="semibold" truncate={[1, 1, 2]}>
496
+ {document.title}
497
+ </Text>
498
+ ```
499
+ - kind: section
500
+ for: all
501
+ freeform:
502
+ - title: 7. Inline styles — when they are and are not appropriate
503
+ body: |-
504
+ In nearly every case where an inline style appears in generated code, a prop or component already handles it.
505
+
506
+ ### Never use inline styles for these — use the prop instead
507
+
508
+ | Inline style | Replace with |
509
+ |---|---|
510
+ | `style={{ padding: '12px' }}` | `padding={3}` |
511
+ | `style={{ gap: '8px' }}` | `gap={2}` (on Flex or Grid) |
512
+ | `style={{ width: '260px' }}` | `width="260px"` |
513
+ | `style={{ minWidth: '0' }}` | `minWidth="0"` |
514
+ | `style={{ height: '100vh' }}` | `height="100vh"` |
515
+ | `style={{ minHeight: '100vh' }}` | `minHeight="100vh"` |
516
+ | `style={{ overflow: 'hidden' }}` | `overflow="hidden"` |
517
+ | `style={{ overflowY: 'auto' }}` | `overflowY="auto"` |
518
+ | `style={{ flexGrow: 1 }}` | `flexGrow={1}` |
519
+ | `style={{ flexShrink: 0 }}` | `flexShrink={0}` |
520
+ | `style={{ display: 'flex' }}` | Use `<Flex>` instead of `<Box>` |
521
+ | `style={{ flexDirection: 'column' }}` | `flexDirection="column"` on Flex |
522
+ | `style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}` | `truncate={1}` on Heading or Text |
523
+ | `style={{ fontSize: '24px' }}` on an icon | Wrap in `<Text as="span" size={3}>` |
524
+ | `style={{ borderRadius: '4px' }}` | `radius={2}` on Box or use Card `density` |
525
+ | `style={{ background: 'var(--card-bg)' }}` on Box | Use a Card ancestor or `tone` on Box |
526
+
527
+ ### When inline styles are acceptable
528
+
529
+ Inline styles are appropriate only for values that have no prop equivalent and cannot be expressed with a spacing token:
530
+
531
+ ```tsx
532
+ {/* Acceptable — no prop for arbitrary string-based grid template */}
533
+ <Grid style={{ gridTemplateColumns: 'auto 1fr auto' }} />
534
+
535
+ {/* Acceptable — position offsets for custom absolute positioned elements */}
536
+ <Box position="absolute" style={{ top: '50%', transform: 'translateY(-50%)' }} />
537
+
538
+ {/* Acceptable — CSS custom property override for a specific instance */}
539
+ <Box style={{ '--border-color': 'var(--blue-500)' }} />
540
+ ```
541
+ - kind: section
542
+ for: all
543
+ freeform:
544
+ - title: '8. `overflow: hidden` and portal-dependent components'
545
+ body: |-
546
+ Tooltip and Popover render in the browser's top layer, so a container with `overflow="hidden"` or `overflowY="auto"` does not clip them. Set their boolean `portal` prop only when an ancestor with `transform`, `filter` or `contain` breaks their positioning.
547
+ - kind: section
548
+ for: all
549
+ freeform:
550
+ - title: 9. Responsive layout checklist
551
+ body: |-
552
+ Run through this before shipping any layout. A single missed item causes `spacing-and-reflow` to fail.
553
+
554
+ **Container**
555
+ - [ ] Outer layout Flex uses `minHeight` (not `height`)
556
+ - [ ] Outer layout Flex has `flexWrap="wrap"`
557
+
558
+ **Sidebar**
559
+ - [ ] A fixed sidebar width applies only from the desktop breakpoint up
560
+ - [ ] Below that, the sidebar stacks above the content (responsive `flexBasis`) or moves into a Popover
561
+ - [ ] Has `overflowY="auto"` if content scrolls
562
+
563
+ **Main content area**
564
+ - [ ] `flexGrow={1} flexShrink={1} flexBasis="0"` to fill remaining space
565
+ - [ ] `minWidth="0"` to prevent text overflow
566
+ - [ ] `overflow="hidden"` to contain long words and headings
567
+
568
+ **Every horizontal Flex row (toolbar, action bar, card actions)**
569
+ - [ ] `flexWrap="wrap"` present
570
+ - [ ] `gap={2}` or higher present (wrapping without gap creates collapsed-looking rows)
571
+
572
+ **Typography**
573
+ - [ ] Long headings inside flex rows are in a `minWidth="0"` wrapper
574
+ - [ ] Truncated text uses `truncate` prop, not inline overflow styles
575
+
576
+ **Spacing**
577
+ - [ ] All padding and margin use scale tokens (0–9), not inline px values
578
+ - [ ] All gap values use scale tokens, not inline px values
579
+
580
+ **Menus and popovers**
581
+ - [ ] Any Tooltip or Popover under a `transform`, `filter` or `contain` ancestor sets `portal`
582
+
583
+ **Grid**
584
+ - [ ] `gridTemplateColumns` uses `fr`, `auto`, or `minmax()` — not fixed pixel widths
585
+ - [ ] Responsive column count uses responsive array, not a single fixed value
586
+ - kind: section
587
+ for: agent
588
+ freeform:
589
+ - title: Intent
590
+ body: Use this guide to produce responsive Sanity UI layouts that pass WCAG 1.4.10 reflow at 320px, apply spacing tokens, use correct responsive array syntax, and configure portals for floating components in overflow containers.