@sanity/ui 5.0.0-alpha.21 → 5.0.0-alpha.23
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.js +1 -1
- 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 +284 -0
- package/docs/components/card.dsds.yaml +317 -0
- package/docs/components/checkbox.dsds.yaml +204 -0
- package/docs/components/code.dsds.yaml +167 -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 +217 -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 +220 -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 +208 -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.dsds.yaml +2513 -0
- package/docs/index.dsds.yaml +515 -0
- package/docs/overview/api-essentials.dsds.yaml +221 -0
- package/docs/overview/component-reference.dsds.yaml +215 -0
- package/docs/overview/designer-contribution-model.dsds.yaml +77 -0
- package/docs/overview/developer-contribution-model.dsds.yaml +362 -0
- package/docs/overview/installation.dsds.yaml +238 -0
- package/docs/overview/quick-start.dsds.yaml +317 -0
- package/docs/overview/resources.dsds.yaml +34 -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 +356 -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 +39 -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 +13 -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 +69 -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/css/classes/system/shadow.css +45 -0
- package/src/version.ts +2 -2
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
kind: sanity.guide
|
|
2
|
+
id: api-essentials
|
|
3
|
+
name: API essentials
|
|
4
|
+
description: Cross-cutting rules for writing Sanity UI 5. Covers prop value types, prop ownership, and import shapes.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- agent
|
|
8
|
+
- api
|
|
9
|
+
- props
|
|
10
|
+
- prop types
|
|
11
|
+
- responsive
|
|
12
|
+
- spacing
|
|
13
|
+
- layout
|
|
14
|
+
- imports
|
|
15
|
+
- icons
|
|
16
|
+
- theming
|
|
17
|
+
- v5
|
|
18
|
+
- getting-started
|
|
19
|
+
status:
|
|
20
|
+
status: stable
|
|
21
|
+
sections:
|
|
22
|
+
- kind: guidelines
|
|
23
|
+
for: all
|
|
24
|
+
framing: how-to-use
|
|
25
|
+
title: What v5 provides
|
|
26
|
+
items:
|
|
27
|
+
- level: must
|
|
28
|
+
statement: >-
|
|
29
|
+
Check that a component is in the component reference, and verify
|
|
30
|
+
the export before writing against it. Run `node -e "console.log(Object.keys(require('@sanity/ui')))"` in the project to list the exports of the installed version
|
|
31
|
+
for the installed version. The reference is the single index; this document does not
|
|
32
|
+
keep a second copy of it.
|
|
33
|
+
refs:
|
|
34
|
+
- to: component-reference
|
|
35
|
+
rel: relates-to
|
|
36
|
+
- level: must
|
|
37
|
+
statement: Do not write your own version of anything on that list. Compose what exists.
|
|
38
|
+
|
|
39
|
+
- kind: guidelines
|
|
40
|
+
for: all
|
|
41
|
+
framing: how-to-use
|
|
42
|
+
title: Prop value types
|
|
43
|
+
items:
|
|
44
|
+
- level: must
|
|
45
|
+
statement: Spacing and sizing take different value types. Write `<Box padding={2} width="300px">`. The integer and the string are both correct on that one element. Do not carry the integer form over to a sizing prop.
|
|
46
|
+
- level: must
|
|
47
|
+
statement: >-
|
|
48
|
+
Pass spacing as an integer in braces. Write `<Box padding={2}>` or `<Flex gap={3}>`, never `padding="2"`. A string is a TypeScript error. `padding`, `margin` and `gap` take a step on the spacing scale, never a pixel value. The scale is non-linear: {space-0}, {space-1}, {space-2}, {space-3}, {space-4}, {space-5}, {space-6}, {space-7}, {space-8}, {space-9}. The number after `space-` is the step you pass. `radius` takes a step on its own scale: {radius-0}, {radius-1}, {radius-2}, {radius-3}, {radius-4}, {radius-5}, {radius-6}, and `radius="full"` for a pill or circle, which is {radius-round}.
|
|
49
|
+
refs:
|
|
50
|
+
- to: spacing-guidelines
|
|
51
|
+
rel: relates-to
|
|
52
|
+
- level: must
|
|
53
|
+
statement: >-
|
|
54
|
+
Pass a type size as a step too. `size` on Text, Heading, Code and Eyebrow is a step on that component's scale, not a pixel value — `<Text size={1}>` is {body-1}, and `<Text size={20}>` is a TypeScript error. Text runs {body-0} to {body-4}. Heading runs {heading-0} to {heading-5}. For every step, read `docs/tokens/typography.dsds.yaml`.
|
|
55
|
+
refs:
|
|
56
|
+
- to: typography-guidelines
|
|
57
|
+
rel: relates-to
|
|
58
|
+
- level: must
|
|
59
|
+
statement: >-
|
|
60
|
+
Pass `shadow` as a step from 0 to 5 on Box, Container, Flex or Grid. Choose it by the surface's role, not its look. Use `shadow={0}` for a flat surface, `1` for a resting card, `2` for a hovered card or small raised element, `3` for a popover, dropdown or menu, `4` for a modal or overlay, and `5` for a top-layer surface. Never write a `box-shadow` in `style`. The recipes are {shadow-0} to {shadow-5}; read `docs/tokens/shadow.dsds.yaml` for their values.
|
|
61
|
+
- level: must
|
|
62
|
+
statement: >-
|
|
63
|
+
Position props take a spacing step, not a CSS length. `top`, `right`, `bottom`, `left` and `inset` on Box, Container, Flex and Grid accept a step from 0 to 9, or `"auto"`, the same values as `padding`. `top={0}` is {space-0}, but `top={4}` is {space-4}, not four pixels. For a length the scale does not have, such as `50%` or `64px`, set it in `style`. That is the one case where `style` is correct for these properties.
|
|
64
|
+
- id: sizing-is-a-css-string
|
|
65
|
+
level: must
|
|
66
|
+
statement: Pass sizing as a CSS string, including zero. Write `<Box width="300px" maxWidth="100%" minHeight="0">`. A pixel value is a string as well — write `width="140px"`, not `width={140}`. A number is a TypeScript error. This is the exception to the integer rule above, and it covers `width`, `height`, `minWidth`, `maxWidth`, `minHeight`, and `maxHeight`.
|
|
67
|
+
- level: must
|
|
68
|
+
statement: 'The flexbox shrink idiom also takes a string. Write `<Flex flexGrow={1} minHeight="0">` — `flexGrow` is a number and `minHeight` is a string, on the same element.'
|
|
69
|
+
- level: must
|
|
70
|
+
statement: Pass flex values as numbers. Write `<Box flexGrow={1} flexShrink={0}>`, never `flexGrow` on its own and never `flexGrow={true}`. A boolean is a TypeScript error.
|
|
71
|
+
- id: responsive-array-undefined-slot
|
|
72
|
+
level: must
|
|
73
|
+
statement: >-
|
|
74
|
+
A responsive array has at most six slots, one per breakpoint: `[base, 360px, 600px, 900px, 1200px, 1800px]`. Each value applies from that `min-width` up.
|
|
75
|
+
For CSS string and number props, fill every slot up to the last one you set. In `padding={[2, undefined, 4]}`,
|
|
76
|
+
an `undefined` slot keeps the previous breakpoint's value for step and keyword props, such as `padding`
|
|
77
|
+
and `flexDirection`. For a CSS string or number prop, such as `width` or `flexBasis`, it resets the value.
|
|
78
|
+
- level: must
|
|
79
|
+
statement: Pass tone and color as token keys, not CSS colors. Write `<Badge tone="critical">`. A hex value or an arbitrary string is a TypeScript error.
|
|
80
|
+
- level: must
|
|
81
|
+
statement: >-
|
|
82
|
+
In custom markup that no component covers, take color from the semantic custom properties, which follow light and dark mode on their own. Write `var(--background-low)` for a surface, `var(--foreground-high)` or `var(--foreground-low)` for text, and `var(--separator-low)` for a border. Their values are {background-low}, {foreground-high} and {foreground-low}. Read `docs/tokens/semantic.dsds.yaml` for the full set. The names `--card-border-color`, `--card-bg-color` and `--card-fg-color` do not exist, so a declaration that uses them does nothing.
|
|
83
|
+
refs:
|
|
84
|
+
- to: semantic-tokens
|
|
85
|
+
rel: relates-to
|
|
86
|
+
- kind: guidelines
|
|
87
|
+
for: all
|
|
88
|
+
framing: how-to-use
|
|
89
|
+
title: Which component accepts which prop
|
|
90
|
+
items:
|
|
91
|
+
- level: must
|
|
92
|
+
statement: Box, Container, Flex, and Grid accept `padding` and `margin` directly. Reach for one of these when you need spacing.
|
|
93
|
+
- level: must
|
|
94
|
+
statement: Card sets spacing and radius through `density`. Leave it out for the regular spacing, or write `density="compact"` or `density="loose"`. Passing `padding`, `gap`, or `radius` to Card is a TypeScript error.
|
|
95
|
+
- level: must
|
|
96
|
+
statement: VStack and HStack accept only `gap` and `as`. Write `<Box padding={3}><VStack gap={2}>…</VStack></Box>` when you need anything else.
|
|
97
|
+
- level: must
|
|
98
|
+
statement: Icons render an SVG element and accept no layout props. Wrap a glyph in `<Icon>`, set its scale with `size`, and set its color with `tone`.
|
|
99
|
+
- id: prop-before-inline-style
|
|
100
|
+
level: should
|
|
101
|
+
statement: >-
|
|
102
|
+
Any CSS with a component-prop equivalent is passed as that prop, not
|
|
103
|
+
inside a `style` object. `style` is for values with no prop path —
|
|
104
|
+
a transform, a gradient, an aspect ratio, a CSS custom property.
|
|
105
|
+
A native element with no Sanity UI equivalent, such as `<table>`,
|
|
106
|
+
`<td>` or `<fieldset>`, has no props at all. `style` on it is correct.
|
|
107
|
+
checks:
|
|
108
|
+
- href: ../evals/cases.yaml
|
|
109
|
+
role: agent-test
|
|
110
|
+
checkedBy: assisted
|
|
111
|
+
$extensions:
|
|
112
|
+
io.jev:
|
|
113
|
+
type: boolean
|
|
114
|
+
- id: no-default-prop-values
|
|
115
|
+
level: should-not
|
|
116
|
+
statement: >-
|
|
117
|
+
Don't write a prop at its default value. `<Card density="regular">`,
|
|
118
|
+
`<Button level="primary">` and `<Text size={2}>` render the same as
|
|
119
|
+
`<Card>`, `<Button>` and `<Text>`. Write a prop only to choose
|
|
120
|
+
something other than the default. The linter removes a default-valued
|
|
121
|
+
prop on its own.
|
|
122
|
+
- kind: guidelines
|
|
123
|
+
for: all
|
|
124
|
+
framing: how-to-use
|
|
125
|
+
title: Prop names
|
|
126
|
+
items:
|
|
127
|
+
- level: must
|
|
128
|
+
statement: Flex uses the CSS property names. Write `<Flex flexDirection="column" alignItems="center" justifyContent="space-between">`. `direction`, `align`, `justify`, and `wrap` do not exist.
|
|
129
|
+
- level: must
|
|
130
|
+
statement: Grid takes `gridTemplateColumns` with a CSS string. Write `<Grid gridTemplateColumns="repeat(3, 1fr)" gap={3}>`. There is no `columns` prop.
|
|
131
|
+
- level: must
|
|
132
|
+
statement: Icon takes `icon`, not `symbol`. Write `<Icon icon={SearchIcon} />`. Passing `symbol` is a TypeScript error and renders no icon.
|
|
133
|
+
- level: must
|
|
134
|
+
statement: Tooltip takes its label as `content`, and points at its `children`. Write `<Tooltip content="Search"><IconButton … /></Tooltip>`. There is no `text` or `trigger` prop.
|
|
135
|
+
- level: must
|
|
136
|
+
statement: A label element takes its text as `children`. Write `<Text as="label" htmlFor="email">Email address</Text>`, linking `htmlFor` to the input's `id`.
|
|
137
|
+
- level: must
|
|
138
|
+
statement: IconButton takes `icon` plus native button attributes. Write `<IconButton icon={SearchIcon} aria-label="Search" />`. It has no `label` or `size` prop.
|
|
139
|
+
- level: must
|
|
140
|
+
statement: Button accepts `tone="neutral"` or `tone="critical"`, and nothing else. Write `<Button text="Delete" tone="critical" />`. There is no `primary`, `positive`, or `caution`. Use a plain Button for a default action, and `critical` only for a destructive one.
|
|
141
|
+
- level: must
|
|
142
|
+
statement: SkipToContent takes `href` and `label`. Write `<SkipToContent href="#main-content" label="Skip to main content" />`, keeping the leading `#`. There is no `hash` prop.
|
|
143
|
+
- level: must
|
|
144
|
+
statement: 'Name a Switch with a linked label element, `aria-label` or `aria-labelledby`. Switch has no `label` prop, so `<Switch label="…" />` is a TypeScript error. Write `<Switch id="notify" />` beside `<Text as="label" htmlFor="notify">Enable notifications</Text>`.'
|
|
145
|
+
- level: should
|
|
146
|
+
statement: ESLint fixes wrong prop names on Flex, Grid, Icon, Container and Tooltip on its own. Where your setup has it, run it after writing code that uses them.
|
|
147
|
+
- level: should-not
|
|
148
|
+
statement: >-
|
|
149
|
+
Avoid spreading props from a loosely typed object, as in
|
|
150
|
+
`const p: Record<string, unknown> = { direction: 'row' }` and then
|
|
151
|
+
`<Flex {...p} />`. Those props skip type checking, so a wrong prop
|
|
152
|
+
name stays silent and does nothing at runtime. If a new prop has no
|
|
153
|
+
visible effect, check for a spread like this first.
|
|
154
|
+
- level: must-not
|
|
155
|
+
statement: Do not put `flexDirection`, `alignItems`, `justifyContent` or `flexWrap` on `Box`. They belong to `Flex`. On `Box` they are a TypeScript error, not a setting that quietly does nothing.
|
|
156
|
+
- id: no-layout-props-on-typography-or-actions
|
|
157
|
+
level: must-not
|
|
158
|
+
statement: >-
|
|
159
|
+
Button and IconButton accept no layout, spacing or sizing props —
|
|
160
|
+
`padding`, `margin*`, `width`, `height`, `flexGrow`, `flexShrink`,
|
|
161
|
+
`alignSelf` and the like belong on a wrapping Box. Text and Heading
|
|
162
|
+
accept the margin props (`margin`, `marginX`, `marginY` and each
|
|
163
|
+
side, on the spacing scale) and nothing else from that list.
|
|
164
|
+
checks:
|
|
165
|
+
- href: ../evals/cases.yaml
|
|
166
|
+
role: agent-test
|
|
167
|
+
checkedBy: assisted
|
|
168
|
+
$extensions:
|
|
169
|
+
io.jev:
|
|
170
|
+
type: boolean
|
|
171
|
+
- kind: guidelines
|
|
172
|
+
for: all
|
|
173
|
+
framing: how-to-use
|
|
174
|
+
title: Imports
|
|
175
|
+
items:
|
|
176
|
+
- id: icon-import-from-subpath
|
|
177
|
+
level: must
|
|
178
|
+
statement: Each icon is imported from its own subpath — `import {SearchIcon} from '@sanity/icons/Search'` — not from the package root. The subpath drops the `Icon` suffix.
|
|
179
|
+
checks:
|
|
180
|
+
- href: ../evals/cases.yaml
|
|
181
|
+
role: agent-test
|
|
182
|
+
checkedBy: assisted
|
|
183
|
+
$extensions:
|
|
184
|
+
io.jev:
|
|
185
|
+
type: boolean
|
|
186
|
+
- level: must
|
|
187
|
+
statement: Do not import an icon from the package root. The root ships a type-only stub. The import passes `tsc` and then fails in the browser.
|
|
188
|
+
- level: must
|
|
189
|
+
statement: Import `List` alone and reach its parts through dot access, as in `<List.Item>` and `<List.ItemText>`. `ListItem` is not an export.
|
|
190
|
+
- id: choose-icons-from-icons-entry
|
|
191
|
+
level: should
|
|
192
|
+
statement: >-
|
|
193
|
+
To choose an icon, look it up in the `icons` entry: every icon in
|
|
194
|
+
@sanity/icons, with its import path, purpose and other names it goes by.
|
|
195
|
+
Find an icon by purpose by searching `docs/icons.dsds.yaml` for the purpose word.
|
|
196
|
+
- kind: guidelines
|
|
197
|
+
for: all
|
|
198
|
+
framing: how-to-use
|
|
199
|
+
title: Interaction and theming
|
|
200
|
+
items:
|
|
201
|
+
- level: must
|
|
202
|
+
statement: Do not put `onClick` on Box or Card, and do not set `as="button"` on Box. Use Button, or wrap a custom surface in PressArea.
|
|
203
|
+
- level: must
|
|
204
|
+
statement: v5 ships no theming API. It has no `ThemeProvider`, no `studioTheme`, and no runtime scheme toggle. Importing one from v5 is a TypeScript error.
|
|
205
|
+
- kind: guidelines
|
|
206
|
+
for: agent
|
|
207
|
+
framing: how-to-use
|
|
208
|
+
title: Work within the system's opinions
|
|
209
|
+
items:
|
|
210
|
+
- level: must
|
|
211
|
+
statement: Use the prop the component gives you, even when it is coarser than the control you had in mind. Card takes `density` — `compact`, `regular` or `loose` — and that is its whole spacing surface. It has no `padding`, `gap` or `radius` prop, and passing one is a TypeScript error.
|
|
212
|
+
- level: must
|
|
213
|
+
statement: Treat a missing knob as a decision, not a gap. The system withholds a control when the choice belongs to the system, not the page. Pick the nearest value it offers and move on.
|
|
214
|
+
- level: must
|
|
215
|
+
statement: Build what the brief asks for out of the components the system provides. Match its content and its structure. Do not reproduce a specific visual treatment the system does not offer.
|
|
216
|
+
- level: should-not
|
|
217
|
+
statement: Avoid wrapping a design system component in a Box purely to add spacing it withholds. A wrapper that exists only to re-space a component is the same override written one level out.
|
|
218
|
+
- level: must-not
|
|
219
|
+
statement: 'Do not restyle a design system component with `style={{ … }}` or a `className`. Inline styles bypass the token system, break in dark mode, and drift from every other instance of that component.'
|
|
220
|
+
- level: must-not
|
|
221
|
+
statement: Do not override a component's own colour, spacing or radius through CSS custom properties. Those properties let custom markup match the system. They are not a way to restyle the system's own components.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
kind: sanity.guide
|
|
2
|
+
id: component-reference
|
|
3
|
+
name: Component reference
|
|
4
|
+
description: The index of what to build with — every documented Sanity UI component, grouped by taxonomy category, with its status in Sanity UI 5 (stable, beta or unavailable).
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- concept
|
|
8
|
+
- components
|
|
9
|
+
- index
|
|
10
|
+
- reference
|
|
11
|
+
- taxonomy
|
|
12
|
+
- v5
|
|
13
|
+
- status
|
|
14
|
+
- stable
|
|
15
|
+
- beta
|
|
16
|
+
- unavailable
|
|
17
|
+
- package
|
|
18
|
+
status:
|
|
19
|
+
status: stable
|
|
20
|
+
sections:
|
|
21
|
+
- kind: guidelines
|
|
22
|
+
for: agent
|
|
23
|
+
framing: how-to-use
|
|
24
|
+
items:
|
|
25
|
+
- level: must
|
|
26
|
+
statement: Check a component's status before writing code against it. An unavailable component is documented ahead of its release, and importing it is a build error.
|
|
27
|
+
- level: should
|
|
28
|
+
statement: Treat rows marked with a dagger (best-fit placement) as this doc's own categorization, not a placement confirmed in the source taxonomy — the taxonomy is still in progress and some categories (Discovery, Messaging) have no components officially assigned yet.
|
|
29
|
+
- level: should
|
|
30
|
+
statement: Check the guidance in `docs/patterns/` before you build a common pattern out of primitives. Patterns cover the accessibility requirements that cause most failures in this library, such as landmarks and heading order.
|
|
31
|
+
- kind: section
|
|
32
|
+
for: all
|
|
33
|
+
freeform:
|
|
34
|
+
- title: Overview
|
|
35
|
+
body: |-
|
|
36
|
+
Every documented Sanity UI component and its status in Sanity UI 5. This is the single index — each entry is a `ref` to the component's own document, so the list cannot drift from the corpus. Each ref's role is that component's own `status`.
|
|
37
|
+
|
|
38
|
+
- **stable** — exported from `@sanity/ui` 5 and ready to build with.
|
|
39
|
+
- **beta** — exported from `@sanity/ui` 5 and ready to build with. Its API may still change before 5.0.
|
|
40
|
+
- **unavailable** — not exported from `@sanity/ui` 5 yet. Importing it is a build error. Its doc keeps the usage guidance, so you can see what is coming and build a stand-in.
|
|
41
|
+
- **deprecated** — still exported, but do not use it in new code. Its doc names the replacement.
|
|
42
|
+
- **experimental** — exported, but marked `@alpha` in the source. Its API can change without notice; check it before relying on it.
|
|
43
|
+
- title: Layout
|
|
44
|
+
body: Composes content into logical arrangements.
|
|
45
|
+
refs:
|
|
46
|
+
- to: box
|
|
47
|
+
rel: relates-to
|
|
48
|
+
role: stable
|
|
49
|
+
- to: flex
|
|
50
|
+
rel: relates-to
|
|
51
|
+
role: stable
|
|
52
|
+
- to: grid
|
|
53
|
+
rel: relates-to
|
|
54
|
+
role: stable
|
|
55
|
+
- to: container
|
|
56
|
+
rel: relates-to
|
|
57
|
+
role: stable
|
|
58
|
+
- to: v-stack
|
|
59
|
+
rel: relates-to
|
|
60
|
+
role: stable
|
|
61
|
+
- to: h-stack
|
|
62
|
+
rel: relates-to
|
|
63
|
+
role: stable
|
|
64
|
+
- to: inline
|
|
65
|
+
rel: relates-to
|
|
66
|
+
role: deprecated
|
|
67
|
+
note: '**Deprecated** — use HStack instead'
|
|
68
|
+
- to: visually-hidden
|
|
69
|
+
rel: relates-to
|
|
70
|
+
role: stable
|
|
71
|
+
- title: Organization
|
|
72
|
+
body: Orders content into logical groupings.
|
|
73
|
+
refs:
|
|
74
|
+
- to: card
|
|
75
|
+
rel: relates-to
|
|
76
|
+
role: stable
|
|
77
|
+
- to: divider
|
|
78
|
+
rel: relates-to
|
|
79
|
+
role: stable
|
|
80
|
+
- to: list
|
|
81
|
+
rel: relates-to
|
|
82
|
+
role: beta
|
|
83
|
+
- to: list-item
|
|
84
|
+
rel: relates-to
|
|
85
|
+
role: beta
|
|
86
|
+
- to: list-item-text
|
|
87
|
+
rel: relates-to
|
|
88
|
+
role: beta
|
|
89
|
+
- to: list-item-image
|
|
90
|
+
rel: relates-to
|
|
91
|
+
role: beta
|
|
92
|
+
- to: list-button-item
|
|
93
|
+
rel: relates-to
|
|
94
|
+
role: beta
|
|
95
|
+
- to: avatar-stack
|
|
96
|
+
rel: relates-to
|
|
97
|
+
role: beta
|
|
98
|
+
- title: Action
|
|
99
|
+
body: Triggers actions.
|
|
100
|
+
refs:
|
|
101
|
+
- to: button
|
|
102
|
+
rel: relates-to
|
|
103
|
+
role: beta
|
|
104
|
+
- to: press-area
|
|
105
|
+
rel: relates-to
|
|
106
|
+
role: beta
|
|
107
|
+
- to: icon-button
|
|
108
|
+
rel: relates-to
|
|
109
|
+
role: beta
|
|
110
|
+
- title: Information
|
|
111
|
+
body: Displays content in various formats.
|
|
112
|
+
refs:
|
|
113
|
+
- to: text
|
|
114
|
+
rel: relates-to
|
|
115
|
+
role: stable
|
|
116
|
+
- to: heading
|
|
117
|
+
rel: relates-to
|
|
118
|
+
role: stable
|
|
119
|
+
- to: code
|
|
120
|
+
rel: relates-to
|
|
121
|
+
role: stable
|
|
122
|
+
- to: icon
|
|
123
|
+
rel: relates-to
|
|
124
|
+
role: stable
|
|
125
|
+
- to: eyebrow
|
|
126
|
+
rel: relates-to
|
|
127
|
+
role: beta
|
|
128
|
+
- to: kbd
|
|
129
|
+
rel: relates-to
|
|
130
|
+
role: experimental
|
|
131
|
+
- to: hotkeys
|
|
132
|
+
rel: relates-to
|
|
133
|
+
role: experimental
|
|
134
|
+
- to: badge
|
|
135
|
+
rel: relates-to
|
|
136
|
+
role: beta
|
|
137
|
+
- to: avatar
|
|
138
|
+
rel: relates-to
|
|
139
|
+
role: beta
|
|
140
|
+
- to: avatar-counter
|
|
141
|
+
rel: relates-to
|
|
142
|
+
role: beta
|
|
143
|
+
- title: Disclosure
|
|
144
|
+
body: Reveals relevant/contextual content when requested.
|
|
145
|
+
refs:
|
|
146
|
+
- to: tooltip
|
|
147
|
+
rel: relates-to
|
|
148
|
+
role: beta
|
|
149
|
+
- to: tooltip-group
|
|
150
|
+
rel: relates-to
|
|
151
|
+
role: beta
|
|
152
|
+
- to: dialog
|
|
153
|
+
rel: relates-to
|
|
154
|
+
role: beta
|
|
155
|
+
note: Shipped as `Modal` in 5.0.0-alpha.5, renamed to `Dialog` in 5.0.0-alpha.7. No `Modal` alias.
|
|
156
|
+
- to: popover
|
|
157
|
+
rel: relates-to
|
|
158
|
+
role: beta
|
|
159
|
+
note: Ships in v5 — exported from the root barrel and present in 5.0.0-alpha.10.
|
|
160
|
+
- title: Discovery
|
|
161
|
+
body: Provides a way to find relevant content. No components confirmed in the source taxonomy yet.
|
|
162
|
+
- title: Navigation
|
|
163
|
+
body: Allows traversal to different areas of an application.
|
|
164
|
+
refs:
|
|
165
|
+
- to: link
|
|
166
|
+
rel: relates-to
|
|
167
|
+
role: beta
|
|
168
|
+
- to: skip-to-content
|
|
169
|
+
rel: relates-to
|
|
170
|
+
role: beta
|
|
171
|
+
- to: tabs
|
|
172
|
+
rel: relates-to
|
|
173
|
+
role: beta
|
|
174
|
+
- title: Input
|
|
175
|
+
body: Provides a way to add/manipulate content.
|
|
176
|
+
refs:
|
|
177
|
+
- to: checkbox
|
|
178
|
+
rel: relates-to
|
|
179
|
+
role: beta
|
|
180
|
+
- to: radio
|
|
181
|
+
rel: relates-to
|
|
182
|
+
role: beta
|
|
183
|
+
- to: switch
|
|
184
|
+
rel: relates-to
|
|
185
|
+
role: beta
|
|
186
|
+
- to: text-input
|
|
187
|
+
rel: relates-to
|
|
188
|
+
role: beta
|
|
189
|
+
- to: text-area
|
|
190
|
+
rel: relates-to
|
|
191
|
+
role: beta
|
|
192
|
+
- to: select
|
|
193
|
+
rel: relates-to
|
|
194
|
+
role: beta
|
|
195
|
+
- title: Feedback
|
|
196
|
+
body: Delivers a response to an action.
|
|
197
|
+
refs:
|
|
198
|
+
- to: spinner
|
|
199
|
+
rel: relates-to
|
|
200
|
+
role: beta
|
|
201
|
+
- to: indicator
|
|
202
|
+
rel: relates-to
|
|
203
|
+
role: beta
|
|
204
|
+
- to: indicator-stack
|
|
205
|
+
rel: relates-to
|
|
206
|
+
role: beta
|
|
207
|
+
- title: Messaging
|
|
208
|
+
body: Proactively communicates information. No components confirmed in the source taxonomy yet.
|
|
209
|
+
- title: See also
|
|
210
|
+
body: Shared props (spacing, tone, sizing and positioning) are described in `docs/overview/api-essentials.dsds.yaml`.
|
|
211
|
+
- kind: section
|
|
212
|
+
for: agent
|
|
213
|
+
freeform:
|
|
214
|
+
- title: Intent
|
|
215
|
+
body: Use this index to check a component's status — stable, beta or unavailable — before importing it or writing code against its docs.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
kind: sanity.guide
|
|
2
|
+
id: designer-contribution-model
|
|
3
|
+
name: Sanity Design System's design contribution model
|
|
4
|
+
description: How designers propose and graduate a recipe into the core Sanity Design System through a three-step, low-process contribution model.
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- contribution
|
|
8
|
+
- designer
|
|
9
|
+
- recipe
|
|
10
|
+
- triage
|
|
11
|
+
- graduation
|
|
12
|
+
- process
|
|
13
|
+
- design system
|
|
14
|
+
- governance
|
|
15
|
+
status:
|
|
16
|
+
status: stable
|
|
17
|
+
sections:
|
|
18
|
+
- kind: guidelines
|
|
19
|
+
for: agent
|
|
20
|
+
framing: how-to-use
|
|
21
|
+
items:
|
|
22
|
+
- level: should
|
|
23
|
+
statement: Build recipes out of existing Sanity Design System components and tokens where possible — doing so carries baseline accessibility and consistency requirements forward automatically.
|
|
24
|
+
- level: should
|
|
25
|
+
statement: Propose graduating a recipe (Step 2) only when the creator believes it would be valuable beyond their own feature — bring it to a triage sync with the design system team and, ideally, a developer to confirm technical soundness.
|
|
26
|
+
- level: should
|
|
27
|
+
statement: 'When a recipe graduates (Step 3), assign explicit owners for four separate workstreams: changes to the initial recipe, spec definition, documentation, and component development.'
|
|
28
|
+
- level: must-not
|
|
29
|
+
statement: Do not treat stopping at Step 1 (a recipe that never graduates) as a failure — it is an explicitly supported, penalty-free outcome, and the feature team retains ownership and maintenance of it.
|
|
30
|
+
- kind: steps
|
|
31
|
+
for: all
|
|
32
|
+
ordered: true
|
|
33
|
+
title: The three-step contribution model
|
|
34
|
+
items:
|
|
35
|
+
- title: 'Step 1: Make a recipe'
|
|
36
|
+
description: |-
|
|
37
|
+
A recipe is a distinct composition of existing design system components or design tokens (for example, an onboarding stepper pattern built out of standard buttons, text, and containers). Recipes aren't required to use Sanity UI, but it dramatically simplifies the following steps of the process.
|
|
38
|
+
|
|
39
|
+
The designer creates the recipe to solve their immediate feature need and adds it to a shared recipe library.
|
|
40
|
+
|
|
41
|
+
The more the recipe uses existing design system building blocks, the more baseline requirements like accessibility are automatically sorted out.
|
|
42
|
+
|
|
43
|
+
People can stop at Step 1. Stopping at Step 1 carries no penalty. Teams remain unblocked and the feature team owns future maintenance.
|
|
44
|
+
- title: 'Step 2: Propose a contribution'
|
|
45
|
+
description: |-
|
|
46
|
+
The recipe creator can propose graduating it into the core system. They do this if they believe it would be valuable to the rest of the company.
|
|
47
|
+
|
|
48
|
+
Bring the recipe to a "triage" sync. This could be as short as 15 minutes, depending on the size/complexity of the recipe.
|
|
49
|
+
|
|
50
|
+
The design system team and the feature designer review the work together. They can review the idea quickly with a developer to confirm it's technically sound.
|
|
51
|
+
|
|
52
|
+
The team decides if the recipe should graduate to a core system pattern. If it doesn't, the creator still has a perfectly usable recipe for their feature.
|
|
53
|
+
- title: 'Step 3: Contribute'
|
|
54
|
+
description: |-
|
|
55
|
+
The graduation process begins if everyone agrees that the recipe should be absorbed into the central design system. The contributing team and the design system team collaborate to:
|
|
56
|
+
|
|
57
|
+
- Agree on what needs to change from the initial recipe to make it universally applicable.
|
|
58
|
+
- Define a spec for engineering development.
|
|
59
|
+
- Write usage documentation. The person best equipped to write the first draft is usually the person who made it.
|
|
60
|
+
|
|
61
|
+
**Assign owners to take on:**
|
|
62
|
+
- Changes of the initial recipe
|
|
63
|
+
- Spec definition
|
|
64
|
+
- Documentation
|
|
65
|
+
- Component development
|
|
66
|
+
|
|
67
|
+
And that's it.
|
|
68
|
+
- kind: section
|
|
69
|
+
for: all
|
|
70
|
+
freeform:
|
|
71
|
+
- title: Overview
|
|
72
|
+
body: No approval step is required to ship a recipe. Designers and developers make recipes for whatever they need, without waiting for sign-off or policing. Even if a recipe never officially graduates to the core design system, the contributing designer still gets something usable out of the process.
|
|
73
|
+
- kind: section
|
|
74
|
+
for: agent
|
|
75
|
+
freeform:
|
|
76
|
+
- title: Intent
|
|
77
|
+
body: Use this guide to understand how a designer moves a recipe (a composition of existing components/tokens) toward becoming a core design system pattern, and to know that stopping at any step is a valid, penalty-free outcome.
|