@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.
- package/README.md +10 -0
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -59
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/avatar-counter.dsds.yaml +78 -0
- package/docs/components/avatar-stack.dsds.yaml +96 -0
- package/docs/components/avatar.dsds.yaml +115 -0
- package/docs/components/badge.dsds.yaml +126 -0
- package/docs/components/box.dsds.yaml +223 -0
- package/docs/components/button.dsds.yaml +296 -0
- package/docs/components/card.dsds.yaml +317 -0
- package/docs/components/checkbox.dsds.yaml +204 -0
- package/docs/components/code.dsds.yaml +169 -0
- package/docs/components/container.dsds.yaml +189 -0
- package/docs/components/dialog.dsds.yaml +343 -0
- package/docs/components/divider.dsds.yaml +93 -0
- package/docs/components/eyebrow.dsds.yaml +198 -0
- package/docs/components/flex.dsds.yaml +237 -0
- package/docs/components/grid.dsds.yaml +217 -0
- package/docs/components/h-stack.dsds.yaml +127 -0
- package/docs/components/heading.dsds.yaml +233 -0
- package/docs/components/hotkeys.dsds.yaml +60 -0
- package/docs/components/icon-button.dsds.yaml +227 -0
- package/docs/components/icon.dsds.yaml +275 -0
- package/docs/components/indicator-stack.dsds.yaml +98 -0
- package/docs/components/indicator.dsds.yaml +108 -0
- package/docs/components/inline.dsds.yaml +127 -0
- package/docs/components/kbd.dsds.yaml +59 -0
- package/docs/components/link.dsds.yaml +108 -0
- package/docs/components/list-button-item.dsds.yaml +103 -0
- package/docs/components/list-item-image.dsds.yaml +82 -0
- package/docs/components/list-item-text.dsds.yaml +80 -0
- package/docs/components/list-item.dsds.yaml +148 -0
- package/docs/components/list.dsds.yaml +162 -0
- package/docs/components/popover.dsds.yaml +214 -0
- package/docs/components/press-area.dsds.yaml +279 -0
- package/docs/components/radio.dsds.yaml +198 -0
- package/docs/components/select.dsds.yaml +214 -0
- package/docs/components/skip-to-content.dsds.yaml +110 -0
- package/docs/components/spinner.dsds.yaml +119 -0
- package/docs/components/switch.dsds.yaml +202 -0
- package/docs/components/tab.dsds.yaml +54 -0
- package/docs/components/tabs-list.dsds.yaml +56 -0
- package/docs/components/tabs-panel.dsds.yaml +54 -0
- package/docs/components/tabs.dsds.yaml +104 -0
- package/docs/components/text-area.dsds.yaml +170 -0
- package/docs/components/text-input.dsds.yaml +189 -0
- package/docs/components/text.dsds.yaml +268 -0
- package/docs/components/tooltip-group.dsds.yaml +90 -0
- package/docs/components/tooltip.dsds.yaml +216 -0
- package/docs/components/v-stack.dsds.yaml +155 -0
- package/docs/components/visually-hidden.dsds.yaml +112 -0
- package/docs/evals/cases.yaml +1319 -0
- package/docs/examples/checkbox-2.tsx +57 -0
- package/docs/examples/confirmation-dialogs-1.tsx +27 -0
- package/docs/examples/confirmation-dialogs-2.tsx +55 -0
- package/docs/examples/confirmation-dialogs-3.tsx +28 -0
- package/docs/examples/confirmation-dialogs-4.tsx +38 -0
- package/docs/examples/popover-1.tsx +48 -0
- package/docs/examples/popover-2.tsx +53 -0
- package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
- package/docs/foundations/color-guidelines.dsds.yaml +308 -0
- package/docs/foundations/content-guidelines.dsds.yaml +285 -0
- package/docs/foundations/semantics.dsds.yaml +125 -0
- package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
- package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
- package/docs/icons/icon-access-denied.dsds.yaml +40 -0
- package/docs/icons/icon-activity.dsds.yaml +40 -0
- package/docs/icons/icon-add-circle.dsds.yaml +14 -0
- package/docs/icons/icon-add-comment.dsds.yaml +34 -0
- package/docs/icons/icon-add-document.dsds.yaml +34 -0
- package/docs/icons/icon-add-user.dsds.yaml +30 -0
- package/docs/icons/icon-add.dsds.yaml +57 -0
- package/docs/icons/icon-api.dsds.yaml +17 -0
- package/docs/icons/icon-archive.dsds.yaml +44 -0
- package/docs/icons/icon-arrow-down.dsds.yaml +38 -0
- package/docs/icons/icon-arrow-left.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-right.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-top-right.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-up.dsds.yaml +44 -0
- package/docs/icons/icon-asterisk.dsds.yaml +18 -0
- package/docs/icons/icon-bar-chart.dsds.yaml +40 -0
- package/docs/icons/icon-basket.dsds.yaml +14 -0
- package/docs/icons/icon-bell.dsds.yaml +30 -0
- package/docs/icons/icon-bill.dsds.yaml +40 -0
- package/docs/icons/icon-binary-document.dsds.yaml +30 -0
- package/docs/icons/icon-block-content.dsds.yaml +30 -0
- package/docs/icons/icon-block-element.dsds.yaml +32 -0
- package/docs/icons/icon-blockquote.dsds.yaml +32 -0
- package/docs/icons/icon-bold.dsds.yaml +28 -0
- package/docs/icons/icon-bolt.dsds.yaml +18 -0
- package/docs/icons/icon-book.dsds.yaml +34 -0
- package/docs/icons/icon-bookmark-filled.dsds.yaml +14 -0
- package/docs/icons/icon-bookmark.dsds.yaml +14 -0
- package/docs/icons/icon-bottle.dsds.yaml +18 -0
- package/docs/icons/icon-bug.dsds.yaml +28 -0
- package/docs/icons/icon-bulb-filled.dsds.yaml +14 -0
- package/docs/icons/icon-bulb-outline.dsds.yaml +30 -0
- package/docs/icons/icon-calendar.dsds.yaml +36 -0
- package/docs/icons/icon-case.dsds.yaml +18 -0
- package/docs/icons/icon-chart-upward.dsds.yaml +40 -0
- package/docs/icons/icon-checkmark-circle.dsds.yaml +40 -0
- package/docs/icons/icon-checkmark.dsds.yaml +36 -0
- package/docs/icons/icon-chevron-down.dsds.yaml +46 -0
- package/docs/icons/icon-chevron-left.dsds.yaml +42 -0
- package/docs/icons/icon-chevron-right.dsds.yaml +42 -0
- package/docs/icons/icon-chevron-up.dsds.yaml +44 -0
- package/docs/icons/icon-circle.dsds.yaml +28 -0
- package/docs/icons/icon-clipboard-image.dsds.yaml +30 -0
- package/docs/icons/icon-clipboard.dsds.yaml +34 -0
- package/docs/icons/icon-clock.dsds.yaml +39 -0
- package/docs/icons/icon-close-circle.dsds.yaml +18 -0
- package/docs/icons/icon-close.dsds.yaml +51 -0
- package/docs/icons/icon-code-block.dsds.yaml +38 -0
- package/docs/icons/icon-code.dsds.yaml +40 -0
- package/docs/icons/icon-cog.dsds.yaml +38 -0
- package/docs/icons/icon-collapse.dsds.yaml +40 -0
- package/docs/icons/icon-color-wheel.dsds.yaml +30 -0
- package/docs/icons/icon-comment.dsds.yaml +38 -0
- package/docs/icons/icon-component.dsds.yaml +18 -0
- package/docs/icons/icon-compose-sparkles.dsds.yaml +36 -0
- package/docs/icons/icon-compose.dsds.yaml +38 -0
- package/docs/icons/icon-confetti.dsds.yaml +18 -0
- package/docs/icons/icon-controls.dsds.yaml +36 -0
- package/docs/icons/icon-copy.dsds.yaml +31 -0
- package/docs/icons/icon-credit-card.dsds.yaml +18 -0
- package/docs/icons/icon-crop.dsds.yaml +32 -0
- package/docs/icons/icon-cube.dsds.yaml +36 -0
- package/docs/icons/icon-dashboard.dsds.yaml +34 -0
- package/docs/icons/icon-database.dsds.yaml +40 -0
- package/docs/icons/icon-desktop.dsds.yaml +31 -0
- package/docs/icons/icon-diamond.dsds.yaml +18 -0
- package/docs/icons/icon-document-pdf.dsds.yaml +34 -0
- package/docs/icons/icon-document-remove.dsds.yaml +30 -0
- package/docs/icons/icon-document-sheet.dsds.yaml +34 -0
- package/docs/icons/icon-document-text.dsds.yaml +30 -0
- package/docs/icons/icon-document-video.dsds.yaml +30 -0
- package/docs/icons/icon-document-word.dsds.yaml +34 -0
- package/docs/icons/icon-document-zip.dsds.yaml +30 -0
- package/docs/icons/icon-document.dsds.yaml +52 -0
- package/docs/icons/icon-documents.dsds.yaml +30 -0
- package/docs/icons/icon-dot.dsds.yaml +32 -0
- package/docs/icons/icon-double-chevron-down.dsds.yaml +38 -0
- package/docs/icons/icon-double-chevron-left.dsds.yaml +34 -0
- package/docs/icons/icon-double-chevron-right.dsds.yaml +34 -0
- package/docs/icons/icon-double-chevron-up.dsds.yaml +36 -0
- package/docs/icons/icon-double-quote.dsds.yaml +14 -0
- package/docs/icons/icon-download.dsds.yaml +40 -0
- package/docs/icons/icon-drag-handle.dsds.yaml +28 -0
- package/docs/icons/icon-drop.dsds.yaml +30 -0
- package/docs/icons/icon-earth-americas.dsds.yaml +34 -0
- package/docs/icons/icon-earth-globe.dsds.yaml +34 -0
- package/docs/icons/icon-edit.dsds.yaml +34 -0
- package/docs/icons/icon-ellipsis-horizontal.dsds.yaml +32 -0
- package/docs/icons/icon-ellipsis-vertical.dsds.yaml +14 -0
- package/docs/icons/icon-empty.dsds.yaml +28 -0
- package/docs/icons/icon-enter-right.dsds.yaml +18 -0
- package/docs/icons/icon-enter.dsds.yaml +18 -0
- package/docs/icons/icon-envelope.dsds.yaml +34 -0
- package/docs/icons/icon-equal.dsds.yaml +14 -0
- package/docs/icons/icon-error-filled.dsds.yaml +14 -0
- package/docs/icons/icon-error-outline.dsds.yaml +38 -0
- package/docs/icons/icon-error-screen.dsds.yaml +14 -0
- package/docs/icons/icon-expand.dsds.yaml +36 -0
- package/docs/icons/icon-eye-closed.dsds.yaml +38 -0
- package/docs/icons/icon-eye-open.dsds.yaml +38 -0
- package/docs/icons/icon-face-happy.dsds.yaml +14 -0
- package/docs/icons/icon-face-indifferent.dsds.yaml +14 -0
- package/docs/icons/icon-face-sad.dsds.yaml +14 -0
- package/docs/icons/icon-feedback.dsds.yaml +30 -0
- package/docs/icons/icon-filter.dsds.yaml +38 -0
- package/docs/icons/icon-folder.dsds.yaml +36 -0
- package/docs/icons/icon-generate.dsds.yaml +18 -0
- package/docs/icons/icon-github.dsds.yaml +14 -0
- package/docs/icons/icon-groq.dsds.yaml +31 -0
- package/docs/icons/icon-hash.dsds.yaml +18 -0
- package/docs/icons/icon-heart-filled.dsds.yaml +18 -0
- package/docs/icons/icon-heart.dsds.yaml +18 -0
- package/docs/icons/icon-help-circle.dsds.yaml +38 -0
- package/docs/icons/icon-highlight.dsds.yaml +18 -0
- package/docs/icons/icon-home.dsds.yaml +28 -0
- package/docs/icons/icon-ice-cream.dsds.yaml +18 -0
- package/docs/icons/icon-image-remove.dsds.yaml +32 -0
- package/docs/icons/icon-image.dsds.yaml +36 -0
- package/docs/icons/icon-images.dsds.yaml +34 -0
- package/docs/icons/icon-inbox.dsds.yaml +14 -0
- package/docs/icons/icon-info-filled.dsds.yaml +14 -0
- package/docs/icons/icon-info-outline.dsds.yaml +38 -0
- package/docs/icons/icon-inline-element.dsds.yaml +32 -0
- package/docs/icons/icon-inline.dsds.yaml +18 -0
- package/docs/icons/icon-insert-above.dsds.yaml +32 -0
- package/docs/icons/icon-insert-below.dsds.yaml +32 -0
- package/docs/icons/icon-italic.dsds.yaml +28 -0
- package/docs/icons/icon-joystick.dsds.yaml +18 -0
- package/docs/icons/icon-json.dsds.yaml +36 -0
- package/docs/icons/icon-launch.dsds.yaml +34 -0
- package/docs/icons/icon-leave.dsds.yaml +35 -0
- package/docs/icons/icon-lemon.dsds.yaml +18 -0
- package/docs/icons/icon-link-removed.dsds.yaml +30 -0
- package/docs/icons/icon-link.dsds.yaml +36 -0
- package/docs/icons/icon-linkedin.dsds.yaml +14 -0
- package/docs/icons/icon-list.dsds.yaml +14 -0
- package/docs/icons/icon-lock.dsds.yaml +39 -0
- package/docs/icons/icon-logo-js.dsds.yaml +18 -0
- package/docs/icons/icon-logo-ts.dsds.yaml +18 -0
- package/docs/icons/icon-marker-removed.dsds.yaml +14 -0
- package/docs/icons/icon-marker.dsds.yaml +14 -0
- package/docs/icons/icon-master-detail.dsds.yaml +28 -0
- package/docs/icons/icon-menu.dsds.yaml +40 -0
- package/docs/icons/icon-microphone-slash.dsds.yaml +14 -0
- package/docs/icons/icon-microphone.dsds.yaml +14 -0
- package/docs/icons/icon-mobile-device.dsds.yaml +32 -0
- package/docs/icons/icon-moon.dsds.yaml +30 -0
- package/docs/icons/icon-number.dsds.yaml +30 -0
- package/docs/icons/icon-ok-hand.dsds.yaml +18 -0
- package/docs/icons/icon-olist.dsds.yaml +36 -0
- package/docs/icons/icon-overage.dsds.yaml +42 -0
- package/docs/icons/icon-package.dsds.yaml +34 -0
- package/docs/icons/icon-panel-left.dsds.yaml +38 -0
- package/docs/icons/icon-panel-right.dsds.yaml +40 -0
- package/docs/icons/icon-pause.dsds.yaml +32 -0
- package/docs/icons/icon-pin-filled.dsds.yaml +28 -0
- package/docs/icons/icon-pin-removed.dsds.yaml +14 -0
- package/docs/icons/icon-pin.dsds.yaml +32 -0
- package/docs/icons/icon-play.dsds.yaml +32 -0
- package/docs/icons/icon-plug.dsds.yaml +35 -0
- package/docs/icons/icon-presentation.dsds.yaml +18 -0
- package/docs/icons/icon-progress50.dsds.yaml +14 -0
- package/docs/icons/icon-progress75.dsds.yaml +14 -0
- package/docs/icons/icon-projects.dsds.yaml +14 -0
- package/docs/icons/icon-publish.dsds.yaml +38 -0
- package/docs/icons/icon-read-only.dsds.yaml +36 -0
- package/docs/icons/icon-redo.dsds.yaml +38 -0
- package/docs/icons/icon-refresh.dsds.yaml +38 -0
- package/docs/icons/icon-remove-circle.dsds.yaml +14 -0
- package/docs/icons/icon-remove.dsds.yaml +30 -0
- package/docs/icons/icon-reset.dsds.yaml +40 -0
- package/docs/icons/icon-restore.dsds.yaml +45 -0
- package/docs/icons/icon-retrieve.dsds.yaml +14 -0
- package/docs/icons/icon-retry.dsds.yaml +14 -0
- package/docs/icons/icon-revert.dsds.yaml +14 -0
- package/docs/icons/icon-robot.dsds.yaml +17 -0
- package/docs/icons/icon-rocket.dsds.yaml +34 -0
- package/docs/icons/icon-schema.dsds.yaml +36 -0
- package/docs/icons/icon-search.dsds.yaml +34 -0
- package/docs/icons/icon-select.dsds.yaml +38 -0
- package/docs/icons/icon-share.dsds.yaml +36 -0
- package/docs/icons/icon-sort.dsds.yaml +40 -0
- package/docs/icons/icon-sparkle.dsds.yaml +26 -0
- package/docs/icons/icon-sparkles.dsds.yaml +34 -0
- package/docs/icons/icon-spinner.dsds.yaml +38 -0
- package/docs/icons/icon-split-horizontal.dsds.yaml +32 -0
- package/docs/icons/icon-split-vertical.dsds.yaml +30 -0
- package/docs/icons/icon-square.dsds.yaml +18 -0
- package/docs/icons/icon-stack-compact.dsds.yaml +30 -0
- package/docs/icons/icon-stack.dsds.yaml +44 -0
- package/docs/icons/icon-star-filled.dsds.yaml +48 -0
- package/docs/icons/icon-star.dsds.yaml +51 -0
- package/docs/icons/icon-stop.dsds.yaml +32 -0
- package/docs/icons/icon-strikethrough.dsds.yaml +28 -0
- package/docs/icons/icon-string.dsds.yaml +38 -0
- package/docs/icons/icon-sun.dsds.yaml +30 -0
- package/docs/icons/icon-sync.dsds.yaml +36 -0
- package/docs/icons/icon-tablet-device.dsds.yaml +30 -0
- package/docs/icons/icon-tag.dsds.yaml +32 -0
- package/docs/icons/icon-tags.dsds.yaml +36 -0
- package/docs/icons/icon-target.dsds.yaml +14 -0
- package/docs/icons/icon-task.dsds.yaml +30 -0
- package/docs/icons/icon-terminal.dsds.yaml +30 -0
- package/docs/icons/icon-text.dsds.yaml +32 -0
- package/docs/icons/icon-th-large.dsds.yaml +34 -0
- package/docs/icons/icon-th-list.dsds.yaml +30 -0
- package/docs/icons/icon-thumbs-down.dsds.yaml +27 -0
- package/docs/icons/icon-thumbs-up.dsds.yaml +30 -0
- package/docs/icons/icon-tiers.dsds.yaml +18 -0
- package/docs/icons/icon-timeline.dsds.yaml +32 -0
- package/docs/icons/icon-toggle-arrow-right.dsds.yaml +39 -0
- package/docs/icons/icon-token.dsds.yaml +30 -0
- package/docs/icons/icon-transfer.dsds.yaml +32 -0
- package/docs/icons/icon-translate.dsds.yaml +32 -0
- package/docs/icons/icon-trash.dsds.yaml +34 -0
- package/docs/icons/icon-trend-upward.dsds.yaml +42 -0
- package/docs/icons/icon-triangle-outline.dsds.yaml +18 -0
- package/docs/icons/icon-trolley.dsds.yaml +18 -0
- package/docs/icons/icon-truncate.dsds.yaml +18 -0
- package/docs/icons/icon-twitter.dsds.yaml +18 -0
- package/docs/icons/icon-ulist.dsds.yaml +36 -0
- package/docs/icons/icon-unarchive.dsds.yaml +32 -0
- package/docs/icons/icon-underline.dsds.yaml +28 -0
- package/docs/icons/icon-undo.dsds.yaml +34 -0
- package/docs/icons/icon-unknown.dsds.yaml +36 -0
- package/docs/icons/icon-unlink.dsds.yaml +32 -0
- package/docs/icons/icon-unlock.dsds.yaml +41 -0
- package/docs/icons/icon-unpublish.dsds.yaml +38 -0
- package/docs/icons/icon-upload.dsds.yaml +40 -0
- package/docs/icons/icon-user.dsds.yaml +34 -0
- package/docs/icons/icon-users.dsds.yaml +34 -0
- package/docs/icons/icon-versions.dsds.yaml +14 -0
- package/docs/icons/icon-video.dsds.yaml +32 -0
- package/docs/icons/icon-warning-filled.dsds.yaml +14 -0
- package/docs/icons/icon-warning-outline.dsds.yaml +38 -0
- package/docs/icons/icon-wrench.dsds.yaml +18 -0
- package/docs/icons.dsds.yaml +768 -0
- package/docs/index.dsds.yaml +506 -0
- package/docs/overview/api-essentials.dsds.yaml +221 -0
- package/docs/overview/component-reference.dsds.yaml +213 -0
- package/docs/overview/installation.dsds.yaml +254 -0
- package/docs/overview/quick-start.dsds.yaml +317 -0
- package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
- package/docs/patterns/error-messaging.dsds.yaml +58 -0
- package/docs/patterns/forms.dsds.yaml +362 -0
- package/docs/patterns/layouts.dsds.yaml +403 -0
- package/docs/patterns/loading-states.dsds.yaml +41 -0
- package/docs/patterns/messaging.dsds.yaml +72 -0
- package/docs/patterns/navigation.dsds.yaml +153 -0
- package/docs/patterns/responsive.dsds.yaml +590 -0
- package/docs/tokens/color.dsds.yaml +1158 -0
- package/docs/tokens/container-widths.dsds.yaml +131 -0
- package/docs/tokens/content.dsds.yaml +258 -0
- package/docs/tokens/content.tokens.json +180 -0
- package/docs/tokens/dtcg/README.md +41 -0
- package/docs/tokens/dtcg/css/color.css +107 -0
- package/docs/tokens/dtcg/css/container.css +12 -0
- package/docs/tokens/dtcg/css/fontFamily.css +10 -0
- package/docs/tokens/dtcg/css/fontWeight.css +10 -0
- package/docs/tokens/dtcg/css/index.css +12 -0
- package/docs/tokens/dtcg/css/radius.css +14 -0
- package/docs/tokens/dtcg/css/semantic.css +42 -0
- package/docs/tokens/dtcg/css/shadow.css +22 -0
- package/docs/tokens/dtcg/css/space.css +16 -0
- package/docs/tokens/dtcg/css/typography.css +67 -0
- package/docs/tokens/dtcg/json/color.tokens.json +911 -0
- package/docs/tokens/dtcg/json/container.tokens.json +44 -0
- package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
- package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
- package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
- package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
- package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
- package/docs/tokens/dtcg/json/space.tokens.json +72 -0
- package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
- package/docs/tokens/font-family.dsds.yaml +79 -0
- package/docs/tokens/font-weight.dsds.yaml +103 -0
- package/docs/tokens/radius.dsds.yaml +153 -0
- package/docs/tokens/semantic.dsds.yaml +397 -0
- package/docs/tokens/shadow.dsds.yaml +125 -0
- package/docs/tokens/space.dsds.yaml +185 -0
- package/docs/tokens/typography.dsds.yaml +316 -0
- package/llms.txt +108 -0
- package/package.json +6 -3
- package/skills/sanity-ui-5/SKILL.md +158 -0
- package/skills/sanity-ui-5/references/component-choice.md +37 -0
- package/skills/sanity-ui-5/references/components.md +145 -0
- package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
- package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
- package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
- package/skills/sanity-ui-5/references/setup.md +177 -0
- package/skills/sanity-ui-5/references/silent-failures.md +33 -0
- package/skills/sanity-ui-5/references/taste.md +53 -0
- package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
- package/src/components/button/Button.tsx +14 -3
- package/src/components/button/button.css +23 -25
- package/src/components/button/button.props.ts +4 -0
- package/src/components/code/code.props.ts +3 -2
- package/src/components/eyebrow/Eyebrow.tsx +8 -3
- package/src/components/eyebrow/eyebrow.props.ts +10 -2
- package/src/components/heading/Heading.tsx +1 -1
- package/src/components/heading/heading.props.ts +4 -3
- package/src/components/popover/Popover.tsx +4 -3
- package/src/components/popover/popover.css +5 -3
- package/src/components/popover/popover.props.ts +9 -0
- package/src/components/text/text.props.ts +6 -1
- package/src/css/classes/system/typography.css +6 -6
- package/src/css/tokens/semantic.css +7 -7
- package/src/props/typography.ts +1 -5
- package/src/version.ts +2 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
kind: sanity.guide
|
|
2
|
+
id: installation
|
|
3
|
+
name: Installation
|
|
4
|
+
description: Everything needed to set up a React project for Sanity UI 5 — install, project files, TypeScript configuration and the entry file. The one place setup is documented.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- installation
|
|
8
|
+
- install
|
|
9
|
+
- setup
|
|
10
|
+
- getting-started
|
|
11
|
+
- react
|
|
12
|
+
- styles.css
|
|
13
|
+
- peer dependency
|
|
14
|
+
- overrides
|
|
15
|
+
- react-refractor
|
|
16
|
+
- ERESOLVE
|
|
17
|
+
- legacy-peer-deps
|
|
18
|
+
- tsconfig
|
|
19
|
+
- doctor
|
|
20
|
+
- package.json
|
|
21
|
+
- vite
|
|
22
|
+
- typescript
|
|
23
|
+
- polyfills
|
|
24
|
+
status:
|
|
25
|
+
status: stable
|
|
26
|
+
sections:
|
|
27
|
+
- kind: guidelines
|
|
28
|
+
for: all
|
|
29
|
+
framing: how-to-use
|
|
30
|
+
items:
|
|
31
|
+
- level: must
|
|
32
|
+
statement: The `styles.css` import is required. Without it, all components render as plain, unstyled HTML. No error is thrown.
|
|
33
|
+
- level: must
|
|
34
|
+
statement: Import `@sanity/ui/polyfills` on the line above the stylesheet. Tooltip and Dialog both need it. Both fail silently without it. Tooltips never appear in browsers that lack the Interest Invokers API. A Dialog backdrop click stops dismissing in Safari, where Escape and the close button still work.
|
|
35
|
+
- level: must
|
|
36
|
+
statement: Import the Sanity UI stylesheet before your own global CSS. Sanity UI puts only its global reset in a cascade layer, `sui.global`, so any of your CSS overrides the reset. Its component styles are not layered, so when your CSS and a component rule have the same specificity, the later import wins.
|
|
37
|
+
- level: must
|
|
38
|
+
statement: 'Use `PressArea` to make a non-interactive element interactive. `Box` and `Card` don''t accept `onClick`. To make a whole card, list row, or media tile clickable, wrap it in `PressArea` — `<PressArea onClick={...}><Card>…</Card></PressArea>` — which renders a real `<button>` (or an `<a>` with `as="a"`). Put padding and visual styling on the child `Card`/`Box`, not on `PressArea`. `PressArea` is interactive-only: don''t use it as a backdrop or layout wrapper, and never pass `as="div"` (use a styled `Box` for non-interactive surfaces).'
|
|
39
|
+
- refs:
|
|
40
|
+
- to: shared-foundations#install-alpha-not-ui-poc
|
|
41
|
+
rel: same-as
|
|
42
|
+
- level: must-not
|
|
43
|
+
statement: The exact specifier is `@sanity/ui/styles.css` — not `@sanity/ui/dist/styles.css` (wrong subpath) and not `@sanity/ui/styles` (missing the extension). Both wrong forms fail at the Vite dev-server level, not in the browser. The page never renders and no console error explains why.
|
|
44
|
+
- kind: guidelines
|
|
45
|
+
for: agent
|
|
46
|
+
framing: how-to-use
|
|
47
|
+
items:
|
|
48
|
+
- level: must
|
|
49
|
+
statement: '@sanity/ui v5 requires React 19.2 or later. Installing it in a project with React 18 will fail with ERESOLVE unless you add npm overrides or use --legacy-peer-deps.'
|
|
50
|
+
- level: must
|
|
51
|
+
statement: 'Install @sanity/ui with the `alpha` dist-tag, or with the exact v5 version you were given. If a task, a team or a lockfile names an exact version, use it as given. Never install a bare `@sanity/ui`: its `latest` tag is the pre-v5 line, and it resolves to the wrong major with no error.'
|
|
52
|
+
- level: must
|
|
53
|
+
statement: Install @sanity/icons without a dist-tag, or with the exact version you were given. Unlike @sanity/ui, its v5 line (5.2.1 and later) is already the package's `latest` tag.
|
|
54
|
+
- level: should
|
|
55
|
+
statement: Run `npx @sanity/ui@alpha doctor` before manually inspecting an entry file for a missing styles.css import or a tsconfig.json gap — it checks both (and package/icons install state, React/Node versions) in one pass.
|
|
56
|
+
- level: should
|
|
57
|
+
statement: 'For React 18 projects, add overrides to package.json before running install: { "overrides": { "react": "^19.2", "react-dom": "^19.2" } }. Use --legacy-peer-deps as a fallback if overrides are not an option.'
|
|
58
|
+
- level: should
|
|
59
|
+
statement: '@sanity/icons is a regular dependency of @sanity/ui v5, not a peer dependency — it installs on its own. Add it to your own package.json only because your app code imports icons directly, not because v5 needs you to.'
|
|
60
|
+
- level: should-not
|
|
61
|
+
statement: Do not add react-refractor to package.json. It is a regular dependency of @sanity/ui v5, not a peer dependency, and installs on its own.
|
|
62
|
+
- kind: guidelines
|
|
63
|
+
for: agent
|
|
64
|
+
framing: how-to-use
|
|
65
|
+
title: Project files
|
|
66
|
+
items:
|
|
67
|
+
- level: must
|
|
68
|
+
statement: "Add `@types/react` and `@types/react-dom` to `devDependencies`. Without them, every file reports `TS7016: Could not find a declaration file for module 'react'`. The error cascades, and components such as Switch, Radio and Card then look broken when nothing is wrong with them."
|
|
69
|
+
- level: must
|
|
70
|
+
statement: Add `@vitejs/plugin-react` to `devDependencies` in a Vite project. Without it the install and the type check both pass, and the dev server then fails to start with `ERR_MODULE_NOT_FOUND`.
|
|
71
|
+
- level: must-not
|
|
72
|
+
statement: Do not add `styled-components`. Version 5 does not use it.
|
|
73
|
+
- kind: guidelines
|
|
74
|
+
for: agent
|
|
75
|
+
framing: how-to-use
|
|
76
|
+
title: TypeScript configuration
|
|
77
|
+
items:
|
|
78
|
+
- level: must
|
|
79
|
+
statement: Write the `tsconfig.json` below as the project's first file, as written. It is the config Sanity UI's CLI writes for a new project (`npx @sanity/ui@alpha init`).
|
|
80
|
+
- level: must
|
|
81
|
+
statement: 'Keep `"jsx": "react-jsx"` in `compilerOptions`. Leaving it out causes the most common build failure in this library, `TS17004: Cannot use JSX unless the ''--jsx'' flag is provided`, on every component.'
|
|
82
|
+
- level: must
|
|
83
|
+
statement: 'Use TypeScript 5 or later, with `"moduleResolution": "bundler"`. Sanity UI''s types are reached through its `exports` map, which `"node"` and `"classic"` do not read.'
|
|
84
|
+
- level: should
|
|
85
|
+
statement: Keep `"app"` in `include`, even with no `app` folder. The CLI writes it so the same config fits projects that keep their sources in `app/`. A missing folder is not an error while `src` has files.
|
|
86
|
+
- level: must-not
|
|
87
|
+
statement: 'Do not add `compilerOptions` keys beyond the ones shown. An invented or misspelled key fails the build with `TS5023: Unknown compiler option`.'
|
|
88
|
+
- level: must-not
|
|
89
|
+
statement: Do not run a bare `tsc`. The config sets no `noEmit`, so it writes `.js` files beside your sources, and Vite loads those instead of the `.tsx` files. Type-check with `tsc --noEmit`, as the `build` script below does.
|
|
90
|
+
- level: must-not
|
|
91
|
+
statement: Do not change `tsconfig.json` while fixing a build. The cause of a build failure is almost always in the source under `src/`. Editing the config turns one error into an error on every file.
|
|
92
|
+
- kind: steps
|
|
93
|
+
for: all
|
|
94
|
+
ordered: true
|
|
95
|
+
title: Automatic setup (recommended)
|
|
96
|
+
items:
|
|
97
|
+
- title: Run the setup CLI
|
|
98
|
+
description: |-
|
|
99
|
+
```sh
|
|
100
|
+
npx @sanity/ui@alpha init
|
|
101
|
+
``` Detects your framework (Next.js, Remix, React Router, Vite, Astro, or plain React) and package manager, checks React and Node versions, installs `@sanity/ui@5` and `@sanity/icons` at matching versions, adds `import '@sanity/ui/styles.css'` to the detected entry file, reconciles `tsconfig.json` (creates it if missing, or adds only the missing required options), and writes `sanity-ui.json`. Prints the plan and asks for confirmation before writing anything.
|
|
102
|
+
`@sanity/ui`'s `latest` npm tag still points at the pre-v5 line — v5 only publishes under the `alpha` tag. Always pin `@sanity/ui@alpha`. A bare `@sanity/ui` install resolves to the wrong major. `init` is for new apps only. If it finds a pre-v5 `@sanity/ui` dependency, it stops with exit code 1.
|
|
103
|
+
- title: Flags
|
|
104
|
+
description: '`--dry` prints the plan and exits without changing anything. `--yes` / `-y` accepts every prompt with its default — use this for CI or when running through an agent. `--cwd <dir>` runs against a directory other than the current one. Without a TTY, `init` applies the plan and reports it. `--yes` only silences the confirmation prompt in an interactive terminal.'
|
|
105
|
+
- title: Verify an existing setup
|
|
106
|
+
description: |-
|
|
107
|
+
```sh
|
|
108
|
+
npx @sanity/ui@alpha doctor
|
|
109
|
+
``` Re-runs the same checks `init` verifies at the end of its run and prints a one-line fix for anything that fails: package and `@sanity/icons` installed, stylesheet resolves and is imported, `tsconfig.json` has the required options, React and Node versions. Read-only — it never writes anything. Run it first whenever a component renders unstyled or a build fails for no obvious reason.
|
|
110
|
+
If it finds `@sanity/ui` at a pre-v5 version, it prints a warning and exits with code 0 without running any checks.
|
|
111
|
+
- kind: steps
|
|
112
|
+
for: all
|
|
113
|
+
ordered: true
|
|
114
|
+
title: Install
|
|
115
|
+
items:
|
|
116
|
+
- title: Check your React version
|
|
117
|
+
description: '`@sanity/ui` requires React 19.2 or later. If your project has an older React version, `npm install` will fail with a peer dependency error.'
|
|
118
|
+
- title: 'New project: install React 19.2 first'
|
|
119
|
+
description: |-
|
|
120
|
+
Start with React 19.2:
|
|
121
|
+
|
|
122
|
+
```shell
|
|
123
|
+
npm install react@^19.2 react-dom@^19.2
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then add Sanity UI (pin the `alpha` tag — `@sanity/ui`'s `latest` npm tag is the pre-v5 line):
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
npm install @sanity/ui@alpha
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`@sanity/ui` depends on `@sanity/icons` and `react-refractor` directly — both install on their own. Add `@sanity/icons` to your own `package.json` if your app code imports icons directly. That keeps it from being a hidden transitive dependency:
|
|
133
|
+
|
|
134
|
+
```shell
|
|
135
|
+
npm install @sanity/icons
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Sanity UI 5 has no `styled-components` dependency and no theme provider. Skip both.
|
|
139
|
+
- title: 'Existing project with React 18: add npm overrides'
|
|
140
|
+
description: |-
|
|
141
|
+
Add `overrides` to your `package.json` before running install:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
"overrides": {
|
|
145
|
+
"react": "^19.2",
|
|
146
|
+
"react-dom": "^19.2"
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Then install:
|
|
151
|
+
|
|
152
|
+
```shell
|
|
153
|
+
npm install react@^19.2 react-dom@^19.2 @sanity/ui@alpha @sanity/icons
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
If you can't add overrides, use `--legacy-peer-deps`:
|
|
157
|
+
|
|
158
|
+
```shell
|
|
159
|
+
npm install @sanity/ui@alpha @sanity/icons --legacy-peer-deps
|
|
160
|
+
```
|
|
161
|
+
- kind: steps
|
|
162
|
+
for: all
|
|
163
|
+
ordered: true
|
|
164
|
+
title: Set up the entry point
|
|
165
|
+
items:
|
|
166
|
+
- title: Import the polyfills and the stylesheet
|
|
167
|
+
description: |-
|
|
168
|
+
Sanity UI 5 has no `ThemeProvider`. Import the polyfills and the stylesheet once, in the entry file.
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
import { createRoot } from 'react-dom/client'
|
|
172
|
+
import '@sanity/ui/polyfills' // Tooltip and Dialog need this; both fail silently without it
|
|
173
|
+
import '@sanity/ui/styles.css'
|
|
174
|
+
import App from './App'
|
|
175
|
+
|
|
176
|
+
createRoot(document.getElementById('root')!).render(<App />)
|
|
177
|
+
```
|
|
178
|
+
- kind: section
|
|
179
|
+
for: all
|
|
180
|
+
freeform:
|
|
181
|
+
- title: Project files to start from
|
|
182
|
+
body: |-
|
|
183
|
+
For a new Vite project, start from these files. Where you were given exact versions, write those in place of `alpha` and `^5.2.1`.
|
|
184
|
+
|
|
185
|
+
**`package.json`**
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"name": "my-app",
|
|
190
|
+
"private": true,
|
|
191
|
+
"version": "0.0.1",
|
|
192
|
+
"type": "module",
|
|
193
|
+
"scripts": {
|
|
194
|
+
"dev": "vite",
|
|
195
|
+
"build": "tsc --noEmit && vite build"
|
|
196
|
+
},
|
|
197
|
+
"dependencies": {
|
|
198
|
+
"react": "^19.2",
|
|
199
|
+
"react-dom": "^19.2",
|
|
200
|
+
"@sanity/ui": "alpha",
|
|
201
|
+
"@sanity/icons": "^5.2.1"
|
|
202
|
+
},
|
|
203
|
+
"devDependencies": {
|
|
204
|
+
"typescript": "^5",
|
|
205
|
+
"vite": "^6",
|
|
206
|
+
"@vitejs/plugin-react": "^4",
|
|
207
|
+
"@types/react": "^19",
|
|
208
|
+
"@types/react-dom": "^19"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**`vite.config.ts`**
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
import { defineConfig } from 'vite'
|
|
217
|
+
import react from '@vitejs/plugin-react'
|
|
218
|
+
|
|
219
|
+
export default defineConfig({
|
|
220
|
+
plugins: [react()],
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**`tsconfig.json`**:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"compilerOptions": {
|
|
229
|
+
"target": "ES2022",
|
|
230
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
231
|
+
"module": "esnext",
|
|
232
|
+
"moduleResolution": "bundler",
|
|
233
|
+
"jsx": "react-jsx",
|
|
234
|
+
"strict": true,
|
|
235
|
+
"esModuleInterop": true,
|
|
236
|
+
"skipLibCheck": true,
|
|
237
|
+
"resolveJsonModule": true,
|
|
238
|
+
"isolatedModules": true,
|
|
239
|
+
"moduleDetection": "force"
|
|
240
|
+
},
|
|
241
|
+
"include": ["src", "app"]
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
- kind: section
|
|
245
|
+
for: all
|
|
246
|
+
freeform:
|
|
247
|
+
- title: Package version note
|
|
248
|
+
body: |-
|
|
249
|
+
These docs track the current `@sanity/ui` v5 alpha line. The package is pre-1.0 and still changing. The docs may describe components or props that your installed copy does not yet export. To list what your copy ships:
|
|
250
|
+
```shell
|
|
251
|
+
node -e "console.log(Object.keys(require('@sanity/ui')))"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
When a doc and your installed package disagree, the package wins. Treat the docs as forward-looking.
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
kind: sanity.guide
|
|
2
|
+
id: quick-start
|
|
3
|
+
name: Quick start
|
|
4
|
+
description: A step-by-step tutorial for building a three-region admin interface with Sanity UI, covering layout, accessibility, and key component patterns.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- getting-started
|
|
8
|
+
- layout
|
|
9
|
+
- accessibility
|
|
10
|
+
- tutorial
|
|
11
|
+
- Box
|
|
12
|
+
- Flex
|
|
13
|
+
- Card
|
|
14
|
+
- Container
|
|
15
|
+
- VStack
|
|
16
|
+
- admin interface
|
|
17
|
+
- sidebar
|
|
18
|
+
- toolbar
|
|
19
|
+
status:
|
|
20
|
+
status: stable
|
|
21
|
+
sections:
|
|
22
|
+
- kind: guidelines
|
|
23
|
+
for: all
|
|
24
|
+
framing: how-to-use
|
|
25
|
+
items:
|
|
26
|
+
- level: must
|
|
27
|
+
statement: Place `SkipToContent` as the first focusable element in the layout, pointing to the main content region's `id`.
|
|
28
|
+
- level: must
|
|
29
|
+
statement: Never skip heading levels. Use one `<h1>` for the page title and `<h2>` for sidebar and card headings.
|
|
30
|
+
- refs:
|
|
31
|
+
- to: shared-foundations#container-inside-scroll-box
|
|
32
|
+
rel: same-as
|
|
33
|
+
- level: must
|
|
34
|
+
statement: Set `lang="en"` on the `<html>` element in `index.html` so screen readers can detect the page language (WCAG 3.1.1 A).
|
|
35
|
+
- level: must
|
|
36
|
+
statement: Add `flexWrap="wrap"` to every `Flex` with two or more children to prevent overflow at 320px.
|
|
37
|
+
- level: must
|
|
38
|
+
statement: Add `aria-label` to every icon-only button. A tooltip does not set an accessible name.
|
|
39
|
+
- level: should
|
|
40
|
+
statement: Use `VStack` for simple vertical lists with even spacing. Use `Flex flexDirection="column"` when you need `flexGrow`, `overflow`, `minHeight`, or full flex control.
|
|
41
|
+
- refs:
|
|
42
|
+
- to: shared-foundations#card-no-layout-props
|
|
43
|
+
rel: same-as
|
|
44
|
+
- level: must-not
|
|
45
|
+
statement: Do not add `Container` to app chrome (sidebar, toolbar). Use `Box` or `Flex` directly for those regions.
|
|
46
|
+
- refs:
|
|
47
|
+
- to: shared-foundations#card-not-for-structural-regions
|
|
48
|
+
rel: same-as
|
|
49
|
+
- kind: steps
|
|
50
|
+
for: all
|
|
51
|
+
ordered: true
|
|
52
|
+
title: Steps
|
|
53
|
+
items:
|
|
54
|
+
- title: 'Step 1: Create the outer shell'
|
|
55
|
+
description: |-
|
|
56
|
+
The outer shell is a `Flex` that fills the viewport. The sidebar and main area sit side by side. This assumes the project is set up as the `installation` guide shows: its `package.json`, `tsconfig.json` and entry file.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// src/App.tsx
|
|
60
|
+
import { useState } from 'react'
|
|
61
|
+
import { Box, Button, Flex, Heading, IconButton, SkipToContent } from '@sanity/ui'
|
|
62
|
+
import { MenuIcon } from '@sanity/icons/Menu'
|
|
63
|
+
|
|
64
|
+
const App = () => {
|
|
65
|
+
const [sidebarOpen, setSidebarOpen] = useState(true)
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Flex flexWrap="wrap" minHeight="100vh">
|
|
69
|
+
<SkipToContent href="#main-content" label="Skip to content" />
|
|
70
|
+
{sidebarOpen && (
|
|
71
|
+
<Box as="nav" aria-label="Main navigation" borderRight={[false, false, false, true]} flexBasis={['100%', '100%', '100%', '260px']} flexShrink={0}>
|
|
72
|
+
<Box padding={3}>
|
|
73
|
+
<Heading as="h2" size={1}>Studio</Heading>
|
|
74
|
+
</Box>
|
|
75
|
+
</Box>
|
|
76
|
+
)}
|
|
77
|
+
|
|
78
|
+
<Flex as="main" id="main-content" tabIndex={-1} flexBasis={['100%', '100%', '100%', '0']} flexDirection="column" flexGrow={1} minWidth="0" overflow="hidden">
|
|
79
|
+
<Box padding={3} borderBottom>
|
|
80
|
+
<Heading as="h1">All Documents</Heading>
|
|
81
|
+
</Box>
|
|
82
|
+
</Flex>
|
|
83
|
+
</Flex>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default App
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**What to notice:**
|
|
91
|
+
|
|
92
|
+
- `Box as="nav"` renders a `<nav>` element. Screen readers list it as a landmark.
|
|
93
|
+
- `Flex as="main"` renders a `<main>` element.
|
|
94
|
+
- `flexWrap="wrap"` on the outer Flex lets the sidebar stack above the content at narrow widths (WCAG 1.4.10).
|
|
95
|
+
- `minWidth="0"` on the main area prevents content from pushing the layout wider than the viewport.
|
|
96
|
+
- `as="h1"` on the page heading and `as="h2"` on the sidebar heading create a correct hierarchy.
|
|
97
|
+
- `SkipToContent` is the first focusable element. A keyboard user's first Tab press reveals it; activating it jumps focus to `#main-content`.
|
|
98
|
+
- title: 'Step 2: Add a toolbar with reflow'
|
|
99
|
+
description: |-
|
|
100
|
+
The toolbar holds the page title and an action button. Both wrap to separate lines on mobile.
|
|
101
|
+
|
|
102
|
+
Replace the `<Box padding={3} borderBottom>` inside `main` with:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { AddIcon } from '@sanity/icons/Add'
|
|
106
|
+
import { MenuIcon } from '@sanity/icons/Menu'
|
|
107
|
+
import { CloseIcon } from '@sanity/icons/Close'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<Box padding={3} borderBottom>
|
|
112
|
+
<Flex alignItems="center" justifyContent="space-between" flexWrap="wrap" gap={2}>
|
|
113
|
+
<Flex alignItems="center" gap={3} minWidth="0">
|
|
114
|
+
{!sidebarOpen && (
|
|
115
|
+
<IconButton
|
|
116
|
+
level="tertiary"
|
|
117
|
+
icon={MenuIcon}
|
|
118
|
+
aria-label="Show navigation"
|
|
119
|
+
onClick={() => setSidebarOpen(true)}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
<Heading truncate={1} as="h1">All Documents</Heading>
|
|
123
|
+
</Flex>
|
|
124
|
+
<Button text="New document" iconStart={AddIcon} />
|
|
125
|
+
</Flex>
|
|
126
|
+
</Box>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**What to notice:**
|
|
130
|
+
|
|
131
|
+
- `flexWrap="wrap"` is required on every `Flex` with two or more children. Without it the page overflows at 320px.
|
|
132
|
+
- `truncate={1}` on the Heading truncates long titles with an ellipsis.
|
|
133
|
+
- The `MenuIcon` button has `aria-label` because it has no visible text.
|
|
134
|
+
- Button `level` controls visual weight: `"primary"` is the default (solid, full visual weight).
|
|
135
|
+
- title: 'Step 3: Build the sidebar'
|
|
136
|
+
description: |-
|
|
137
|
+
Replace the sidebar placeholder with navigation links and a close button.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import { CloseIcon } from '@sanity/icons/Close'
|
|
141
|
+
import { Box, Flex, Heading, IconButton, Link, Text, VStack } from '@sanity/ui'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
<Box as="nav" aria-label="Main navigation" borderRight={[false, false, false, true]} flexBasis={['100%', '100%', '100%', '260px']} flexShrink={0} overflowY="auto">
|
|
146
|
+
<VStack>
|
|
147
|
+
<Box padding={3} borderBottom>
|
|
148
|
+
<Flex alignItems="center" justifyContent="space-between">
|
|
149
|
+
<Heading as="h2" size={1}>Studio</Heading>
|
|
150
|
+
<IconButton
|
|
151
|
+
level="tertiary"
|
|
152
|
+
icon={CloseIcon}
|
|
153
|
+
aria-label="Close navigation"
|
|
154
|
+
onClick={() => setSidebarOpen(false)}
|
|
155
|
+
/>
|
|
156
|
+
</Flex>
|
|
157
|
+
</Box>
|
|
158
|
+
<Box padding={3}>
|
|
159
|
+
<VStack gap={3}>
|
|
160
|
+
<Link href="/documents">Documents</Link>
|
|
161
|
+
<Link href="/authors">Authors</Link>
|
|
162
|
+
<Link href="/settings">Settings</Link>
|
|
163
|
+
</VStack>
|
|
164
|
+
</Box>
|
|
165
|
+
</VStack>
|
|
166
|
+
</Box>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**What to notice:**
|
|
170
|
+
|
|
171
|
+
- `VStack` lays children out in a column with even `gap` spacing. It exposes only `as` and `gap`. For full flex control, use `Flex flexDirection="column"`.
|
|
172
|
+
- `Link` renders a native `<a>` element and inherits color from the container. It adds an underline by default — use `underlined={false}` to remove it for nav links.
|
|
173
|
+
- title: 'Step 4: Add document cards'
|
|
174
|
+
description: |-
|
|
175
|
+
Create a scrollable list of cards below the toolbar.
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import { Badge, Card, Container } from '@sanity/ui'
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
const DOCUMENTS = [
|
|
183
|
+
{ title: 'Getting Started', status: 'Published' },
|
|
184
|
+
{ title: 'API Reference', status: 'Draft' },
|
|
185
|
+
{ title: 'Design Tokens', status: 'Published' },
|
|
186
|
+
]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Add this below the toolbar `Box`, still inside the `main` Flex:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<Box padding={4} flexGrow={1} overflowY="auto">
|
|
193
|
+
<Container>
|
|
194
|
+
<VStack gap={3}>
|
|
195
|
+
{DOCUMENTS.map((doc) => (
|
|
196
|
+
<Card key={doc.title}>
|
|
197
|
+
<Flex alignItems="center" justifyContent="space-between" flexWrap="wrap" gap={2}>
|
|
198
|
+
<VStack gap={2}>
|
|
199
|
+
<Heading as="h2">{doc.title}</Heading>
|
|
200
|
+
<Text as="p" size={1} muted>Last edited 2 hours ago</Text>
|
|
201
|
+
</VStack>
|
|
202
|
+
<Badge tone={doc.status === 'Published' ? 'positive' : 'caution'}>
|
|
203
|
+
{doc.status}
|
|
204
|
+
</Badge>
|
|
205
|
+
</Flex>
|
|
206
|
+
</Card>
|
|
207
|
+
))}
|
|
208
|
+
</VStack>
|
|
209
|
+
</Container>
|
|
210
|
+
</Box>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**What to notice:**
|
|
214
|
+
|
|
215
|
+
- `Container size={2}` caps the card list at the width of {container-2} and centers it. On a wide monitor the cards won't stretch edge to edge.
|
|
216
|
+
- `Container` goes inside the scroll `Box`, not around it. The `Box` handles `flexGrow` and `overflowY`; Container handles max-width only.
|
|
217
|
+
- Don't add Container to the sidebar or toolbar — those are app chrome and should fill their available width.
|
|
218
|
+
- `Card` is a content surface — it adds a background and border. Do not use it for structural regions like sidebars or toolbars.
|
|
219
|
+
- Layout props like `flexGrow` go on `Box`, not on `Card`. Passing one to Card is a TypeScript error.
|
|
220
|
+
- Each card heading is `as="h2"` because `as="h1"` is the page title above. Never skip heading levels.
|
|
221
|
+
- title: 'Step 5: Set the page language'
|
|
222
|
+
description: |-
|
|
223
|
+
In `index.html`, set `lang="en"` on the `<html>` element:
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<html lang="en">
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Without this, screen readers cannot detect the page language (WCAG 3.1.1 A).
|
|
230
|
+
- title: Run it
|
|
231
|
+
description: |-
|
|
232
|
+
```shell
|
|
233
|
+
npm run dev
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Open `http://localhost:5173`. You should see a sidebar with navigation links on the left and a document list on the right.
|
|
237
|
+
- kind: section
|
|
238
|
+
for: all
|
|
239
|
+
freeform:
|
|
240
|
+
- title: Overview
|
|
241
|
+
body: |-
|
|
242
|
+
This tutorial walks through building a three-region admin interface with Sanity UI. You will create a sidebar, a toolbar, and a content list — the same layout used in Sanity Studio.
|
|
243
|
+
|
|
244
|
+
**Before you start:** complete the steps in the `installation` guide. You should have `@sanity/ui@alpha` and `@sanity/icons` installed, plus a working entry file.
|
|
245
|
+
- title: What you will build
|
|
246
|
+
body: |-
|
|
247
|
+
A single-page app with:
|
|
248
|
+
|
|
249
|
+
- A collapsible sidebar (`<nav>`) with navigation links
|
|
250
|
+
- A toolbar with a page title and an action button
|
|
251
|
+
- A scrollable list of document cards with status badges
|
|
252
|
+
- Correct heading hierarchy, landmarks, keyboard access, and responsive reflow
|
|
253
|
+
- kind: section
|
|
254
|
+
for: all
|
|
255
|
+
freeform:
|
|
256
|
+
- title: What you built
|
|
257
|
+
body: |-
|
|
258
|
+
| Feature | How it works |
|
|
259
|
+
| :---- | :---- |
|
|
260
|
+
| Landmarks | `Box as="nav"` and `Flex as="main"` create `<nav>` and `<main>` for screen readers. |
|
|
261
|
+
| Responsive sidebar | `flexWrap="wrap"` on the outer Flex. At 320px the sidebar stacks above the content. |
|
|
262
|
+
| Toolbar reflow | `flexWrap="wrap"` on the toolbar Flex. Heading and button wrap at narrow widths. |
|
|
263
|
+
| Heading hierarchy | One `<h1>` for the page title. `<h2>` for sidebar and card headings. No skipped levels. |
|
|
264
|
+
| Page language | `<html lang="en">` in `index.html`. |
|
|
265
|
+
| Icon-only buttons | `aria-label` on every button without visible text. |
|
|
266
|
+
| Skip navigation | `SkipToContent` at the top of the layout. A keyboard user presses Tab to reveal it; activating it jumps focus to `#main-content`. |
|
|
267
|
+
| Navigation links | `Link` components in the sidebar. They render native `<a>` elements and inherit color from the container. |
|
|
268
|
+
- title: Key patterns
|
|
269
|
+
body: |-
|
|
270
|
+
### Box vs Flex vs Card vs Container
|
|
271
|
+
|
|
272
|
+
| Component | Use for | Adds a visual surface? |
|
|
273
|
+
| :---- | :---- | :---- |
|
|
274
|
+
| `Box` | Padding, borders, scroll containers, landmarks | No |
|
|
275
|
+
| `Flex` | Row/column layout with alignment and gap | No |
|
|
276
|
+
| `Card` | Content that needs a background, border, and tone | Yes |
|
|
277
|
+
| `Container` | Max-width constraint and horizontal centering for content areas | No |
|
|
278
|
+
|
|
279
|
+
Do not use `Card` for toolbars, sidebars, or scroll wrappers. Use `Box` or `Flex`. Do not use `Container` for app chrome — use `Box` or `Flex` directly.
|
|
280
|
+
|
|
281
|
+
### VStack vs Flex for vertical layout
|
|
282
|
+
|
|
283
|
+
| Use `VStack` | Use `Flex flexDirection="column"` |
|
|
284
|
+
| :---- | :---- |
|
|
285
|
+
| Simple vertical list with even spacing | Container needs `flexGrow`, `overflow`, or `minHeight` |
|
|
286
|
+
| Exposes only `as` and `gap` | Full flex control: `alignItems`, `justifyContent`, `flexWrap` |
|
|
287
|
+
|
|
288
|
+
### Card does not accept layout props
|
|
289
|
+
|
|
290
|
+
`Card` does not accept `flexGrow`, `minWidth`, `overflow`, or any other layout prop. Passing one directly is a TypeScript error (TS2322). Wrap it in a `Box`:
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
{/* ✗ — flexGrow on Card does nothing */}
|
|
294
|
+
<Card flexGrow={1}>...</Card>
|
|
295
|
+
|
|
296
|
+
{/* ✓ — Box handles layout, Card handles the surface */}
|
|
297
|
+
<Box flexGrow={1}>
|
|
298
|
+
<Card>...</Card>
|
|
299
|
+
</Box>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Icon-only buttons need aria-label
|
|
303
|
+
|
|
304
|
+
A tooltip does not set an accessible name. Add `aria-label`:
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
<IconButton icon={SearchIcon} level="tertiary" aria-label="Search" />
|
|
308
|
+
```
|
|
309
|
+
- title: Next steps
|
|
310
|
+
body: |-
|
|
311
|
+
- Add a right-side inspector panel with `Box as="aside" aria-label="Inspector"`.
|
|
312
|
+
- Use `tone` on Card and Button for status: Button accepts `"neutral" and `"critical"`. Card accepts `"neutral"`, `"positive"`, `"caution"`, `"critical"`, `"suggest"`. Always a critical Button with an icon.
|
|
313
|
+
- kind: section
|
|
314
|
+
for: agent
|
|
315
|
+
freeform:
|
|
316
|
+
- title: Intent
|
|
317
|
+
body: Use this guide to scaffold a three-region admin layout with Sanity UI, following correct accessibility, heading hierarchy, and responsive reflow patterns.
|