@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,216 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: tooltip
|
|
3
|
+
name: Tooltip
|
|
4
|
+
description: A floating text label that shows information when a user hovers or focuses an element.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [tooltip, label, hover, focus, supplementary, help, hint, description]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: To explain the function of an icon-only button.
|
|
17
|
+
- level: should
|
|
18
|
+
statement: To provide supplementary information that enhances understanding but isn't critical for the task.
|
|
19
|
+
- level: should-not
|
|
20
|
+
statement: The information is necessary for the user to complete a task. Use inline text or banners instead.
|
|
21
|
+
- level: should-not
|
|
22
|
+
statement: To contain interactive elements such as buttons. Use Popover instead.
|
|
23
|
+
alternatives:
|
|
24
|
+
- to: popover
|
|
25
|
+
- level: should-not
|
|
26
|
+
statement: When you are restating text that is already visible on the screen.
|
|
27
|
+
- refs:
|
|
28
|
+
- to: tooltip#no-tooltip-on-disabled
|
|
29
|
+
rel: same-as
|
|
30
|
+
- id: tooltip-only-on-interactive-elements
|
|
31
|
+
level: must-not
|
|
32
|
+
statement: Never use Tooltip on a non-interactive element — text, a Badge, an Indicator, an Avatar, a bare Icon, or a Box or Card. Its trigger must be a button, a link, or a PressArea. Either put the information in visible text or wrap the non-interactive element in a PressArea.
|
|
33
|
+
- kind: guidelines
|
|
34
|
+
for: all
|
|
35
|
+
framing: how-to-use
|
|
36
|
+
items:
|
|
37
|
+
- level: must
|
|
38
|
+
statement: For an icon-only trigger, give the trigger its own aria-label and make it focusable (use IconButton or Button, not a bare Icon). Tooltip's content sets aria-describedby — a description, not the trigger's accessible name; a bare Icon is aria-hidden by default and cannot receive focus.
|
|
39
|
+
tags: [accessibility]
|
|
40
|
+
- level: should
|
|
41
|
+
statement: Limit text to a maximum of 50 characters where possible.
|
|
42
|
+
- level: should
|
|
43
|
+
statement: "Start with a verb if describing an action (for example, 'Edit profile' rather than 'Profile editor')."
|
|
44
|
+
- level: should
|
|
45
|
+
statement: Omit the Tooltip entirely when the label text is already visible next to the trigger.
|
|
46
|
+
- level: should
|
|
47
|
+
statement: "Wrap a toolbar of tooltipped triggers in TooltipGroup so the row's tooltips behave as one group."
|
|
48
|
+
uses:
|
|
49
|
+
- to: tooltip-group
|
|
50
|
+
- level: must-not
|
|
51
|
+
statement: Don't put interactive content like links or buttons inside a Tooltip — use Popover instead.
|
|
52
|
+
alternatives:
|
|
53
|
+
- to: popover
|
|
54
|
+
- id: no-tooltip-on-disabled
|
|
55
|
+
level: must-not
|
|
56
|
+
statement: A disabled or loading control does not trigger a Tooltip, because keyboard users cannot reach it. If the Tooltip must show on a disabled element, wrap that element in a PressArea and put the Tooltip on the PressArea.
|
|
57
|
+
refines:
|
|
58
|
+
- to: accessibility-guidelines#disabled-control-no-tooltip
|
|
59
|
+
- kind: guidelines
|
|
60
|
+
for: agent
|
|
61
|
+
framing: how-to-use
|
|
62
|
+
items:
|
|
63
|
+
- level: must
|
|
64
|
+
statement: Tooltip needs the entry-file setup in the `installation` guide. It is built on the Interest Invokers API, which is not yet in every browser, and without that setup tooltips do not show where it is missing.
|
|
65
|
+
- level: must
|
|
66
|
+
statement: Tooltip must appear on both hover and keyboard focus — not hover-only.
|
|
67
|
+
tags: [accessibility]
|
|
68
|
+
- level: must
|
|
69
|
+
statement: Tooltip wraps a single child element. It clones that child to inject aria-describedby — you do not need to wire it manually.
|
|
70
|
+
- level: must
|
|
71
|
+
statement: The child of Tooltip must be a single React element (not a string, fragment, or array).
|
|
72
|
+
- level: must
|
|
73
|
+
statement: The child must render an element that accepts interestfor — in practice a button or an anchor with href. Button and IconButton both work; a Box, Text, or bare Icon does not.
|
|
74
|
+
- level: must
|
|
75
|
+
statement: The label prop is called content. There is no text prop. Do not use `title` instead — it compiles, but it renders the browser's own tooltip, not this one.
|
|
76
|
+
- level: must
|
|
77
|
+
statement: There is no disabled prop. To suppress a tooltip conditionally, render the trigger with or without the Tooltip wrapper.
|
|
78
|
+
- level: should
|
|
79
|
+
statement: Set portal only when an ancestor clips or misplaces the label.
|
|
80
|
+
- level: may
|
|
81
|
+
statement: Set the same anchorName on a Tooltip and a Popover to attach both to one trigger, with the Tooltip nested inside the Popover.
|
|
82
|
+
- refs:
|
|
83
|
+
- to: tooltip#no-tooltip-on-disabled
|
|
84
|
+
rel: same-as
|
|
85
|
+
- level: must-not
|
|
86
|
+
statement: 'Using Tooltip for critical task information. Instead: Show necessary information inline — users should not be required to hover to find it.'
|
|
87
|
+
- kind: section
|
|
88
|
+
for: agent
|
|
89
|
+
freeform:
|
|
90
|
+
- title: How it works
|
|
91
|
+
body: |-
|
|
92
|
+
Tooltip renders its label as a popover hint and clones its child to attach `aria-describedby` and the `interestfor` attribute that shows it. Hover and focus handling comes from the Interest Invokers API rather than from React event handlers.
|
|
93
|
+
|
|
94
|
+
Clicking the trigger hides the label and suppresses it until the pointer leaves the trigger or focus moves away. This keeps a tooltip from covering whatever the click opened — a Popover on the same button, for example.
|
|
95
|
+
|
|
96
|
+
Positioning is CSS, not JavaScript. `placement` maps to a class that uses CSS anchor positioning, and viewport flipping comes from `position-try-fallbacks`.
|
|
97
|
+
- kind: section
|
|
98
|
+
for: all
|
|
99
|
+
freeform:
|
|
100
|
+
- title: Setup
|
|
101
|
+
body: |-
|
|
102
|
+
Tooltip is built on the Interest Invokers API (the `interestfor` attribute), which is not yet available in every browser. The entry-file setup in the `installation` guide loads a polyfill, only where the browser lacks native support. Without it, tooltips will not show in those browsers.
|
|
103
|
+
|
|
104
|
+
alternatives:
|
|
105
|
+
- to: popover
|
|
106
|
+
note: Use when the floating content is interactive or contains more than a short label. Share a trigger with a Tooltip via `anchorName`
|
|
107
|
+
refs:
|
|
108
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=33882-565
|
|
109
|
+
rel: design
|
|
110
|
+
role: Figma component (v5)
|
|
111
|
+
- to: tooltip-group
|
|
112
|
+
rel: relates-to
|
|
113
|
+
note: Wrap a toolbar of tooltips so they behave as one group.
|
|
114
|
+
- to: button
|
|
115
|
+
rel: relates-to
|
|
116
|
+
note: The most common trigger for a Tooltip
|
|
117
|
+
- to: icon-button
|
|
118
|
+
rel: relates-to
|
|
119
|
+
note: The most common trigger for a Tooltip
|
|
120
|
+
- to: indicator
|
|
121
|
+
rel: relates-to
|
|
122
|
+
note: Use a Tooltip for an indicator's meaning only when no adjacent text label is present. Wrap the Indicator in a PressArea so the Tooltip has a trigger.
|
|
123
|
+
sourceFiles:
|
|
124
|
+
- platform: react
|
|
125
|
+
file: packages/ui/src/components/tooltip/Tooltip.tsx
|
|
126
|
+
imports:
|
|
127
|
+
- platform: react
|
|
128
|
+
code: import { Tooltip } from '@sanity/ui'
|
|
129
|
+
package: '@sanity/ui'
|
|
130
|
+
traits:
|
|
131
|
+
- traitType: variant
|
|
132
|
+
kind: enum
|
|
133
|
+
id: placement
|
|
134
|
+
description: >-
|
|
135
|
+
Position of the floating label relative to its trigger. Keeps the label in
|
|
136
|
+
the viewport and clear of whatever sits next to the trigger. Each value
|
|
137
|
+
declares a fallback on the opposite side, so the browser flips the label
|
|
138
|
+
rather than letting it overflow.
|
|
139
|
+
values:
|
|
140
|
+
- id: top
|
|
141
|
+
description: Above the trigger, centered.
|
|
142
|
+
- id: top-start
|
|
143
|
+
description: Above, aligned to the start edge.
|
|
144
|
+
- id: top-end
|
|
145
|
+
description: Above, aligned to the end edge.
|
|
146
|
+
- id: right
|
|
147
|
+
description: >-
|
|
148
|
+
Right of the trigger, centered. For narrow sidebars where vertical
|
|
149
|
+
space is limited.
|
|
150
|
+
- id: right-start
|
|
151
|
+
description: Right, aligned to the start edge.
|
|
152
|
+
- id: right-end
|
|
153
|
+
description: Right, aligned to the end edge.
|
|
154
|
+
- id: bottom
|
|
155
|
+
description: >-
|
|
156
|
+
Below the trigger, centered. The default. The safe default for a
|
|
157
|
+
toolbar or an inline control.
|
|
158
|
+
- id: bottom-start
|
|
159
|
+
description: Below, aligned to the start edge.
|
|
160
|
+
- id: bottom-end
|
|
161
|
+
description: Below, aligned to the end edge.
|
|
162
|
+
- id: left
|
|
163
|
+
description: >-
|
|
164
|
+
Left of the trigger, centered. For narrow sidebars where vertical
|
|
165
|
+
space is limited.
|
|
166
|
+
- id: left-start
|
|
167
|
+
description: Left, aligned to the start edge.
|
|
168
|
+
- id: left-end
|
|
169
|
+
description: Left, aligned to the end edge.
|
|
170
|
+
- traitType: variant
|
|
171
|
+
kind: boolean
|
|
172
|
+
id: portal
|
|
173
|
+
description: >-
|
|
174
|
+
Renders the floating label into document.body through a React portal
|
|
175
|
+
instead of inline. Rarely needed — the label already sits in the browser's
|
|
176
|
+
top layer, so overflow ancestors do not clip it. Reach for it when an
|
|
177
|
+
ancestor with transform, filter, or contain creates a containing block
|
|
178
|
+
that breaks anchor positioning. Portalled content does not render during
|
|
179
|
+
server-side rendering.
|
|
180
|
+
$extensions:
|
|
181
|
+
com.sanity.ui:
|
|
182
|
+
implementationStatus:
|
|
183
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
184
|
+
implemented: true
|
|
185
|
+
migrationGuide:
|
|
186
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
187
|
+
guidance: |-
|
|
188
|
+
The v3 Tooltip was positioned by Floating UI, rendered through a portal, and configured with a large set of props. The v5 Tooltip is built on Interest Invokers, the Popover API, and CSS anchor positioning, so most of that configuration is now handled by the browser.
|
|
189
|
+
|
|
190
|
+
### **Key differences**
|
|
191
|
+
|
|
192
|
+
- **`content` keeps its name.** The prop that holds the label is `content` in both versions.
|
|
193
|
+
- **Positioning is CSS, not JavaScript.** Floating UI is gone. `placement` maps to a CSS class, and viewport flipping uses `position-try-fallbacks`.
|
|
194
|
+
- **No `disabled` prop.** Conditionally render the trigger with or without the Tooltip wrapper instead.
|
|
195
|
+
- **`TooltipDelayGroupProvider` is replaced by `TooltipGroup`**, which is a rendered element rather than a context provider.
|
|
196
|
+
- **Card styling props are gone.** v3 rendered a `TooltipCard` and accepted `radius`, `shadow`, `padding`, and `scheme`. v5 applies a fixed surface style.
|
|
197
|
+
- **No arrow.** The `arrow` prop is removed.
|
|
198
|
+
- **The polyfills entry point is now required.** See Setup.
|
|
199
|
+
|
|
200
|
+
### **Detailed list of differences**
|
|
201
|
+
|
|
202
|
+
| v3 prop | v5 prop | Notes |
|
|
203
|
+
| :---- | :---- | :---- |
|
|
204
|
+
| `content` | `content` | Same purpose |
|
|
205
|
+
| `children` | `children` | Now required, and must render a `<button>` or `<a href>` |
|
|
206
|
+
| `placement` | `placement` | Same values, same default (`'bottom'`) |
|
|
207
|
+
| `portal` | `portal` | Now `boolean` only; v3 also accepted a portal name string |
|
|
208
|
+
| `disabled` | — | Removed. Conditionally render the Tooltip wrapper instead. |
|
|
209
|
+
| `arrow` | — | Removed |
|
|
210
|
+
| `animate` | — | Removed. The show and hide transition is always applied. |
|
|
211
|
+
| `fallbackPlacements`, `allowedAutoPlacements` | — | Removed. CSS `position-try-fallbacks` flips the tooltip automatically. |
|
|
212
|
+
| `boundaryElement` | — | Removed. The viewport is the boundary. |
|
|
213
|
+
| `radius`, `shadow`, `padding`, `scheme` | — | Removed. The tooltip surface has a fixed style. |
|
|
214
|
+
| `zOffset`, `onActivate` | — | Removed. The browser's top layer handles stacking. |
|
|
215
|
+
| — | `anchorName` | New. Share one trigger between a Tooltip and a Popover. |
|
|
216
|
+
| `TooltipDelayGroupProvider` | `TooltipGroup` | Now a rendered element, not a context provider |
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: v-stack
|
|
3
|
+
name: VStack
|
|
4
|
+
description: Stacks children vertically with even spacing.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [layout, vertical, stack, column, gap, form, vstack, list, flex]
|
|
7
|
+
status:
|
|
8
|
+
status: stable
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: 'For common layouts with uniform vertical spacing: form fields, item collections, and sequential controls or content.'
|
|
17
|
+
- level: should-not
|
|
18
|
+
statement: For horizontal stacking. Use HStack or Flex instead.
|
|
19
|
+
alternatives:
|
|
20
|
+
- to: h-stack
|
|
21
|
+
- to: flex
|
|
22
|
+
- level: should-not
|
|
23
|
+
statement: For vertical layouts needing custom alignment or wrapping. Use Flex instead.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: flex
|
|
26
|
+
- level: should-not
|
|
27
|
+
statement: For two-axis layouts. Use Grid instead.
|
|
28
|
+
alternatives:
|
|
29
|
+
- to: grid
|
|
30
|
+
- kind: guidelines
|
|
31
|
+
for: all
|
|
32
|
+
framing: how-to-use
|
|
33
|
+
items:
|
|
34
|
+
- level: should
|
|
35
|
+
statement: "Size the gap to the content: {space-1} between a label and its input, {space-3} between form fields, and {space-4} or more between sections. The full scale is in the Space scale entry's table (`space`)."
|
|
36
|
+
- level: should
|
|
37
|
+
statement: Wrap VStack with Box when padding or margin values are needed.
|
|
38
|
+
- id: don-vstack-need-alignitems-justifycontent
|
|
39
|
+
level: must-not
|
|
40
|
+
statement: "Don't use VStack when you need alignItems, justifyContent, flexWrap, or any other flex prop — use Flex with flexDirection='column'. VStack only accepts `as` and `gap`. Passing any other prop is a TypeScript error."
|
|
41
|
+
refines:
|
|
42
|
+
- to: v-stack#do-not-use-vstack-for-centered-or-space-between-layouts-use-flex-flexdirection-column-justifycontent-center-instead-instead-use-flex-with-flexdirection-column-and-the-appropriate-alignitems-or-justifycontent
|
|
43
|
+
- level: must-not
|
|
44
|
+
statement: Don't add margin to children for spacing — use gap.
|
|
45
|
+
- kind: guidelines
|
|
46
|
+
for: agent
|
|
47
|
+
framing: how-to-use
|
|
48
|
+
items:
|
|
49
|
+
- level: must-not
|
|
50
|
+
statement: "VStack accepts only as and gap. Don't pass any other prop directly as a JSX attribute (padding, tone, width/height, position, border, alignItems, justifyContent, flexGrow, overflowY)."
|
|
51
|
+
- level: must-not
|
|
52
|
+
statement: 'Do not use VStack for centered or space-between layouts. Use `<Flex flexDirection="column" justifyContent="center">` instead. Instead: Use Flex with flexDirection=''column'' and the appropriate alignItems or justifyContent.'
|
|
53
|
+
|
|
54
|
+
- kind: guidelines
|
|
55
|
+
for: all
|
|
56
|
+
title: Accessibility
|
|
57
|
+
tags: [accessibility]
|
|
58
|
+
items:
|
|
59
|
+
- level: should
|
|
60
|
+
statement: Using `as="ul"` or `as="ol"` with VStack needs extra setup. Children must be `<li>` elements and `role="list"` must be applied.
|
|
61
|
+
- id: v-stack-dom-order-not-css-order
|
|
62
|
+
level: must-not
|
|
63
|
+
statement: Don’t use CSS to change the visual order of VStack's children. Children render in DOM order–meaning screen readers will not detect CSS order changes.
|
|
64
|
+
- kind: section
|
|
65
|
+
for: agent
|
|
66
|
+
freeform:
|
|
67
|
+
- title: VStack vs Flex column
|
|
68
|
+
body: |-
|
|
69
|
+
VStack only accepts `as` and `gap`. Passing any other prop directly is a TypeScript error.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
// correct — gap is the only spacing control
|
|
73
|
+
<VStack gap={4}>
|
|
74
|
+
<Heading as="h2">Title</Heading>
|
|
75
|
+
<Text>Body text</Text>
|
|
76
|
+
</VStack>
|
|
77
|
+
|
|
78
|
+
// wrong — TS2322: padding and alignItems do not exist on VStack
|
|
79
|
+
<VStack gap={4} padding={4} alignItems="center">
|
|
80
|
+
...
|
|
81
|
+
</VStack>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
When you need padding, alignment, or distribution, use `Flex`:
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<Flex flexDirection="column" gap={4} padding={4} alignItems="center">
|
|
88
|
+
<Heading as="h2">Title</Heading>
|
|
89
|
+
<Text>Body text</Text>
|
|
90
|
+
</Flex>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
alternatives:
|
|
94
|
+
- to: flex
|
|
95
|
+
note: Column or row layout with full flex control
|
|
96
|
+
- to: h-stack
|
|
97
|
+
note: Horizontal row, aligned to center
|
|
98
|
+
- to: grid
|
|
99
|
+
note: Two-axis layout
|
|
100
|
+
refs:
|
|
101
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32600-2620
|
|
102
|
+
rel: design
|
|
103
|
+
role: Figma component (v5)
|
|
104
|
+
- to: space
|
|
105
|
+
rel: relates-to
|
|
106
|
+
sourceFiles:
|
|
107
|
+
- platform: react
|
|
108
|
+
file: packages/ui/src/components/v-stack/VStack.tsx
|
|
109
|
+
imports:
|
|
110
|
+
- platform: react
|
|
111
|
+
code: import { VStack } from '@sanity/ui'
|
|
112
|
+
package: '@sanity/ui'
|
|
113
|
+
$extensions:
|
|
114
|
+
com.sanity.ui:
|
|
115
|
+
implementationStatus:
|
|
116
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
117
|
+
implemented: true
|
|
118
|
+
migrationGuide:
|
|
119
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
120
|
+
codemod: |-
|
|
121
|
+
VStack replaces `@sanity/ui`'s Stack used in its default vertical direction. `space`→`gap`; `sizing` is removed with no replacement. A Stack that used padding, margin, overflow, or flex props migrates to `Flex flexDirection="column"` instead, since VStack accepts only `gap` and `as`.
|
|
122
|
+
|
|
123
|
+
Run the codemod: `pnpx @sanity/ui-codemod latest:stack --paths <paths> --toPackage @sanity/ui`. It chooses VStack or Flex per instance depending on which props are present.
|
|
124
|
+
guidance: |-
|
|
125
|
+
VStack replaces `@sanity/ui`'s Stack component, used with its default vertical direction. The API changes are:
|
|
126
|
+
|
|
127
|
+
### Key differences
|
|
128
|
+
|
|
129
|
+
- `space` renamed to `gap`, matching the prop name used across other v5 layout components.
|
|
130
|
+
- `sizing` removed. v3's `sizing` prop has no v5 equivalent — use `style={{ boxSizing: '...' }}` directly if needed.
|
|
131
|
+
- A v3 Stack that used padding, margin, overflow, or flex props migrates to `Flex flexDirection="column"` instead of VStack, since VStack accepts only `gap` and `as`.
|
|
132
|
+
|
|
133
|
+
### Detailed list of differences
|
|
134
|
+
|
|
135
|
+
| v3 prop | v5 prop | Notes |
|
|
136
|
+
| :---- | :---- | :---- |
|
|
137
|
+
| `space` | `gap` | Renamed. Same scale (`0`–`9`, `'inherit'`). |
|
|
138
|
+
| `sizing` | — | Removed. No direct replacement. |
|
|
139
|
+
| `padding`, `margin`, `overflow`, `flex*` | — | Not supported on VStack. A Stack using any of these migrates to `Flex flexDirection="column"` instead — see the Flex migration guide for that prop set. |
|
|
140
|
+
|
|
141
|
+
### Breaking changes
|
|
142
|
+
|
|
143
|
+
- **`space` prop renamed to `gap`.** `<Stack space={3}>` no longer sets spacing. Use `<VStack gap={3}>`.
|
|
144
|
+
- **`sizing` prop removed.** `<Stack sizing="border">` does nothing on VStack. There is no replacement prop.
|
|
145
|
+
- **Layout props no longer apply.** A v3 Stack that set `padding`, `margin`, `overflow`, or any flex prop needs `Flex flexDirection="column"` in v5, not VStack — VStack accepts only `gap` and `as`.
|
|
146
|
+
|
|
147
|
+
### Codemod
|
|
148
|
+
|
|
149
|
+
A codemod is available to ease the changes above. Run the command below with the path to the file or folder you want to migrate. Use spaces to pass more than one path.
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
pnpx @sanity/ui-codemod latest:stack --paths <paths> --toPackage @sanity/ui
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The codemod inspects each Stack instance. One with only `space`/`gap`-style props becomes `VStack`, with `space` renamed to `gap`. One that also uses padding, margin, overflow, or flex props becomes `Flex flexDirection="column"` instead, with those props converted the same way as the Flex codemod. If a component instance cannot be migrated or needs manual review, the codemod inserts a comment prefixed with "UI-POC-CODEMOD TODO".
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: visually-hidden
|
|
3
|
+
name: VisuallyHidden
|
|
4
|
+
description: Hides content from sighted users while keeping it in the accessibility tree.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- accessibility
|
|
8
|
+
- screen-reader
|
|
9
|
+
- hidden
|
|
10
|
+
- visually-hidden
|
|
11
|
+
- ARIA
|
|
12
|
+
- accessible-name
|
|
13
|
+
- sr-only
|
|
14
|
+
- clip
|
|
15
|
+
- aria-label
|
|
16
|
+
status:
|
|
17
|
+
status: stable
|
|
18
|
+
sections:
|
|
19
|
+
- kind: guidelines
|
|
20
|
+
for: all
|
|
21
|
+
framing: when-to-use
|
|
22
|
+
title: When to use
|
|
23
|
+
items:
|
|
24
|
+
- level: must
|
|
25
|
+
statement: When content must be visible for browser reading modes, translation tools, and some testing frameworks. `aria-label` is often invisible in those circumstances.
|
|
26
|
+
- level: should
|
|
27
|
+
statement: "To add screen-reader-only context to a control with a visual label (for example, 'Edit John Doe' where 'John Doe' comes from row context)."
|
|
28
|
+
- level: should
|
|
29
|
+
statement: As extra content for a repeated text content, such as links.
|
|
30
|
+
- level: should
|
|
31
|
+
statement: As a table column header that's visually implied.
|
|
32
|
+
- level: should
|
|
33
|
+
statement: As status text to support indicators or color-only elements.
|
|
34
|
+
- level: should
|
|
35
|
+
statement: To label a section landmark when the visual treatment doesn't include a visible heading.
|
|
36
|
+
- level: should-not
|
|
37
|
+
statement: For content the user shouldn't see at all. Use Box with display='none' instead.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: box
|
|
40
|
+
- level: should-not
|
|
41
|
+
statement: To hide decorative imagery — use aria-hidden='true' on the visual instead.
|
|
42
|
+
- level: should-not
|
|
43
|
+
statement: For collapsible UI — use hidden on the wrapping element or conditional rendering.
|
|
44
|
+
- kind: guidelines
|
|
45
|
+
for: agent
|
|
46
|
+
framing: when-to-use
|
|
47
|
+
title: When to use
|
|
48
|
+
items:
|
|
49
|
+
- level: should-not
|
|
50
|
+
statement: To give an accessible name to an icon-only control (close button, sort handle). Use an IconButton instead.
|
|
51
|
+
alternatives:
|
|
52
|
+
- to: icon-button
|
|
53
|
+
- kind: guidelines
|
|
54
|
+
for: all
|
|
55
|
+
framing: how-to-use
|
|
56
|
+
items:
|
|
57
|
+
- level: should
|
|
58
|
+
statement: 'Pair VisuallyHidden with content that must reach assistive technology but not sighted users: per-row context on a control that already has a visible label, or status text backing a color-only indicator. For an icon-only control, use IconButton instead.'
|
|
59
|
+
- level: should
|
|
60
|
+
statement: Use sentence-case, action-describing text. 'Close dialog' not 'Close'.
|
|
61
|
+
- level: must-not
|
|
62
|
+
statement: Don't use VisuallyHidden to hide content you'll show later — use conditional rendering or hidden.
|
|
63
|
+
- level: must-not
|
|
64
|
+
statement: Don't put interactive elements (button, a) inside VisuallyHidden — they remain keyboard-reachable and the user sees a focus ring on invisible content.
|
|
65
|
+
- kind: guidelines
|
|
66
|
+
for: agent
|
|
67
|
+
framing: how-to-use
|
|
68
|
+
items:
|
|
69
|
+
- level: must
|
|
70
|
+
statement: Use a visible label element (Text as='label', linked with htmlFor) for form labels. Use VisuallyHidden with as='label' when a visible label is not possible.
|
|
71
|
+
- level: must-not
|
|
72
|
+
statement: 'Do not use VisuallyHidden for content that should be fully hidden — use display: none.'
|
|
73
|
+
- level: must-not
|
|
74
|
+
statement: "Putting a button inside VisuallyHidden to hide an action from sighted users. Instead: Use display='none' or conditional rendering — VisuallyHidden keeps content focusable."
|
|
75
|
+
|
|
76
|
+
- kind: guidelines
|
|
77
|
+
for: all
|
|
78
|
+
title: Accessibility
|
|
79
|
+
tags: [accessibility]
|
|
80
|
+
items:
|
|
81
|
+
- level: should
|
|
82
|
+
statement: VisuallyHidden does not make its children non-focusable. If you put a `<button>` or `<a>` inside, it stays keyboard-reachable — and users get a focus ring on something they can't see. Avoid putting focusable elements inside VisuallyHidden. If you need a hidden control, use `tabIndex={-1}`.
|
|
83
|
+
- id: visuallyhidden-does-replace-prefer-short
|
|
84
|
+
level: should
|
|
85
|
+
statement: VisuallyHidden does not replace `aria-label`. Prefer `aria-label` for short, fixed strings (`aria-label="Close"`). Prefer VisuallyHidden when the content includes dynamic data, formatting, or multiple elements (`<VisuallyHidden>Sort by date, descending</VisuallyHidden>`).
|
|
86
|
+
|
|
87
|
+
refs:
|
|
88
|
+
- to: icon-button
|
|
89
|
+
rel: relates-to
|
|
90
|
+
note: Preferred for a plain icon-only button — it takes a required `aria-label` for the accessible name
|
|
91
|
+
- to: checkbox
|
|
92
|
+
rel: relates-to
|
|
93
|
+
note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
|
|
94
|
+
- to: radio
|
|
95
|
+
rel: relates-to
|
|
96
|
+
note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
|
|
97
|
+
- to: switch
|
|
98
|
+
rel: relates-to
|
|
99
|
+
note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
|
|
100
|
+
sourceFiles:
|
|
101
|
+
- platform: react
|
|
102
|
+
file: packages/ui/src/components/visually-hidden/VisuallyHidden.tsx
|
|
103
|
+
imports:
|
|
104
|
+
- platform: react
|
|
105
|
+
code: import { VisuallyHidden } from '@sanity/ui'
|
|
106
|
+
package: '@sanity/ui'
|
|
107
|
+
|
|
108
|
+
$extensions:
|
|
109
|
+
com.sanity.ui:
|
|
110
|
+
implementationStatus:
|
|
111
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
112
|
+
implemented: true
|