@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,296 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: button
|
|
3
|
+
name: Button
|
|
4
|
+
description: Used to trigger an action — like submitting a form, starting a dialog, or running a command.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- action
|
|
8
|
+
- form
|
|
9
|
+
- interactive
|
|
10
|
+
- trigger
|
|
11
|
+
- button
|
|
12
|
+
- submit
|
|
13
|
+
- primary
|
|
14
|
+
- secondary
|
|
15
|
+
- tertiary
|
|
16
|
+
- CTA
|
|
17
|
+
- loading
|
|
18
|
+
- destructive
|
|
19
|
+
status:
|
|
20
|
+
status: beta
|
|
21
|
+
sections:
|
|
22
|
+
- kind: guidelines
|
|
23
|
+
for: all
|
|
24
|
+
framing: when-to-use
|
|
25
|
+
title: When to use
|
|
26
|
+
items:
|
|
27
|
+
- level: should
|
|
28
|
+
statement: "To trigger an action within the app (for example, 'Publish', 'Delete', 'Save')."
|
|
29
|
+
- level: should
|
|
30
|
+
statement: To submit data in a form context. Use type='submit' via the native HTML attribute.
|
|
31
|
+
- level: should-not
|
|
32
|
+
statement: To send the user to a new URL within a line of text or paragraph. Use Link instead. Users of assistive technology expect buttons to perform actions and links to navigate.
|
|
33
|
+
alternatives:
|
|
34
|
+
- to: link
|
|
35
|
+
- level: should-not
|
|
36
|
+
statement: 'As nav items within a sidebar or menu. Use List.ButtonItem instead.'
|
|
37
|
+
alternatives:
|
|
38
|
+
- to: list-button-item
|
|
39
|
+
- level: should-not
|
|
40
|
+
statement: To switch views on a screen. Use Tab instead. The Tab component has ARIA attributes that make keyboard navigation accessible.
|
|
41
|
+
alternatives:
|
|
42
|
+
- to: tabs
|
|
43
|
+
- level: should-not
|
|
44
|
+
statement: To toggle a boolean form value (on/off). Use Switch or Checkbox instead.
|
|
45
|
+
alternatives:
|
|
46
|
+
- to: switch
|
|
47
|
+
- to: checkbox
|
|
48
|
+
- refs:
|
|
49
|
+
- to: forms#no-pressed-for-form-values
|
|
50
|
+
rel: relates-to
|
|
51
|
+
- id: buttons-only-display-icon-text
|
|
52
|
+
level: must-not
|
|
53
|
+
statement: For buttons that only display an icon with no text label. Use IconButton instead.
|
|
54
|
+
alternatives:
|
|
55
|
+
- to: icon-button
|
|
56
|
+
- kind: guidelines
|
|
57
|
+
for: agent
|
|
58
|
+
framing: when-to-use
|
|
59
|
+
title: When to use
|
|
60
|
+
items:
|
|
61
|
+
- level: should-not
|
|
62
|
+
statement: Don't use Button for navigation (changing URL). Use Link instead.
|
|
63
|
+
alternatives:
|
|
64
|
+
- to: link
|
|
65
|
+
- level: should-not
|
|
66
|
+
statement: Don't use Button for binary form toggles that take effect immediately. Use Switch instead.
|
|
67
|
+
alternatives:
|
|
68
|
+
- to: switch
|
|
69
|
+
- kind: guidelines
|
|
70
|
+
for: all
|
|
71
|
+
framing: how-to-use
|
|
72
|
+
items:
|
|
73
|
+
- id: button-icon-only-accessible-name
|
|
74
|
+
level: must
|
|
75
|
+
statement: "An icon-only Button (icon with no `text` prop) needs an `aria-label`. Describe the action, not the icon: 'Add item', not 'Plus'."
|
|
76
|
+
checks:
|
|
77
|
+
- href: ../evals/cases.yaml
|
|
78
|
+
role: agent-test
|
|
79
|
+
checkedBy: assisted
|
|
80
|
+
refines:
|
|
81
|
+
- to: shared-foundations#icon-only-control-needs-name
|
|
82
|
+
$extensions:
|
|
83
|
+
io.jev:
|
|
84
|
+
type: boolean
|
|
85
|
+
- level: must
|
|
86
|
+
statement: '**`as` prop and keyboard behavior.** When `as="a"`, the element activates with Enter only — Space does not trigger links. Don''t use `as` for elements whose behavioral contract Button does not fulfill.'
|
|
87
|
+
tags: [accessibility]
|
|
88
|
+
- level: must
|
|
89
|
+
statement: "**Focus ring.** A visible focus ring appears on keyboard focus. Don't suppress it without providing a high-contrast alternative."
|
|
90
|
+
tags: [accessibility]
|
|
91
|
+
- refs:
|
|
92
|
+
- to: content-guidelines#name-the-action
|
|
93
|
+
rel: same-as
|
|
94
|
+
- level: should
|
|
95
|
+
statement: Ensure buttons have a logical tab order in the document flow (left to right, top to bottom).
|
|
96
|
+
- level: should
|
|
97
|
+
statement: Limit the number of level='primary' buttons on the screen. Display one primary action per logical section.
|
|
98
|
+
- level: should
|
|
99
|
+
statement: Set iconEnd to ChevronDownIcon when a Button opens a Popover.
|
|
100
|
+
- level: should
|
|
101
|
+
statement: Bias toward text labels in buttons to aid comprehension.
|
|
102
|
+
- level: should
|
|
103
|
+
statement: Use iconStart in Button for visual emphasis. Only when it doesn't hurt scannability. Keep icon/text button pairing to one button per group.
|
|
104
|
+
- level: must-not
|
|
105
|
+
statement: '**Disabled strategy.** Never place a tooltip on a disabled button. The `disabled` prop uses HTML `disabled`, which removes it from the tab order, so keyboard users cannot reach the tooltip. When users need to find a disabled control, use `aria-disabled="true"` instead to keep it focusable while blocking action (WCAG 2.1.1 A). `loading={true}` also sets `aria-disabled`, so a loading button stays focusable.'
|
|
106
|
+
tags: [accessibility]
|
|
107
|
+
refines:
|
|
108
|
+
- to: accessibility-guidelines#disabled-control-no-tooltip
|
|
109
|
+
- level: must-not
|
|
110
|
+
statement: Don't use Button without a text label. Button relies on the text label to describe its purpose. Use IconButton in cases where the icon is the only visual indicator.
|
|
111
|
+
- level: must
|
|
112
|
+
statement: Button defaults to `type="button"`. To submit a form, set `type="submit"` explicitly.
|
|
113
|
+
- level: must-not
|
|
114
|
+
statement: Don't disable buttons as a blocking function for incomplete form fields. People may not know what caused the button to be disabled. Allow submission and show feedback instead.
|
|
115
|
+
- level: must-not
|
|
116
|
+
statement: Don't hide buttons that represent critical actions. Primary actions must be visible at all times.
|
|
117
|
+
- level: must-not
|
|
118
|
+
statement: 'Don''t use `tone="critical"` without an icon, such as `iconStart={ErrorOutlineIcon}`.'
|
|
119
|
+
tags: [accessibility]
|
|
120
|
+
refines:
|
|
121
|
+
- to: shared-foundations#tone-paired-with-second-channel
|
|
122
|
+
- kind: guidelines
|
|
123
|
+
for: agent
|
|
124
|
+
framing: how-to-use
|
|
125
|
+
items:
|
|
126
|
+
- level: must-not
|
|
127
|
+
statement: Do not use `mode` in Button—it's not a valid prop. `level` is the equivalent v5 prop. Refer to the `level` prop for what values it accepts.
|
|
128
|
+
- level: must-not
|
|
129
|
+
statement: Do not use `primary` for the `tone` prop. `primary` is now a value in v5's `level` prop.
|
|
130
|
+
- kind: guidelines
|
|
131
|
+
for: agent
|
|
132
|
+
framing: how-to-use
|
|
133
|
+
items:
|
|
134
|
+
- id: most-buttons-tertiary
|
|
135
|
+
level: should
|
|
136
|
+
statement: Most buttons should be level='tertiary'. The default, primary, is only for a section's single most important action.
|
|
137
|
+
- level: should
|
|
138
|
+
statement: Use text='Label' to set the button label. Children text nodes also work but text prop is the primary API. Do not set both text and children — both render, the text first and the children after it.
|
|
139
|
+
- level: should
|
|
140
|
+
statement: Pass `ref` straight to Button when you need the rendered element — to move focus to it, or to anchor a Popover to its trigger. It reaches the underlying element; there is no wrapper to add and no forwardRef to wait for.
|
|
141
|
+
- level: must-not
|
|
142
|
+
statement: Button does not accept Box layout props. Props like `flexShrink`, `flexGrow`, `width`, `margin`, and `padding` are not valid on Button and cause a TypeScript error. Wrap Button in Box to control layout.
|
|
143
|
+
- id: button-not-hand-written-native
|
|
144
|
+
level: must-not
|
|
145
|
+
statement: Interactive controls use the Button component rather than a hand-written native `<button>`; standard DOM attributes and handlers pass through Button.
|
|
146
|
+
checks:
|
|
147
|
+
- href: ../evals/cases.yaml
|
|
148
|
+
role: agent-test
|
|
149
|
+
checkedBy: assisted
|
|
150
|
+
$extensions:
|
|
151
|
+
io.jev:
|
|
152
|
+
type: boolean
|
|
153
|
+
- level: must-not
|
|
154
|
+
statement: Do not use Button for navigation to a new page or URL — use Link instead.
|
|
155
|
+
- kind: guidelines
|
|
156
|
+
for: all
|
|
157
|
+
title: Accessibility
|
|
158
|
+
description: 'Target conformance: WCAG Level AA.'
|
|
159
|
+
tags: [accessibility]
|
|
160
|
+
items:
|
|
161
|
+
- refs:
|
|
162
|
+
- to: shared-foundations#aria-disabled-keeps-focus
|
|
163
|
+
rel: same-as
|
|
164
|
+
- refs:
|
|
165
|
+
- to: shared-foundations#aria-pressed-toggle
|
|
166
|
+
rel: same-as
|
|
167
|
+
- kind: guidelines
|
|
168
|
+
for: all
|
|
169
|
+
title: Content
|
|
170
|
+
tags: [content]
|
|
171
|
+
items:
|
|
172
|
+
- refs:
|
|
173
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
174
|
+
rel: same-as
|
|
175
|
+
- kind: definitions
|
|
176
|
+
for: all
|
|
177
|
+
title: Content
|
|
178
|
+
items:
|
|
179
|
+
- term: Be concise
|
|
180
|
+
definition: Button labels should be short and clear. Use simple, direct language.
|
|
181
|
+
- term: Start with verbs
|
|
182
|
+
definition: "Labels should describe the action taken (for example, 'Publish', 'Edit', 'Upload'). For extra clarity, add the subject of the action (for example, 'Upload image')."
|
|
183
|
+
uses:
|
|
184
|
+
- to: icons
|
|
185
|
+
note: Button's iconStart and iconEnd props accept icon components from @sanity/icons.
|
|
186
|
+
alternatives:
|
|
187
|
+
- to: icon-button
|
|
188
|
+
- to: link
|
|
189
|
+
- to: list-button-item
|
|
190
|
+
- to: switch
|
|
191
|
+
refs:
|
|
192
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32075-2332
|
|
193
|
+
rel: design
|
|
194
|
+
role: Figma component (v5)
|
|
195
|
+
sourceFiles:
|
|
196
|
+
- platform: react
|
|
197
|
+
file: packages/ui/src/components/button/Button.tsx
|
|
198
|
+
imports:
|
|
199
|
+
- platform: react
|
|
200
|
+
code: |-
|
|
201
|
+
import { Button } from '@sanity/ui'
|
|
202
|
+
|
|
203
|
+
<Button text="Publish" />
|
|
204
|
+
package: '@sanity/ui'
|
|
205
|
+
traits:
|
|
206
|
+
- traitType: state
|
|
207
|
+
kind: boolean
|
|
208
|
+
id: enabled
|
|
209
|
+
description: Button's standard state (default). Represents that a button is clickable.
|
|
210
|
+
- traitType: state
|
|
211
|
+
kind: boolean
|
|
212
|
+
id: hovered
|
|
213
|
+
description: Visual cue that the cursor is resting over the button.
|
|
214
|
+
- traitType: state
|
|
215
|
+
kind: boolean
|
|
216
|
+
id: active
|
|
217
|
+
description: Momentary visual cue while the button is pressed down (:active). Not the same as the pressed prop.
|
|
218
|
+
- traitType: state
|
|
219
|
+
kind: boolean
|
|
220
|
+
id: focused
|
|
221
|
+
description: Visual cue that the button is keyboard-focused.
|
|
222
|
+
- traitType: state
|
|
223
|
+
kind: boolean
|
|
224
|
+
id: disabled
|
|
225
|
+
description: >-
|
|
226
|
+
Blocks the user from using the button. Removed from the tab order via HTML
|
|
227
|
+
disabled. Use only when performing the action could be harmful. Let people
|
|
228
|
+
know why it's disabled and how to fix it with visible text or a status
|
|
229
|
+
message next to the button.
|
|
230
|
+
- traitType: state
|
|
231
|
+
kind: boolean
|
|
232
|
+
id: loading
|
|
233
|
+
description: >-
|
|
234
|
+
Shows the action is in progress. Sets aria-busy and aria-disabled, hides
|
|
235
|
+
the label and icons behind a spinner, and ignores clicks. The button stays
|
|
236
|
+
focusable. Use only for processes consistently longer than 200ms. For
|
|
237
|
+
processes over three seconds, show a confirmation message when the action completes.
|
|
238
|
+
- traitType: variant
|
|
239
|
+
kind: boolean
|
|
240
|
+
id: pressed
|
|
241
|
+
description: >-
|
|
242
|
+
Toggle state for a button that switches a view, filter, or option on and
|
|
243
|
+
off. Sets aria-pressed to the given value and shows the pressed style.
|
|
244
|
+
- traitType: variant
|
|
245
|
+
kind: enum
|
|
246
|
+
id: level
|
|
247
|
+
description: Controls the visual weight of the button. Tertiary covers most actions, then secondary, with primary least used.
|
|
248
|
+
values:
|
|
249
|
+
- id: tertiary
|
|
250
|
+
description: No background, low visual weight. For rare or background actions (forgot password, close/dismiss in a dialog).
|
|
251
|
+
- id: secondary
|
|
252
|
+
description: Outlined/bordered look. For common but not the most critical actions (cancel in dialogs, save as draft).
|
|
253
|
+
- id: primary
|
|
254
|
+
description: Default value. Solid background, full visual weight. The most critical action in a workflow (publish, log in).
|
|
255
|
+
- traitType: variant
|
|
256
|
+
kind: enum
|
|
257
|
+
id: tone
|
|
258
|
+
description: Semantic color of the button.
|
|
259
|
+
values:
|
|
260
|
+
- id: neutral
|
|
261
|
+
description: Neutral gray for general actions within the product.
|
|
262
|
+
- id: critical
|
|
263
|
+
description: Red for destructive or unsafe actions. Pair with iconStart={ErrorOutlineIcon} to show meaning to people with color vision differences.
|
|
264
|
+
- traitType: variant
|
|
265
|
+
kind: enum
|
|
266
|
+
id: type
|
|
267
|
+
description: The native HTML type attribute passes through to the underlying <button> element.
|
|
268
|
+
values:
|
|
269
|
+
- id: button
|
|
270
|
+
description: Standard button (default). For all actions outside of a form context.
|
|
271
|
+
- id: submit
|
|
272
|
+
description: Submits form data.
|
|
273
|
+
- id: reset
|
|
274
|
+
description: Resets form data.
|
|
275
|
+
- traitType: variant
|
|
276
|
+
kind: enum
|
|
277
|
+
id: density
|
|
278
|
+
description: Composite prop setting padding, gap, and minimum size together.
|
|
279
|
+
values:
|
|
280
|
+
- id: regular
|
|
281
|
+
description: Gap 2, padding 2, and a minimum size of 25px. Default spacing.
|
|
282
|
+
- id: loose
|
|
283
|
+
description: Gap 3, padding 3, and a minimum size of 33px. For spacious contexts.
|
|
284
|
+
- traitType: variant
|
|
285
|
+
kind: boolean
|
|
286
|
+
id: fullWidth
|
|
287
|
+
description: Sets CSS width to 100% to fill the container.
|
|
288
|
+
$extensions:
|
|
289
|
+
com.sanity.ui:
|
|
290
|
+
implementationStatus:
|
|
291
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
292
|
+
implemented: true
|
|
293
|
+
migrationGuide:
|
|
294
|
+
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.'
|
|
295
|
+
guidance: |-
|
|
296
|
+
Button's prop API has changed. The `mode` prop is replaced by `level` with new values, icon props are renamed, the `selected` prop is removed, and tone values are reduced. `styled-components` is no longer used, so custom extensions like `styled(Button)` will not work.
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: card
|
|
3
|
+
name: Card
|
|
4
|
+
description: Groups related content into a single visual element.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [layout, container, surface, card, panel, tile, region, status, tone]
|
|
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: To group related content on a distinct background surface.
|
|
17
|
+
- level: should
|
|
18
|
+
statement: To create visual separation between content regions.
|
|
19
|
+
- level: should
|
|
20
|
+
statement: To wrap content that needs consistent internal padding and rounded corners.
|
|
21
|
+
- id: layout-without-distinct-visual-surface
|
|
22
|
+
level: should-not
|
|
23
|
+
statement: For layout without a distinct visual surface — use Box or Flex.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: box
|
|
26
|
+
- to: flex
|
|
27
|
+
- level: should-not
|
|
28
|
+
statement: For structural UI regions like sidebars and toolbars — use Box or Flex.
|
|
29
|
+
alternatives:
|
|
30
|
+
- to: box
|
|
31
|
+
- to: flex
|
|
32
|
+
- level: should-not
|
|
33
|
+
statement: For anything the user activates — use Button.
|
|
34
|
+
alternatives:
|
|
35
|
+
- to: button
|
|
36
|
+
- level: must-not
|
|
37
|
+
statement: To contain large parts of an interface that typically represent a section or large surface area. Use Box or Flex instead.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: box
|
|
40
|
+
- to: flex
|
|
41
|
+
- kind: guidelines
|
|
42
|
+
for: all
|
|
43
|
+
framing: how-to-use
|
|
44
|
+
items:
|
|
45
|
+
- refs:
|
|
46
|
+
- to: shared-foundations#tone-signals-state
|
|
47
|
+
rel: same-as
|
|
48
|
+
- refs:
|
|
49
|
+
- to: shared-foundations#tone-paired-with-second-channel
|
|
50
|
+
rel: same-as
|
|
51
|
+
- id: density-matches-context
|
|
52
|
+
level: should
|
|
53
|
+
statement: Use density to match the surrounding layout density, so the Card's density prop matches the density used by adjacent or sibling components in the same layout region.
|
|
54
|
+
example:
|
|
55
|
+
title: How to satisfy this
|
|
56
|
+
description: Set density='compact' when the card appears inside a high-density list or table. Set density='loose' when the card is a featured or standalone element in a low-density layout. Leave density at the default 'regular' when the surrounding layout uses standard spacing.
|
|
57
|
+
checkedBy: manual
|
|
58
|
+
- id: card-wrapped-for-layout
|
|
59
|
+
level: should
|
|
60
|
+
statement: Wrap Card in Box or Flex to control layout sizing — Card handles appearance, the wrapper handles position — so layout sizing props like width, height, flexGrow, overflow, and position are applied to that Box or Flex wrapper, not directly to Card.
|
|
61
|
+
example:
|
|
62
|
+
title: How to satisfy this
|
|
63
|
+
description: Inspect the component tree and confirm that sizing or positioning props appear on a Box or Flex element that is the direct parent of Card. Confirm that the Card element itself carries only density, tone, margin, and as props.
|
|
64
|
+
checkedBy: manual
|
|
65
|
+
- refs:
|
|
66
|
+
- to: shared-foundations#card-not-for-structural-regions
|
|
67
|
+
rel: same-as
|
|
68
|
+
- id: no-nested-cards
|
|
69
|
+
level: must-not
|
|
70
|
+
statement: Don't nest cards — no Card element should render as a direct or indirect descendant of another Card element. Use Box, Flex, or VStack for internal layout within a card.
|
|
71
|
+
example:
|
|
72
|
+
title: How to satisfy this
|
|
73
|
+
description: Inspect the rendered component tree and confirm there is no Card inside another Card. Use Box, Flex, or VStack for all internal layout structure within a Card.
|
|
74
|
+
checkedBy: manual
|
|
75
|
+
- id: no-onclick-on-card
|
|
76
|
+
level: must-not
|
|
77
|
+
statement: Card carries no `onClick` or other interaction handler; interactive behaviour lives on a Button or PressArea instead.
|
|
78
|
+
example:
|
|
79
|
+
title: How to satisfy this
|
|
80
|
+
description: Inspect the component tree and confirm that Card has no onClick, onKeyDown, onPointerDown, or similar event handler props. Use Button for actions where keyboard accessibility and focus management are required.
|
|
81
|
+
checks:
|
|
82
|
+
- href: ../evals/cases.yaml
|
|
83
|
+
role: agent-test
|
|
84
|
+
checkedBy: assisted
|
|
85
|
+
$extensions:
|
|
86
|
+
io.jev:
|
|
87
|
+
type: boolean
|
|
88
|
+
- id: no-inline-style-for-spacing
|
|
89
|
+
level: must-not
|
|
90
|
+
statement: 'Card elements carry no `style` attribute setting padding or border-radius. Card has no `padding` or `radius` props; spacing comes from `density`.'
|
|
91
|
+
example:
|
|
92
|
+
title: How to satisfy this
|
|
93
|
+
description: Inspect the Card element's props in the component tree and confirm no style prop is present with padding or border-radius values. Use the density prop to control padding and border-radius through the design token scale.
|
|
94
|
+
checks:
|
|
95
|
+
- href: ../evals/cases.yaml
|
|
96
|
+
role: agent-test
|
|
97
|
+
checkedBy: assisted
|
|
98
|
+
$extensions:
|
|
99
|
+
io.jev:
|
|
100
|
+
type: boolean
|
|
101
|
+
- id: no-layout-props
|
|
102
|
+
level: must-not
|
|
103
|
+
statement: Don't pass layout props to Card. It takes density and tone for its look, and rejects padding, radius, border, shadow, gap, flex, width, height, position, and overflow props with a TypeScript error. Put layout sizing on a Box or Flex around the Card.
|
|
104
|
+
- kind: guidelines
|
|
105
|
+
for: agent
|
|
106
|
+
framing: how-to-use
|
|
107
|
+
items:
|
|
108
|
+
- level: must
|
|
109
|
+
statement: Use Card's `density` prop as the method for setting a Card's size. It handles padding and radius together. This is an intentional design decision to keep Card usage consistent
|
|
110
|
+
- level: must-not
|
|
111
|
+
statement: 'Do not put a Box inside Card to change its padding. Density is the only spacing control Card has: when no value is an exact fit, use the closest one.'
|
|
112
|
+
|
|
113
|
+
- kind: guidelines
|
|
114
|
+
for: all
|
|
115
|
+
title: Content guidelines
|
|
116
|
+
tags: [content]
|
|
117
|
+
items:
|
|
118
|
+
- level: should
|
|
119
|
+
statement: Limit card content to a single topic.
|
|
120
|
+
- level: should
|
|
121
|
+
statement: Content should be related. Split different topics into separate cards.
|
|
122
|
+
|
|
123
|
+
- kind: guidelines
|
|
124
|
+
for: all
|
|
125
|
+
title: Accessibility
|
|
126
|
+
tags: [accessibility]
|
|
127
|
+
items:
|
|
128
|
+
- refs:
|
|
129
|
+
- to: semantics#heading-levels-sequential
|
|
130
|
+
rel: same-as
|
|
131
|
+
- refs:
|
|
132
|
+
- to: semantics#landmark-requirements
|
|
133
|
+
rel: same-as
|
|
134
|
+
- level: should
|
|
135
|
+
statement: When the whole Card surface should be pressable, wrap it in PressArea. PressArea renders a native button or anchor and leaves Card to carry the visual state.
|
|
136
|
+
alternatives:
|
|
137
|
+
- to: press-area
|
|
138
|
+
note: The supported way to make a whole Card pressable.
|
|
139
|
+
- level: must-not
|
|
140
|
+
statement: Card has no keyboard activation, focus management, or ARIA role. Do not use `as="button"` — wrap the Card in a PressArea, which renders a native button or anchor and leaves the Card to carry the visual state. Use Button when the action needs a labelled control rather than a whole pressable surface.
|
|
141
|
+
alternatives:
|
|
142
|
+
- to: press-area
|
|
143
|
+
note: The supported way to make a whole Card pressable.
|
|
144
|
+
- kind: section
|
|
145
|
+
for: agent
|
|
146
|
+
freeform:
|
|
147
|
+
- title: Adding internal padding
|
|
148
|
+
body: |-
|
|
149
|
+
Use Card's `density` prop to set padding, gap, and border-radius together. Density is the primary approach — it keeps spacing on the design token scale.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
// correct — density sets padding, gap, and border-radius
|
|
153
|
+
<Card density="loose">
|
|
154
|
+
<Heading as="h2">Title</Heading>
|
|
155
|
+
<Text>Body</Text>
|
|
156
|
+
</Card>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Do not add an inner `Box` to change Card's padding, even when no density option is an exact fit. Use the closest one.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
// wrong — an inner Box re-spaces the Card
|
|
163
|
+
<Card>
|
|
164
|
+
<Box paddingTop={2}>
|
|
165
|
+
<Text>Body</Text>
|
|
166
|
+
</Box>
|
|
167
|
+
</Card>
|
|
168
|
+
|
|
169
|
+
// wrong — padding is not a Card prop, so this is a TypeScript error
|
|
170
|
+
<Card padding={4}>
|
|
171
|
+
<Heading as="h2">Title</Heading>
|
|
172
|
+
</Card>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The same applies to every other layout prop. See the no-layout-props rule in the guidelines above.
|
|
176
|
+
- title: density values
|
|
177
|
+
body: |-
|
|
178
|
+
Card's `density` prop sets padding, gap, and border-radius together via the design token scale. It is the primary way to control spacing inside a Card.
|
|
179
|
+
|
|
180
|
+
| Value | Padding | Description |
|
|
181
|
+
|-------|---------|-------------|
|
|
182
|
+
| `compact` | {space-3} | Tighter spacing for dense lists or sidebars |
|
|
183
|
+
| `regular` | {space-4} | Default. Standard spacing |
|
|
184
|
+
| `loose` | {space-5} | More breathing room for featured content |
|
|
185
|
+
|
|
186
|
+
Density also propagates a spacing context to nested components.
|
|
187
|
+
|
|
188
|
+
alternatives:
|
|
189
|
+
- to: box
|
|
190
|
+
note: Structural container without a visual surface
|
|
191
|
+
refs:
|
|
192
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=30993-2035
|
|
193
|
+
rel: design
|
|
194
|
+
role: Figma component (v5)
|
|
195
|
+
- to: space
|
|
196
|
+
rel: relates-to
|
|
197
|
+
- to: flex
|
|
198
|
+
rel: relates-to
|
|
199
|
+
note: Layout container without a visual surface
|
|
200
|
+
sourceFiles:
|
|
201
|
+
- platform: react
|
|
202
|
+
file: packages/ui/src/components/card/Card.tsx
|
|
203
|
+
imports:
|
|
204
|
+
- platform: react
|
|
205
|
+
code: import { Card } from '@sanity/ui'
|
|
206
|
+
package: '@sanity/ui'
|
|
207
|
+
traits:
|
|
208
|
+
- traitType: variant
|
|
209
|
+
kind: enum
|
|
210
|
+
id: tone
|
|
211
|
+
description: Semantic color of the card surface.
|
|
212
|
+
values:
|
|
213
|
+
- id: default
|
|
214
|
+
description: No semantic meaning — used for grouping content with lower visual emphasis.
|
|
215
|
+
- id: neutral
|
|
216
|
+
description: No semantic meaning — increased visual emphasis over default.
|
|
217
|
+
- id: positive
|
|
218
|
+
description: Success, published, healthy states.
|
|
219
|
+
- id: suggest
|
|
220
|
+
description: Suggestions, recommendations, informational content.
|
|
221
|
+
- id: caution
|
|
222
|
+
description: Needs attention, in review.
|
|
223
|
+
- id: critical
|
|
224
|
+
description: Error, failed, rejected.
|
|
225
|
+
- traitType: variant
|
|
226
|
+
kind: enum
|
|
227
|
+
id: density
|
|
228
|
+
description: Composite prop setting padding, gap, and border-radius together.
|
|
229
|
+
values:
|
|
230
|
+
- id: compact
|
|
231
|
+
description: Padding {space-3}, radius {radius-2}. For high-density lists and table rows.
|
|
232
|
+
- id: regular
|
|
233
|
+
description: Padding {space-4}, radius {radius-3}. Default for standard content cards.
|
|
234
|
+
- id: loose
|
|
235
|
+
description: Padding {space-5}, radius {radius-4}. For low-density or featured cards.
|
|
236
|
+
$extensions:
|
|
237
|
+
com.sanity.ui:
|
|
238
|
+
implementationStatus:
|
|
239
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
240
|
+
implemented: true
|
|
241
|
+
migrationGuide:
|
|
242
|
+
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.'
|
|
243
|
+
codemod: |-
|
|
244
|
+
Card no longer inherits Box's full prop set — it accepts only `density`, `tone`, `margin*`, and `as`. `density` replaces `padding`+`radius`; other layout props (`flexGrow`, `width`, `overflow`, `position`, etc.) are TypeScript errors when passed directly. `tone=`"muted"`/`"transparent"` no longer exist — use `"neutral"`.
|
|
245
|
+
|
|
246
|
+
Run the codemod: `pnpx @sanity/ui-codemod latest:card --paths <paths> --toPackage @sanity/ui`. Run the Box codemod first — this codemod converts non-conforming Cards to Box.
|
|
247
|
+
guidance: |-
|
|
248
|
+
Card in the new system is a focused visual surface. It no longer extends Box.
|
|
249
|
+
|
|
250
|
+
### Key differences
|
|
251
|
+
|
|
252
|
+
- v5 components use CSS classes with a static stylesheet as opposed to `styled-components`.
|
|
253
|
+
- Card no longer inherits all Box props (padding, margin, overflow, flex, grid). The new Card accepts only `density`, `tone`, `margin*`, and `as`.
|
|
254
|
+
- `density` replaces `padding` \+ `radius`. Instead of setting padding and radius separately, choose `'compact'` ({space-3} padding, {radius-2} radius), `'regular'` ({space-4}, {radius-3}), or `'loose'` ({space-5}, {radius-4}).
|
|
255
|
+
- Layout props are rejected by the type checker. `flexGrow`, `width`, `overflow`, `position`, and every other layout prop fail to compile on Card. Wrap Card in a Box or Flex.
|
|
256
|
+
- `tone` values have changed. There is no `'muted'` or `'transparent'` tone. Use `'default'` for the base tone. Available: `'default'`, `'neutral'`, `'positive'`, `'suggest'`, `'caution'`, `'critical'`.
|
|
257
|
+
- No `scheme` prop. Dark mode inversion is no longer done at the Card level.
|
|
258
|
+
- No `border`, `shadow`, `muted`, `pressed`, `selected` props. Card has been changed to be more focused and purpose-built.
|
|
259
|
+
|
|
260
|
+
### Removed props (no longer accepted on Card)
|
|
261
|
+
|
|
262
|
+
| v3 prop | v5 prop | Notes |
|
|
263
|
+
| :---- | :---- | :---- |
|
|
264
|
+
| `padding` | –– | Removed. Use `density` (couples padding \+ radius). Pick the closest density; do not nest a Box inside Card to recreate a v3 padding value. |
|
|
265
|
+
| `radius` | –– | Removed. Use `density` (couples padding \+ radius). |
|
|
266
|
+
| `shadow` | –– | Removed. Use `tone` for surface treatment. |
|
|
267
|
+
| `border` | –– | Removed. Always rendered. Cannot be opted out of. |
|
|
268
|
+
| `scheme` | –– | Removed. Use `tone` instead. |
|
|
269
|
+
|
|
270
|
+
### `density` scale
|
|
271
|
+
|
|
272
|
+
| Density | Padding | Radius |
|
|
273
|
+
| :---- | :---- | :---- |
|
|
274
|
+
| `compact` | {space-3} | {radius-2} |
|
|
275
|
+
| `regular` | {space-4} | {radius-3} |
|
|
276
|
+
| `loose` | {space-5} | {radius-4} |
|
|
277
|
+
|
|
278
|
+
### Detailed list of differences
|
|
279
|
+
|
|
280
|
+
| v3 prop | v5 prop | Notes |
|
|
281
|
+
| :---- | :---- | :---- |
|
|
282
|
+
| `padding={3}` | `density="compact"` | Card no longer accepts individual `padding` or `radius` props. Use `density` (`'compact'`, `'regular'`, `'loose'`). |
|
|
283
|
+
| `radius={2}` | `density="compact"` | Coupled with padding into `density`. |
|
|
284
|
+
| `shadow={1}` | — | Removed. Card has no `shadow` prop. |
|
|
285
|
+
| `border` | — | Removed as a prop. Card always renders a 1px border via CSS. |
|
|
286
|
+
| `borderTop`, `borderRight`, etc. | — | Removed. Card has no individual border-side props. |
|
|
287
|
+
| `scheme="dark"` | — | Removed. |
|
|
288
|
+
| `muted` | — | Removed. |
|
|
289
|
+
| `pressed` | — | Removed. Card is not interactive. |
|
|
290
|
+
| `selected` | — | Removed. Card is not interactive. |
|
|
291
|
+
| All Box layout props | — | Removed. Card no longer extends Box. Wrap in Box or Flex for layout control. |
|
|
292
|
+
| — | `density` | New. Composite prop for padding \+ border-radius (`'compact'`, `'regular'`, `'loose'`). |
|
|
293
|
+
| — | `display` | New. `'block'`, `'inline-block'`, `'none'`. |
|
|
294
|
+
|
|
295
|
+
### Breaking changes
|
|
296
|
+
|
|
297
|
+
- Card no longer extends Box. Wrap it in a Box or Flex for layout control.
|
|
298
|
+
- `padding` and `radius` props removed. `<Card padding={3}>` and `<Card radius={2}>` fail to compile. Use `density` (`'compact'`, `'regular'`, `'loose'`).
|
|
299
|
+
- `tone="inherit"` removed. Card no longer inherits tone from a parent context.
|
|
300
|
+
- `scheme` prop removed. `<Card scheme="dark">` fails to compile.
|
|
301
|
+
- `shadow` prop removed. `<Card shadow={1}>` fails to compile.
|
|
302
|
+
- `border` prop removed. `<Card border>` fails to compile. Card always renders a 1px border. Border color is controlled by `tone`.
|
|
303
|
+
- `borderTop`, `borderRight`, `borderBottom`, `borderLeft` removed. Individual border-side props are not available.
|
|
304
|
+
- `muted`, `pressed`, `selected` props removed. Card is no longer interactive. Passing any of them is a TypeScript error.
|
|
305
|
+
- `styled-components` no longer used. Custom styled-components extensions like `styled(Card)` will not work.
|
|
306
|
+
|
|
307
|
+
### Codemod
|
|
308
|
+
|
|
309
|
+
A codemod is available to make the changes above less painful. Run the command below with the path to the file or directory you want to migrate. Pass a space-delimited list for multiple paths.
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
pnpx @sanity/ui-codemod latest:card --paths <paths> --toPackage @sanity/ui
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Some components may need manual review. When a component cannot be migrated or has unclear changes, the codemod adds a “UI-POC-CODEMOD TODO” comment.
|
|
316
|
+
|
|
317
|
+
For the best results, run the Box codemod first. One caveat: this codemod will transform Cards that don’t match the updated styling (padding, radius, and border) to Box. Double-check any UI that follows the Card usage guidelines and should not be converted.
|