@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,189 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: text-input
|
|
3
|
+
name: TextInput
|
|
4
|
+
description: Used to accept a single line of text like names, titles, zip codes.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [textinput, form, input, text, single-line, text field, name, title, search]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
note: Added in 5.0.0-alpha.13.
|
|
10
|
+
sections:
|
|
11
|
+
- kind: guidelines
|
|
12
|
+
for: all
|
|
13
|
+
framing: when-to-use
|
|
14
|
+
title: When to use
|
|
15
|
+
items:
|
|
16
|
+
- level: should
|
|
17
|
+
statement: 'For freeform input of short text: names, titles, search queries.'
|
|
18
|
+
- level: should-not
|
|
19
|
+
statement: For longer form, multi-line text where spell check is expected. Use TextArea instead.
|
|
20
|
+
alternatives:
|
|
21
|
+
- to: text-area
|
|
22
|
+
- level: should-not
|
|
23
|
+
statement: For selecting an option from a fixed list. Use Select instead.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: select
|
|
26
|
+
- kind: guidelines
|
|
27
|
+
for: agent
|
|
28
|
+
framing: when-to-use
|
|
29
|
+
title: When to use
|
|
30
|
+
items:
|
|
31
|
+
- level: should-not
|
|
32
|
+
statement: Don't use TextInput to pick from a fixed set of options. Use Select or Radio instead.
|
|
33
|
+
alternatives:
|
|
34
|
+
- to: select
|
|
35
|
+
- to: radio
|
|
36
|
+
- kind: guidelines
|
|
37
|
+
for: all
|
|
38
|
+
framing: how-to-use
|
|
39
|
+
items:
|
|
40
|
+
- refs:
|
|
41
|
+
- to: forms#pair-with-visible-label
|
|
42
|
+
rel: same-as
|
|
43
|
+
- level: must
|
|
44
|
+
statement: Mark an invalid field with `hasError`. It colors the border and text and sets `aria-invalid="true"` on the input. It renders no message, so add the error text yourself and link it with `aria-describedby`.
|
|
45
|
+
- refs:
|
|
46
|
+
- to: forms#mark-optional-fields
|
|
47
|
+
rel: same-as
|
|
48
|
+
- refs:
|
|
49
|
+
- to: forms#stack-fields-vertically
|
|
50
|
+
rel: same-as
|
|
51
|
+
- level: should
|
|
52
|
+
statement: Use `density="loose"` in forms with wide spacing. `regular` is the default. Give every field in one form the same density, including any Select beside it.
|
|
53
|
+
- refs:
|
|
54
|
+
- to: shared-foundations#error-state-never-disabled
|
|
55
|
+
rel: same-as
|
|
56
|
+
- refs:
|
|
57
|
+
- to: forms#placeholder-not-a-label
|
|
58
|
+
rel: same-as
|
|
59
|
+
- level: must-not
|
|
60
|
+
statement: Don't horizontally stack more than two TextInputs in a row.
|
|
61
|
+
- kind: guidelines
|
|
62
|
+
for: agent
|
|
63
|
+
framing: how-to-use
|
|
64
|
+
items:
|
|
65
|
+
- level: should
|
|
66
|
+
statement: >-
|
|
67
|
+
Set `type` to the kind of text the field takes: `email`, `password`, `search`, `tel`, `url`, `number`, `date`, `time`, `datetime-local`, `month` or `week`. `text` is the default. The right type gives the matching mobile keyboard and browser autofill.
|
|
68
|
+
- level: must-not
|
|
69
|
+
statement: >-
|
|
70
|
+
Don't set `type` to `button`, `checkbox`, `color`, `file`, `hidden`, `image`, `radio`, `range`, `reset` or `submit`. TextInput is a text field and is not styled for those controls. TypeScript does not catch this: the `type` prop still accepts any string. Use Button, Checkbox, Radio or a native element instead.
|
|
71
|
+
- level: must-not
|
|
72
|
+
statement: >-
|
|
73
|
+
Don't set `aria-invalid` on TextInput by hand. TextInput writes `aria-invalid` from `hasError` after your props, so a hand-set value is ignored. Use `hasError`.
|
|
74
|
+
- level: must-not
|
|
75
|
+
statement: >-
|
|
76
|
+
Don't pass layout or spacing props to TextInput. It takes the native input attributes plus `density` and `hasError`, so `margin`, `padding`, `flexGrow` and the like are TypeScript errors. TextInput always fills its container's width. Size it and space it from a wrapping Box or Flex. The native `width` attribute compiles but has no effect on a text field.
|
|
77
|
+
- kind: guidelines
|
|
78
|
+
for: all
|
|
79
|
+
title: Accessibility
|
|
80
|
+
tags: [accessibility]
|
|
81
|
+
items:
|
|
82
|
+
- refs:
|
|
83
|
+
- to: forms#label-available-to-screen-readers
|
|
84
|
+
rel: same-as
|
|
85
|
+
- refs:
|
|
86
|
+
- to: forms#programmatic-name-required
|
|
87
|
+
rel: same-as
|
|
88
|
+
- refs:
|
|
89
|
+
- to: forms#border-contrast
|
|
90
|
+
rel: same-as
|
|
91
|
+
- refs:
|
|
92
|
+
- to: forms#placeholder-contrast
|
|
93
|
+
rel: same-as
|
|
94
|
+
- refs:
|
|
95
|
+
- to: forms#error-described-in-text
|
|
96
|
+
rel: same-as
|
|
97
|
+
- refs:
|
|
98
|
+
- to: forms#error-prop-needs-visible-message
|
|
99
|
+
rel: same-as
|
|
100
|
+
- kind: section
|
|
101
|
+
for: agent
|
|
102
|
+
freeform:
|
|
103
|
+
- title: Form-field pairing (canonical example)
|
|
104
|
+
body: |-
|
|
105
|
+
The canonical form-field pairing. A `Text` with `as="label"` links to the input via `htmlFor` ↔ `id`; the label text is passed as children.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Text, TextInput, VStack } from '@sanity/ui'
|
|
109
|
+
|
|
110
|
+
<VStack gap={2}>
|
|
111
|
+
<Text as="label" htmlFor="email">Email address</Text>
|
|
112
|
+
<TextInput id="email" type="email" value={email} onChange={(e) => setEmail(e.currentTarget.value)} />
|
|
113
|
+
</VStack>
|
|
114
|
+
```
|
|
115
|
+
alternatives:
|
|
116
|
+
- to: text-area
|
|
117
|
+
- to: select
|
|
118
|
+
refs:
|
|
119
|
+
- href: https://www.figma.com/design/NWmchNlsNdG66VBaCsTdSL/pjo-ui4-component-buildout?node-id=29-1895
|
|
120
|
+
rel: design
|
|
121
|
+
role: Figma component
|
|
122
|
+
sourceFiles:
|
|
123
|
+
- platform: react
|
|
124
|
+
file: packages/ui/src/components/text-input/TextInput.tsx
|
|
125
|
+
imports:
|
|
126
|
+
- platform: react
|
|
127
|
+
code: import { TextInput } from '@sanity/ui'
|
|
128
|
+
package: '@sanity/ui'
|
|
129
|
+
traits:
|
|
130
|
+
- traitType: state
|
|
131
|
+
kind: boolean
|
|
132
|
+
id: enabled
|
|
133
|
+
description: Resting state. Backdrop background with a high separator border. The border carries the states below; the background only moves for `disabled`.
|
|
134
|
+
- traitType: state
|
|
135
|
+
kind: boolean
|
|
136
|
+
id: hovered
|
|
137
|
+
description: The border shifts one lightness step — darker in light mode, lighter in dark mode. In the error state it shifts from the error border.
|
|
138
|
+
- traitType: state
|
|
139
|
+
kind: boolean
|
|
140
|
+
id: focused
|
|
141
|
+
description: Focus outline on `:focus-visible`, offset from the border.
|
|
142
|
+
- traitType: state
|
|
143
|
+
kind: boolean
|
|
144
|
+
id: disabled
|
|
145
|
+
description: 'Inert background and a low separator border, with the text in the inert foreground color. `pointer-events: none`, so the field is not clickable.'
|
|
146
|
+
- traitType: state
|
|
147
|
+
kind: boolean
|
|
148
|
+
id: error
|
|
149
|
+
description: Set with the `hasError` prop, which adds `aria-invalid="true"` to the input. The error styling keys off that attribute, so the border turns the error separator color and the text the error foreground color. It carries no message — supply that yourself.
|
|
150
|
+
- traitType: variant
|
|
151
|
+
kind: enum
|
|
152
|
+
id: density
|
|
153
|
+
description: Sets the field's padding. The type size is fixed at body size 1.
|
|
154
|
+
values:
|
|
155
|
+
- id: regular
|
|
156
|
+
description: Default. Horizontal padding {space-2}, vertical padding {space-1}.
|
|
157
|
+
- id: loose
|
|
158
|
+
description: Horizontal padding {space-3}, vertical padding {space-2}. For forms with wide spacing.
|
|
159
|
+
$extensions:
|
|
160
|
+
com.sanity.ui:
|
|
161
|
+
implementationStatus:
|
|
162
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
163
|
+
implemented: true
|
|
164
|
+
migrationGuide:
|
|
165
|
+
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.'
|
|
166
|
+
guidance: |-
|
|
167
|
+
TextInput is now a plain native input. The sizing props and the icon, prefix, suffix and clear-button slots are gone. One `density` prop sets the spacing, and validation is a boolean named `hasError`.
|
|
168
|
+
|
|
169
|
+
### Detailed list of differences
|
|
170
|
+
|
|
171
|
+
| v3 pattern | v5 pattern | Notes |
|
|
172
|
+
| :---- | :---- | :---- |
|
|
173
|
+
| `<TextInput fontSize={2} weight="medium" />` | `<TextInput />` | The type size is fixed at body size 1, in regular weight |
|
|
174
|
+
| `<TextInput padding={3} space={3} />` | `<TextInput density="loose" />` | `density` is `regular` or `loose`. Neither value reproduces a v3 `padding={3}` exactly |
|
|
175
|
+
| `<TextInput radius={2} border={false} />` | `<TextInput />` | The radius is fixed at step 2, and the border is always drawn |
|
|
176
|
+
| `<TextInput customValidity="Required" />` | `<TextInput hasError />` plus your own message | `hasError` sets `aria-invalid` and recolors the border and text. It renders no text |
|
|
177
|
+
| `<TextInput icon={SearchIcon} iconRight={…} />` | `<TextInput />` | No icon slots. Put an icon beside the field, not inside it |
|
|
178
|
+
| `<TextInput prefix="https://" suffix=".com" />` | `<TextInput />` | No prefix or suffix slots |
|
|
179
|
+
| `<TextInput clearButton onClear={…} />` | `<TextInput />` plus your own Button | No built-in clear button |
|
|
180
|
+
| `<TextInput type="search" />` | `<TextInput type="search" />` | Unchanged. Every v3 text type still works, including `search` and `datetime-local` |
|
|
181
|
+
| All other native `<input>` attributes | Forwarded unchanged | Pass them as before |
|
|
182
|
+
|
|
183
|
+
### Breaking changes
|
|
184
|
+
|
|
185
|
+
- **The v3 styling and slot props are TypeScript errors.** `fontSize`, `weight`, `padding`, `space`, `gap`, `radius`, `border`, `icon`, `iconRight`, `suffix`, `clearButton`, `onClear` and `customValidity` are not TextInput props. `prefix` still compiles, because it is a native HTML attribute, but it renders no text.
|
|
186
|
+
- **`customValidity` is replaced by `hasError`.** The old prop set the native validation message. The new one is styling plus `aria-invalid`. You own the message and where it appears.
|
|
187
|
+
- **`type` means text types only.** The type excludes `button`, `checkbox`, `color`, `file`, `hidden`, `image`, `radio`, `range`, `reset` and `submit`, but TypeScript does not enforce it, because the prop still accepts any string. Every text type from v3 still works.
|
|
188
|
+
- **`aria-invalid` follows `hasError`.** A hand-set `aria-invalid` is overwritten. Set `hasError` instead.
|
|
189
|
+
- **The width is no longer yours to set on the component.** TextInput fills its container. Size it from the parent.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: text
|
|
3
|
+
name: Text
|
|
4
|
+
description: Displays body paragraphs, captions, and metadata.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [typography, text, body, caption, label, copy, paragraph, metadata, font]
|
|
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: Body copy, descriptions, captions, and metadata — any text that is not a heading.
|
|
17
|
+
- level: should-not
|
|
18
|
+
statement: Don't use Text to label a section in a Menu or above headings. Use Eyebrow instead.
|
|
19
|
+
alternatives:
|
|
20
|
+
- to: eyebrow
|
|
21
|
+
- level: should-not
|
|
22
|
+
statement: Don't use Text without as='label' to name a TextInput, Select or other input. Set as='label' and link it with htmlFor.
|
|
23
|
+
- level: should-not
|
|
24
|
+
statement: Don't use Text to denote a keyboard shortcut. Use KBD instead.
|
|
25
|
+
alternatives:
|
|
26
|
+
- to: kbd
|
|
27
|
+
- level: should-not
|
|
28
|
+
statement: Don't use Text for inline or block code samples. Use Code instead.
|
|
29
|
+
alternatives:
|
|
30
|
+
- to: code
|
|
31
|
+
- level: must-not
|
|
32
|
+
statement: Don't use Text for structural headings. Use Heading instead.
|
|
33
|
+
alternatives:
|
|
34
|
+
- to: heading
|
|
35
|
+
- kind: guidelines
|
|
36
|
+
for: all
|
|
37
|
+
framing: how-to-use
|
|
38
|
+
items:
|
|
39
|
+
- refs:
|
|
40
|
+
- to: shared-foundations#tone-signals-state
|
|
41
|
+
rel: same-as
|
|
42
|
+
- id: text-body-start-aligned
|
|
43
|
+
level: should
|
|
44
|
+
statement: "Start-align body copy and descriptive Text instances by default. Sanity's typographic system prefers start alignment unless a specific layout (for example, a centered hero) justifies a different one."
|
|
45
|
+
example:
|
|
46
|
+
title: Start-aligned body copy
|
|
47
|
+
description: "`<Text>Body copy runs start-aligned by default — no `align` needed.</Text>`. To verify, check the element's computed `text-align`; it should resolve to the start edge, not `center`."
|
|
48
|
+
checkedBy: manual
|
|
49
|
+
- id: text-secondary-uses-muted
|
|
50
|
+
level: should
|
|
51
|
+
statement: Apply muted to secondary or helper text (timestamps, captions, metadata, helper messages) so it renders visually less prominent than the primary text nearby.
|
|
52
|
+
example:
|
|
53
|
+
title: Secondary text carries muted
|
|
54
|
+
description: '`<Text size={1} muted>Edited 2 hours ago</Text>` beside `<Text>Document title</Text>`. To verify, confirm the `muted` prop is present on the secondary Text and that it renders at lower contrast than the primary text next to it.'
|
|
55
|
+
checkedBy: manual
|
|
56
|
+
- id: text-single-line-uses-truncate
|
|
57
|
+
level: should
|
|
58
|
+
statement: Set truncate={1} when a Text instance is intentionally limited to one visible line — an ellipsis appears once the content overflows.
|
|
59
|
+
example:
|
|
60
|
+
title: Single-line truncation
|
|
61
|
+
description: '`<Text truncate={1}>{title}</Text>`. To verify, narrow the container until the string overflows and confirm one line with a trailing ellipsis, carrying the `sui-text-overflow` class. Values above 1 clamp with `-webkit-line-clamp` instead.'
|
|
62
|
+
checkedBy: manual
|
|
63
|
+
- id: text-no-center-aligned-paragraphs
|
|
64
|
+
level: must-not
|
|
65
|
+
statement: Don't center-align long blocks of paragraph text — this disrupts reading flow. Multi-line paragraph Text instances (three or more lines at the default viewport) should stay start-aligned.
|
|
66
|
+
example:
|
|
67
|
+
title: The prohibited form — a centred multi-line paragraph
|
|
68
|
+
description: '`<Text align="center">` wrapping three or more lines of body copy. To verify, render at the default viewport width and count the visible lines; three or more must be start-aligned. Centring is acceptable only where the block stays within two lines at every supported width.'
|
|
69
|
+
checkedBy: manual
|
|
70
|
+
- id: text-tone-paired-with-icon-or-badge
|
|
71
|
+
level: must-not
|
|
72
|
+
statement: 'Don''t give Text a non-neutral tone (suggest, positive, caution, critical) unless it leads with the state, as in "**Error:** Upload failed.", or sits beside a matching icon in the same UI region.'
|
|
73
|
+
example:
|
|
74
|
+
title: The prohibited form — tone with no second channel
|
|
75
|
+
description: '`<Text tone="critical">Upload failed</Text>` with no icon beside it. The words describe what happened but do not name the state, so the colour does the work. To verify, view the region in grayscale and confirm the status still reads without colour. Fix it with a paired icon (InfoOutlineIcon, CheckmarkIcon, WarningOutlineIcon, ErrorOutlineIcon), or lead with the state: "**Error:** Upload failed."'
|
|
76
|
+
checkedBy: manual
|
|
77
|
+
refines:
|
|
78
|
+
- to: shared-foundations#tone-paired-with-second-channel
|
|
79
|
+
- id: text-no-emojis
|
|
80
|
+
level: must-not
|
|
81
|
+
statement: Never intersperse emojis with text, under any circumstances — not inline mid-sentence, not as a bullet substitute, not as a leading or trailing accent. An emoji inside a Text run is announced by its CLDR name in the middle of the sentence, disrupts line-height and vertical rhythm, and renders differently on every platform. When a visual symbol is required, use Icon beside the Text.
|
|
82
|
+
checks:
|
|
83
|
+
- href: ../evals/cases.yaml
|
|
84
|
+
role: agent-test
|
|
85
|
+
checkedBy: assisted
|
|
86
|
+
refines:
|
|
87
|
+
- to: shared-foundations#no-emojis
|
|
88
|
+
$extensions:
|
|
89
|
+
io.jev:
|
|
90
|
+
type: boolean
|
|
91
|
+
- kind: guidelines
|
|
92
|
+
for: agent
|
|
93
|
+
framing: how-to-use
|
|
94
|
+
items:
|
|
95
|
+
- level: must-not
|
|
96
|
+
statement: Don't use inline font-size or color styles on Text. Use the size, weight, and tone props instead.
|
|
97
|
+
- kind: guidelines
|
|
98
|
+
for: all
|
|
99
|
+
title: Content
|
|
100
|
+
tags: [content]
|
|
101
|
+
items:
|
|
102
|
+
- refs:
|
|
103
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
104
|
+
rel: same-as
|
|
105
|
+
- level: should
|
|
106
|
+
statement: Frame instructions as clear steps, not passive descriptions.
|
|
107
|
+
- refs:
|
|
108
|
+
- to: content-guidelines#plain-language
|
|
109
|
+
rel: same-as
|
|
110
|
+
- kind: guidelines
|
|
111
|
+
for: all
|
|
112
|
+
title: Accessibility
|
|
113
|
+
tags: [accessibility]
|
|
114
|
+
items:
|
|
115
|
+
- level: must
|
|
116
|
+
statement: Text must maintain 4.5:1 contrast against the background for standard text and 3:1 for large text (WCAG 1.4.3 AA). Take care with `muted` on non-white backgrounds.
|
|
117
|
+
- level: must
|
|
118
|
+
statement: Text must remain legible at 200% browser zoom. Avoid fixed pixel units in overrides.
|
|
119
|
+
- level: should
|
|
120
|
+
statement: Text defaults to `<span>`. Use `as="p"` when the text should serve as a paragraph. Use `as="li"` inside lists.
|
|
121
|
+
- kind: section
|
|
122
|
+
for: all
|
|
123
|
+
freeform:
|
|
124
|
+
- title: Semantics
|
|
125
|
+
body: |-
|
|
126
|
+
`as` sets the HTML element Text renders. It defaults to `span` and accepts any
|
|
127
|
+
element type, so the element is yours to choose and yours to get right — Text
|
|
128
|
+
applies no semantics of its own beyond the tag you name.
|
|
129
|
+
|
|
130
|
+
- Use `as="p"` for a paragraph, and `as="li"` inside a list.
|
|
131
|
+
- Use `as="abbr"` for abbreviations and acronyms. Avoid shortening terms — internal terms and jargon above all.
|
|
132
|
+
- Use `as="dfn"` for terms a reader may not know on first read. Link to a dedicated page when a short definition doesn't work.
|
|
133
|
+
alternatives:
|
|
134
|
+
- to: heading
|
|
135
|
+
note: Semantic page headings that define content hierarchy
|
|
136
|
+
- to: code
|
|
137
|
+
- to: kbd
|
|
138
|
+
refs:
|
|
139
|
+
- to: badge
|
|
140
|
+
rel: relates-to
|
|
141
|
+
note: Inline status labels with semantic tone
|
|
142
|
+
sourceFiles:
|
|
143
|
+
- platform: react
|
|
144
|
+
file: packages/ui/src/components/text/Text.tsx
|
|
145
|
+
imports:
|
|
146
|
+
- platform: react
|
|
147
|
+
code: import { Text } from '@sanity/ui'
|
|
148
|
+
package: '@sanity/ui'
|
|
149
|
+
traits:
|
|
150
|
+
- traitType: variant
|
|
151
|
+
kind: enum
|
|
152
|
+
id: truncate
|
|
153
|
+
description: 'Limits the text to a set number of lines and adds an ellipsis once it overflows. Takes a positive integer and accepts a responsive array (`truncate={[1, 1, 2]}`). Fill every slot up to the last one you set: `undefined` in a slot turns truncation off at that breakpoint. Unset means no truncation. Use it for metadata and support labels only — never for body text or a preview of it.'
|
|
154
|
+
values:
|
|
155
|
+
- id: '1'
|
|
156
|
+
description: 'One line. Clipped with `text-overflow: ellipsis` and `white-space: nowrap`, applied through the `sui-text-overflow` class.'
|
|
157
|
+
- id: '2-or-more'
|
|
158
|
+
description: Clamped to that many lines with `-webkit-line-clamp`. Any integer above 1 works; the value passes straight through.
|
|
159
|
+
- traitType: variant
|
|
160
|
+
kind: enum
|
|
161
|
+
id: size
|
|
162
|
+
description: Visual font size from the body text scale.
|
|
163
|
+
values:
|
|
164
|
+
- id: '0'
|
|
165
|
+
description: Smallest. Fine print, legal text, high-density layouts.
|
|
166
|
+
- id: '1'
|
|
167
|
+
description: Small. UI labels, menu items, toast messages, empty states.
|
|
168
|
+
- id: '2'
|
|
169
|
+
description: Medium (default). Content editing text, calls to action.
|
|
170
|
+
- id: '3'
|
|
171
|
+
description: Large. Rarely needed. Used for increased visual hierarchy/emphasis.
|
|
172
|
+
- id: '4'
|
|
173
|
+
description: Extra large. Rarely needed. Used for high visual hierarchy/emphasis or decorative purposes.
|
|
174
|
+
- traitType: variant
|
|
175
|
+
kind: enum
|
|
176
|
+
id: tone
|
|
177
|
+
description: Semantic text color.
|
|
178
|
+
values:
|
|
179
|
+
- id: neutral
|
|
180
|
+
description: Default. No semantic meaning.
|
|
181
|
+
- id: suggest
|
|
182
|
+
description: Suggestions or informational content. Pair with InfoOutlineIcon.
|
|
183
|
+
- id: positive
|
|
184
|
+
description: Success, published, healthy. Pair with CheckmarkIcon.
|
|
185
|
+
- id: caution
|
|
186
|
+
description: Needs attention. Pair with WarningOutlineIcon.
|
|
187
|
+
- id: critical
|
|
188
|
+
description: Error, failed, rejected. Pair with ErrorOutlineIcon.
|
|
189
|
+
- traitType: variant
|
|
190
|
+
kind: boolean
|
|
191
|
+
id: muted
|
|
192
|
+
description: Reduces visual prominence for secondary or helper text like timestamps and captions.
|
|
193
|
+
- traitType: variant
|
|
194
|
+
kind: boolean
|
|
195
|
+
id: trim
|
|
196
|
+
description: Removes extra whitespace above and below the text box for precise alignment with icons or badges.
|
|
197
|
+
- traitType: variant
|
|
198
|
+
kind: enum
|
|
199
|
+
id: align
|
|
200
|
+
description: CSS text-align property.
|
|
201
|
+
values:
|
|
202
|
+
- id: left
|
|
203
|
+
description: Default. Body copy, UI labels, and most other cases.
|
|
204
|
+
- id: center
|
|
205
|
+
description: Rare. Empty-state copy, labels inside centered UI elements.
|
|
206
|
+
- id: right
|
|
207
|
+
description: Numeric data in table cells, or right-to-left body copy.
|
|
208
|
+
- traitType: variant
|
|
209
|
+
kind: enum
|
|
210
|
+
id: weight
|
|
211
|
+
description: CSS font-weight property.
|
|
212
|
+
values:
|
|
213
|
+
- id: regular
|
|
214
|
+
description: Default. General body text above size 0.
|
|
215
|
+
- id: medium
|
|
216
|
+
description: Visual separation from body copy; improves legibility at small sizes.
|
|
217
|
+
- id: semibold
|
|
218
|
+
description: Emphasis within body copy, or labels in custom interactive components.
|
|
219
|
+
- id: bold
|
|
220
|
+
description: Strong emphasis at size 0, to aid legibility at the smallest size.
|
|
221
|
+
$extensions:
|
|
222
|
+
com.sanity.ui:
|
|
223
|
+
implementationStatus:
|
|
224
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
225
|
+
implemented: true
|
|
226
|
+
migrationGuide:
|
|
227
|
+
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.'
|
|
228
|
+
codemod: |-
|
|
229
|
+
`textOverflow` is replaced by `truncate` — both `"ellipsis"` and `"clip"` map to `truncate={1}`. `accent` is removed — use `tone` instead. `trim` and margin props are new. The codemod also adds `as="div"` and `trim` so migrated markup keeps its v3 rendering.
|
|
230
|
+
|
|
231
|
+
Run the codemod: `pnpx @sanity/ui-codemod latest:text --paths <paths> --toPackage @sanity/ui`.
|
|
232
|
+
guidance: |-
|
|
233
|
+
Text in the new system has new typography props. **Text no longer removes top/bottom text spacing by default. Use `trim` to match Sanity UI 3's vertical trimming style.**
|
|
234
|
+
|
|
235
|
+
### Key differences
|
|
236
|
+
|
|
237
|
+
- v5 components use CSS classes with a static stylesheet instead of `styled-components`.
|
|
238
|
+
- v3 Text rendered a `<div>` by default. The new Text renders `<span>`. Use `as="p"` when Text is long-form or block-level content.
|
|
239
|
+
- `textOverflow` replaced by `truncate`. Use `truncate={1}` for single-line truncation.
|
|
240
|
+
- `accent` removed. Use `tone` or a parent with a semantic tone for colored text.
|
|
241
|
+
- `trim` added. Removes extra whitespace above and below the text box when needed.
|
|
242
|
+
- Margin props added. Text now accepts `margin`, `marginX`, `marginY`, and per-side margin props.
|
|
243
|
+
|
|
244
|
+
### Detailed list of differences
|
|
245
|
+
|
|
246
|
+
| v3 prop | v5 prop | Notes |
|
|
247
|
+
| :---- | :---- | :---- |
|
|
248
|
+
| `accent` | — | Removed. No accent color prop. |
|
|
249
|
+
| `textOverflow="ellipsis"` | `truncate={1}` | The codemod maps both `"ellipsis"` and `"clip"` to `truncate={1}`. |
|
|
250
|
+
| — | `trim` | New. Applies `text-box-trim` for precise vertical alignment. |
|
|
251
|
+
| — | `truncate` | New. Limit to N visible lines. Adds multi-line clamping. |
|
|
252
|
+
| — | `margin*` | New. Text accepts margin props directly. |
|
|
253
|
+
|
|
254
|
+
### Breaking changes
|
|
255
|
+
|
|
256
|
+
- `textOverflow` prop removed. `<Text textOverflow="ellipsis">` will fire a TypeScript error. Use `<Text truncate={1}>`.
|
|
257
|
+
- `accent` prop removed. `<Text accent>` does nothing. Use Card `tone` or a parent element with a semantic tone.
|
|
258
|
+
- `styled-components` is no longer used. Custom styled-components extensions like `styled(Text)` will not work.
|
|
259
|
+
|
|
260
|
+
### Codemod
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
pnpx @sanity/ui-codemod latest:text --paths <paths> --toPackage @sanity/ui
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
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,90 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: tooltip-group
|
|
3
|
+
name: TooltipGroup
|
|
4
|
+
description: A container that lets the rest of a row's tooltips show at once after the first one has shown.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [tooltip, group, toolbar, action-bar]
|
|
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: A toolbar or action bar where each button has a tooltip.
|
|
17
|
+
- level: should
|
|
18
|
+
statement: A row of icon-only controls that a user scans across.
|
|
19
|
+
- level: should-not
|
|
20
|
+
statement: A single button with one tooltip. TooltipGroup adds no value for a single trigger.
|
|
21
|
+
alternatives:
|
|
22
|
+
- to: tooltip
|
|
23
|
+
- level: should-not
|
|
24
|
+
statement: Controls spread across the page. The grouped behaviour only applies inside the group element.
|
|
25
|
+
- kind: guidelines
|
|
26
|
+
for: all
|
|
27
|
+
framing: how-to-use
|
|
28
|
+
items:
|
|
29
|
+
- level: should
|
|
30
|
+
statement: Wrap only tooltips that are logically grouped — a toolbar, an action bar, or a row of icon buttons.
|
|
31
|
+
- level: must-not
|
|
32
|
+
statement: Do not use TooltipGroup for a single trigger. It adds no value and creates unnecessary markup.
|
|
33
|
+
- kind: guidelines
|
|
34
|
+
for: agent
|
|
35
|
+
framing: how-to-use
|
|
36
|
+
items:
|
|
37
|
+
- level: must
|
|
38
|
+
statement: The group wrapper has no ARIA role. Individual Tooltip components still wire aria-describedby on their triggers.
|
|
39
|
+
- level: should
|
|
40
|
+
statement: Use TooltipGroup when multiple adjacent triggers each have a Tooltip — a toolbar, action bar, or icon row.
|
|
41
|
+
- kind: section
|
|
42
|
+
for: agent
|
|
43
|
+
freeform:
|
|
44
|
+
- title: How it works
|
|
45
|
+
body: |-
|
|
46
|
+
Without a group, each tooltip in a toolbar opens on its own, so the user sees a pause at every button they scan across.
|
|
47
|
+
|
|
48
|
+
Once one tooltip in the group is visible, the rest show at once.
|
|
49
|
+
|
|
50
|
+
When the mouse leaves the group or focus moves outside it, the group resets.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { TooltipGroup, Tooltip, IconButton } from '@sanity/ui'
|
|
54
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
55
|
+
import { EditIcon } from '@sanity/icons/Edit'
|
|
56
|
+
import { CopyIcon } from '@sanity/icons/Copy'
|
|
57
|
+
|
|
58
|
+
<TooltipGroup>
|
|
59
|
+
<Tooltip content="Delete">
|
|
60
|
+
<IconButton icon={TrashIcon} aria-label="Delete" level="tertiary" />
|
|
61
|
+
</Tooltip>
|
|
62
|
+
<Tooltip content="Edit">
|
|
63
|
+
<IconButton icon={EditIcon} aria-label="Edit" level="tertiary" />
|
|
64
|
+
</Tooltip>
|
|
65
|
+
<Tooltip content="Duplicate">
|
|
66
|
+
<IconButton icon={CopyIcon} aria-label="Duplicate" level="tertiary" />
|
|
67
|
+
</Tooltip>
|
|
68
|
+
</TooltipGroup>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Once one tooltip in the group is visible, the rest show at once.
|
|
72
|
+
|
|
73
|
+
When the mouse leaves the group or focus moves outside it, the group resets.
|
|
74
|
+
|
|
75
|
+
refs:
|
|
76
|
+
- to: tooltip
|
|
77
|
+
rel: relates-to
|
|
78
|
+
note: The floating label that TooltipGroup coordinates
|
|
79
|
+
sourceFiles:
|
|
80
|
+
- platform: react
|
|
81
|
+
file: packages/ui/src/components/tooltip-group/TooltipGroup.tsx
|
|
82
|
+
imports:
|
|
83
|
+
- platform: react
|
|
84
|
+
code: import { TooltipGroup } from '@sanity/ui'
|
|
85
|
+
package: '@sanity/ui'
|
|
86
|
+
$extensions:
|
|
87
|
+
com.sanity.ui:
|
|
88
|
+
implementationStatus:
|
|
89
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
90
|
+
implemented: true
|