@fusion.dev/helix-docs 0.236.0 → 0.237.0
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/content/browser-support.mdx +61 -11
- package/content/charting.mdx +15 -0
- package/content/color-modes.mdx +1 -1
- package/content/color.mdx +102 -14
- package/content/elevation-and-material.mdx +31 -15
- package/content/iconography.mdx +21 -12
- package/content/intent-reference.mdx +1 -1
- package/content/localization.mdx +2 -2
- package/content/metrics.mdx +264 -264
- package/content/motion.mdx +27 -11
- package/content/overlays.mdx +38 -0
- package/content/recipes.mdx +2 -0
- package/content/shape-and-borders.mdx +1 -0
- package/content/size-and-density.mdx +90 -4
- package/content/space-and-size.mdx +11 -3
- package/content/spatial-charts.mdx +11 -3
- package/content/surfaces-and-separation.mdx +53 -4
- package/content/theming.mdx +56 -10
- package/content/tokens.mdx +22 -13
- package/content/typography.mdx +88 -6
- package/content/visual-axes.mdx +1 -1
- package/dist/sources.generated.js +898 -375
- package/package.json +12 -12
package/content/motion.mdx
CHANGED
|
@@ -16,6 +16,9 @@ title: Motion
|
|
|
16
16
|
| `--helix-duration-fast` | `120ms` |
|
|
17
17
|
| `--helix-duration-normal` | `200ms` |
|
|
18
18
|
| `--helix-duration-slow` | `320ms` |
|
|
19
|
+
| `--helix-duration-turn` | `0.8s` |
|
|
20
|
+
| `--helix-duration-crawl` | `4s` |
|
|
21
|
+
| `--helix-duration-fade` | `120ms` |
|
|
19
22
|
|
|
20
23
|
[//]: # (/tokens)
|
|
21
24
|
|
|
@@ -27,17 +30,26 @@ title: Motion
|
|
|
27
30
|
| `--helix-easing-emphasized` | `cubic-bezier(0.3, 0, 0, 1.2)` |
|
|
28
31
|
| `--helix-easing-decelerate` | `cubic-bezier(0, 0, 0, 1)` |
|
|
29
32
|
| `--helix-easing-accelerate` | `cubic-bezier(0.3, 0, 1, 1)` |
|
|
33
|
+
| `--helix-easing-cycle` | `cubic-bezier(0.42, 0, 0.58, 1)` |
|
|
30
34
|
| `--helix-easing-spring` | `linear(0, 0.006, 0.025, 0.101, 0.539, 0.826, 0.976, 1.037, 1.043, 1.026, 1.006, 0.997, 1)` |
|
|
31
35
|
|
|
32
36
|
[//]: # (/tokens)
|
|
33
37
|
|
|
34
|
-
Helix has
|
|
35
|
-
|
|
38
|
+
Helix has seven durations and six curves. `instant`, `fast`, `normal`, and
|
|
39
|
+
`slow` time a change that answers a hand. `fade` is the fade a panel keeps
|
|
40
|
+
while motion is reduced. `turn` is one revolution of a spinner, and `crawl` is
|
|
41
|
+
the same revolution while motion is reduced, so a busy ring still turns
|
|
42
|
+
slowly.
|
|
43
|
+
|
|
44
|
+
Use each curve for one kind of movement:
|
|
36
45
|
|
|
37
46
|
- `standard` for most movement
|
|
38
|
-
- `decelerate` for something arriving
|
|
47
|
+
- `decelerate` for something arriving, such as a Dialog, a Drawer, or a Toast
|
|
39
48
|
- `accelerate` for something leaving
|
|
40
|
-
- `
|
|
49
|
+
- `cycle` for a loop that repeats, such as a pulse or a loading sweep
|
|
50
|
+
- `emphasized` for a floating panel opening from its trigger, such as a
|
|
51
|
+
Popover or a Menu, and for a marker that travels to a new place, such as the
|
|
52
|
+
indicator under the selected tab
|
|
41
53
|
- `spring` for the few places where overshoot looks responsive and does not
|
|
42
54
|
look like a bug
|
|
43
55
|
|
|
@@ -55,11 +67,12 @@ inside any component.**
|
|
|
55
67
|
```
|
|
56
68
|
|
|
57
69
|
The `*` selector does not cross a shadow boundary. The rule applies to your
|
|
58
|
-
prose, your layout, and the base layer's own recipes. It does not apply to
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
prose, your layout, and the base layer's own recipes. It does not apply to any
|
|
71
|
+
component that draws inside a shadow root, which is almost every Helix
|
|
72
|
+
component. A custom property does cross that boundary, so under the setting
|
|
73
|
+
Helix takes its duration tokens down to almost nothing, and every transition
|
|
74
|
+
written with them stops. A component with an
|
|
75
|
+
animation of its own handles `prefers-reduced-motion` in its stylesheet.
|
|
63
76
|
|
|
64
77
|
The same applies to your own components. If you write a component with a shadow
|
|
65
78
|
root, the global rule does not cover it. This comes from how `*` works in CSS,
|
|
@@ -79,8 +92,11 @@ ship without noticing.
|
|
|
79
92
|
|
|
80
93
|
Some transitions show a relationship, such as a panel that slides out of the
|
|
81
94
|
control that opened it. Others are decorative, such as a floating effect. With
|
|
82
|
-
reduced motion, Helix removes decorative movement. It
|
|
83
|
-
|
|
95
|
+
reduced motion, Helix removes decorative movement. It sets `fast`, `normal`,
|
|
96
|
+
and `slow` to 0.01ms, so a panel appears in its final place at once. The
|
|
97
|
+
transition still runs that long, so `transitionend` still fires. A Tooltip, a
|
|
98
|
+
Toast, and a panel that opens from a field or a Menu still fade in and out over
|
|
99
|
+
`fade`, 120ms, with no movement.
|
|
84
100
|
|
|
85
101
|
Anything that moves continuously without input stops completely:
|
|
86
102
|
|
package/content/overlays.mdx
CHANGED
|
@@ -134,6 +134,44 @@ The pointer can move onto a tooltip's bubble and the bubble stays, so a reader
|
|
|
134
134
|
can read it under a magnifier. Set `hoverable="false"` to hide it once the
|
|
135
135
|
pointer reaches it.
|
|
136
136
|
|
|
137
|
+
## Order a dialog's actions
|
|
138
|
+
|
|
139
|
+
Put a dialog's actions in its `footer` slot. The action that dismisses the
|
|
140
|
+
dialog, such as Cancel, Close, Keep, or Not now, comes first. The primary action
|
|
141
|
+
comes last, at the trailing edge. `Dialog` aligns its footer to the end of the
|
|
142
|
+
line. The same order applies to an alert dialog and to a `Drawer`.
|
|
143
|
+
|
|
144
|
+
**Write the actions in the order they are drawn.** A screen reader reads them
|
|
145
|
+
in source order, and `Tab` moves through them in source order, so the markup
|
|
146
|
+
has to match the screen. Do not reorder them with `row-reverse` or `order`.
|
|
147
|
+
When the actions stack at a narrow width, keep the same order, so the primary
|
|
148
|
+
action is at the bottom, nearest your thumb.
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<helix-button-group
|
|
152
|
+
label="Dialog actions"
|
|
153
|
+
layout="spaced"
|
|
154
|
+
slot="footer"
|
|
155
|
+
>
|
|
156
|
+
<helix-button
|
|
157
|
+
autofocus
|
|
158
|
+
command="--close"
|
|
159
|
+
commandfor="confirm"
|
|
160
|
+
>Cancel</helix-button>
|
|
161
|
+
<helix-button
|
|
162
|
+
command="--close"
|
|
163
|
+
commandfor="confirm"
|
|
164
|
+
emphasis="solid"
|
|
165
|
+
tone="danger"
|
|
166
|
+
>Delete project</helix-button>
|
|
167
|
+
</helix-button-group>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**In a confirmation before a destructive action**, such as a deletion, focus
|
|
171
|
+
starts on the action that destroys nothing. Put `autofocus` on that action, as
|
|
172
|
+
the Cancel button above carries it. Without it, opening the dialog moves
|
|
173
|
+
focus to the dialog itself, and the first `Tab` reaches the first control.
|
|
174
|
+
|
|
137
175
|
## Keep an overlay open
|
|
138
176
|
|
|
139
177
|
An overlay sends `helix-before-close` before it closes. Cancel the event to keep
|
package/content/recipes.mdx
CHANGED
|
@@ -133,6 +133,8 @@ In prose:
|
|
|
133
133
|
- Headings use the type scale.
|
|
134
134
|
- Paragraphs use the measure and leading.
|
|
135
135
|
- Lists, links, and inline code follow the same styles.
|
|
136
|
+
- `data-prose="reading"` sets a document at 18px for reading, with more room
|
|
137
|
+
between blocks.
|
|
136
138
|
|
|
137
139
|
See [Typography](./typography).
|
|
138
140
|
|
|
@@ -13,6 +13,7 @@ title: Shape and borders
|
|
|
13
13
|
| Token | Value |
|
|
14
14
|
| --- | --- |
|
|
15
15
|
| `--helix-radii-none` | `0` |
|
|
16
|
+
| `--helix-radii-inset` | `max(min(calc(var(--helix-seed-radii, 0.5rem) * 0.25), 2px), calc(var(--helix-seed-radii, 0.5rem) * 0.5 - var(--helix-border-thin) - var(--helix-space-2xs)))` |
|
|
16
17
|
| `--helix-radii-sm` | `calc(var(--helix-seed-radii, 0.5rem) * 0.5)` |
|
|
17
18
|
| `--helix-radii-md` | `var(--helix-seed-radii, 0.5rem)` |
|
|
18
19
|
| `--helix-radii-lg` | `calc(var(--helix-seed-radii, 0.5rem) * 1.5)` |
|
|
@@ -31,6 +31,19 @@ Size does three jobs:
|
|
|
31
31
|
a list and at 96 on a profile are two different pictures. That is why
|
|
32
32
|
`Avatar`, `Loader`, and `Orb` keep a `size`.
|
|
33
33
|
|
|
34
|
+
## The steps
|
|
35
|
+
|
|
36
|
+
| Density | Control height | Tight row | Control text |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `sm` | 32px | 26px | 12px |
|
|
39
|
+
| `md` | 40px | 32px | 13px |
|
|
40
|
+
| `lg` | 48px | 38px | 14px |
|
|
41
|
+
|
|
42
|
+
A tight row is `--helix-size-control-tight`, the height of a row in a Menu, a
|
|
43
|
+
Select, or a Combobox. A Table and a List row take the control height. The
|
|
44
|
+
control text in the table is for a mouse or a trackpad. On a touch screen it is
|
|
45
|
+
a step larger, as [On a touch screen](#on-a-touch-screen) describes.
|
|
46
|
+
|
|
34
47
|
## Can two controls differ in height?
|
|
35
48
|
|
|
36
49
|
Ask whether two controls placed together can ever differ in height:
|
|
@@ -46,8 +59,14 @@ A size on each control describes the **region**, one element at a time, and
|
|
|
46
59
|
that is how a row ends up with one control at the wrong height. When you set the
|
|
47
60
|
density once on the region, you cannot write a row of mismatched heights.
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
Three regions take a `size` by the same test:
|
|
63
|
+
|
|
64
|
+
- `Toolbar` sets the density of every control in it. Unset, its controls are
|
|
65
|
+
`sm`, since a toolbar is dense.
|
|
66
|
+
- `Button Group` sets the density of every button in it. Unset, its buttons
|
|
67
|
+
take the density of the region around the group.
|
|
68
|
+
- `Dialog` sets its own width. Two dialogs never sit together. One is on screen
|
|
69
|
+
at a time, in the top layer, so the dialog is itself the region.
|
|
51
70
|
|
|
52
71
|
This also helps when you or a model generate code. There is no size to get wrong
|
|
53
72
|
on each element, and you make one choice for each region.
|
|
@@ -58,10 +77,10 @@ Put `data-density` on any container, with a value of `sm`, `md`, or `lg`. `md`
|
|
|
58
77
|
is the default, so you never write it.
|
|
59
78
|
|
|
60
79
|
```html
|
|
61
|
-
<helix-toolbar>
|
|
80
|
+
<helix-toolbar label="Build">
|
|
62
81
|
<!-- Nothing here needs a size. The toolbar is already dense. -->
|
|
63
82
|
<helix-button>Run</helix-button>
|
|
64
|
-
<helix-select label="Target"><!-- … --></helix-select>
|
|
83
|
+
<helix-select aria-label="Target"><!-- … --></helix-select>
|
|
65
84
|
</helix-toolbar>
|
|
66
85
|
```
|
|
67
86
|
|
|
@@ -73,15 +92,72 @@ Density works through these custom properties:
|
|
|
73
92
|
|
|
74
93
|
- `--helix-size-control`
|
|
75
94
|
- `--helix-size-checkbox`
|
|
95
|
+
- `--helix-size-icon`
|
|
76
96
|
- `--helix-size-switch`
|
|
77
97
|
- `--helix-size-tag`
|
|
78
98
|
|
|
99
|
+
It also sets the control text, the field text, and their insets.
|
|
100
|
+
|
|
79
101
|
Because of this, density adds no API to any component, and it passes through
|
|
80
102
|
every shadow boundary.
|
|
81
103
|
|
|
82
104
|
The `-sm`, `-md`, and `-lg` tokens are the scale, and they never change. The
|
|
83
105
|
unsuffixed tokens hold the current step, and `data-density` changes them.
|
|
84
106
|
|
|
107
|
+
## A step either side
|
|
108
|
+
|
|
109
|
+
`-tight` and `-loose` are a step either side of the current one: 0.8 and 1.2
|
|
110
|
+
times the unsuffixed token, rounded to a whole pixel. An icon rounds to an even
|
|
111
|
+
pixel, so its steps land between 0.75 and 0.83 times the icon and between 1.17
|
|
112
|
+
and 1.25 times it. They move with the region's density. Three sizes have the
|
|
113
|
+
pair:
|
|
114
|
+
|
|
115
|
+
- `--helix-size-control-tight` and `--helix-size-control-loose`
|
|
116
|
+
- `--helix-size-icon-tight` and `--helix-size-icon-loose`
|
|
117
|
+
- `--helix-size-checkbox-tight` and `--helix-size-checkbox-loose`
|
|
118
|
+
|
|
119
|
+
| Density | Control | Tight | Loose | Icon | Tight | Loose |
|
|
120
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
121
|
+
| `sm` | 32px | 26px | 38px | 16px | 12px | 20px |
|
|
122
|
+
| `md` | 40px | 32px | 48px | 20px | 16px | 24px |
|
|
123
|
+
| `lg` | 48px | 38px | 58px | 24px | 20px | 28px |
|
|
124
|
+
|
|
125
|
+
Use a `-tight` or `-loose` step for something that is meant to differ from its
|
|
126
|
+
neighbors, such as a row in a floating panel or a caret inside a trigger. Use
|
|
127
|
+
`-sm`, `-md`, or `-lg` for a size that does not follow density.
|
|
128
|
+
|
|
129
|
+
Two sizes do not follow a region's density. Like every size, they still scale
|
|
130
|
+
with `--helix-seed-density`:
|
|
131
|
+
|
|
132
|
+
- `--helix-size-button` is 200px, a standard width for a button. Set it as a
|
|
133
|
+
button's `--button-inline-size`.
|
|
134
|
+
- `--helix-size-badge` is 16px, the size of a Badge's mark. A badge is pinned
|
|
135
|
+
to something else, such as an avatar, so it does not take a control's size.
|
|
136
|
+
|
|
137
|
+
## On a touch screen
|
|
138
|
+
|
|
139
|
+
Where the primary pointer is coarse, such as on a phone, these sizes change:
|
|
140
|
+
|
|
141
|
+
- `--helix-size-target` is 44px. Under a mouse it is 24px. A control's press
|
|
142
|
+
reaches that size through a transparent box around it, so nothing drawn moves.
|
|
143
|
+
- Control text is a step larger, up to 14px: 13px at `sm`, and 14px at `md` and
|
|
144
|
+
`lg`. A Button at `md` goes from 13px to 14px.
|
|
145
|
+
- A field's text is at least 16px, so a field at `md` goes from 14px to 16px.
|
|
146
|
+
iOS Safari zooms the page into a field whose text is smaller. See
|
|
147
|
+
[Typography](./typography).
|
|
148
|
+
- A row in a Menu, a Select, or a Combobox is at least `--helix-size-target`
|
|
149
|
+
tall, 44px at every density. Rows sit against each other, so the row itself
|
|
150
|
+
grows to the target.
|
|
151
|
+
- A List row and a Tree row are 48px apart at every density, the pitch a List
|
|
152
|
+
has at `lg`. Tree rows keep the List's pitch.
|
|
153
|
+
- An Accordion's summary row is at least 44px tall, so it is 44px at `sm` and
|
|
154
|
+
`md` and keeps its 48px at `lg`.
|
|
155
|
+
- A Table row does not grow to the target. It keeps its density's height, and
|
|
156
|
+
only its text takes the larger touch size.
|
|
157
|
+
- A link in a Navigation bar is 44px tall.
|
|
158
|
+
|
|
159
|
+
A control keeps the height of its density step.
|
|
160
|
+
|
|
85
161
|
## Exceptions
|
|
86
162
|
|
|
87
163
|
`data-link-size` still exists. A text link has no control height. Its size comes
|
|
@@ -92,3 +168,13 @@ one step above `--helix-size-checkbox` at every density, because a switch is a
|
|
|
92
168
|
track with a thumb inside it and a checkbox is a box with a mark in it. The
|
|
93
169
|
component sets this once, and it applies to every instance. You do not set a
|
|
94
170
|
height on each instance.
|
|
171
|
+
|
|
172
|
+
## Narrowest supported width
|
|
173
|
+
|
|
174
|
+
Helix supports a column down to 280px. Every family's examples fit at that width
|
|
175
|
+
with no sideways scroll. Below it, a control may overflow or a figure may wrap.
|
|
176
|
+
|
|
177
|
+
A `Stat` figure that does not fit its column steps down the type scale twice,
|
|
178
|
+
from `3xl` to `2xl` to `xl`. If it still does not fit, it breaks after a group
|
|
179
|
+
separator, such as the comma in "1,284,567". Give each `Stat` a column of about
|
|
180
|
+
6rem or wider, so its digits stay on one line.
|
|
@@ -36,9 +36,17 @@ arithmetic, such as `space-4` being twice `space-2`. That stops being true as
|
|
|
36
36
|
soon as the scale is tuned, and it leads to a `space-4.5` the first time
|
|
37
37
|
something does not fit.
|
|
38
38
|
|
|
39
|
-
`--helix-space-
|
|
40
|
-
control uses, and
|
|
41
|
-
|
|
39
|
+
`--helix-space-field` and `--helix-space-control` are of a different kind. Each
|
|
40
|
+
is the inset a control uses, and each follows the region's density, so the table
|
|
41
|
+
above shows its `md` value. They are not steps on the scale. A field's text
|
|
42
|
+
starts closer to its edge than a button's label does:
|
|
43
|
+
|
|
44
|
+
| Token | `sm` | `md` | `lg` |
|
|
45
|
+
| --- | --- | --- | --- |
|
|
46
|
+
| `--helix-space-field` | 8px | 12px | 16px |
|
|
47
|
+
| `--helix-space-control` | 12px | 16px | 24px |
|
|
48
|
+
|
|
49
|
+
See [Size and density](./size-and-density).
|
|
42
50
|
|
|
43
51
|
Use the space tokens for gap, padding, and margin:
|
|
44
52
|
|
|
@@ -182,8 +182,7 @@ three.js draws both as well.
|
|
|
182
182
|
|
|
183
183
|
`no-box` draws `Spatial Bar Chart`, `Spatial Ribbon Chart`, `Spatial Scatter
|
|
184
184
|
Chart`, `Spatial Surface Chart`, or `Spatial Treemap` with no box, grid,
|
|
185
|
-
numbers, or names,
|
|
186
|
-
a picture does:
|
|
185
|
+
numbers, or names, so the readings stand on the page as a picture does:
|
|
187
186
|
|
|
188
187
|
```html
|
|
189
188
|
<helix-spatial-surface-chart
|
|
@@ -195,10 +194,16 @@ a picture does:
|
|
|
195
194
|
```
|
|
196
195
|
|
|
197
196
|
The table, the summary, the tooltip, and the keys still carry every value, and
|
|
198
|
-
three.js draws no box either. `Spatial Heatmap` has no box, and its `start` and
|
|
197
|
+
three.js draws no box under `no-box` either. `Spatial Heatmap` has no box, and its `start` and
|
|
199
198
|
`end` slots are the only names it draws, so leave them empty for the same
|
|
200
199
|
picture.
|
|
201
200
|
|
|
201
|
+
## Give a chart a ground
|
|
202
|
+
|
|
203
|
+
A spatial chart draws nothing behind its plot, as a flat chart does. Set
|
|
204
|
+
`separation="filled"` on any of the six to draw a ground of
|
|
205
|
+
`--helix-color-surface-filled`, the fill every `filled` surface takes.
|
|
206
|
+
|
|
202
207
|
## When a 3D bar or ribbon chart fits
|
|
203
208
|
|
|
204
209
|
A flat `Bar Chart` is read more exactly. Studies of 3D bars measure readers
|
|
@@ -290,6 +295,9 @@ Each chart takes its colors from your theme, and these hooks change them:
|
|
|
290
295
|
the page. On `Spatial Surface Chart` it is a wireframe.
|
|
291
296
|
- `emphasis="subtle"` draws a faint wash under the same edge, which shows what
|
|
292
297
|
stands behind a prism, a point, or a fold of the surface.
|
|
298
|
+
- `emphasis="muted"` on `Spatial Bar Chart` draws every bar in the neutral
|
|
299
|
+
ink, so a bar whose cell names a tone is the one in color, and it glows in
|
|
300
|
+
that tone.
|
|
293
301
|
- `material="glass"` lets the most of what is behind each mark through, and
|
|
294
302
|
`material="frosted"` less.
|
|
295
303
|
|
|
@@ -10,8 +10,8 @@ title: Surfaces and separation
|
|
|
10
10
|
edge, a lift, and space.** A design language leads with one of them. Helix leads
|
|
11
11
|
with an edge for surfaces on the page and a lift for surfaces above it. A card
|
|
12
12
|
has a hairline border and no shadow. A menu has a shadow and a hairline border,
|
|
13
|
-
because a shadow cannot show on a
|
|
14
|
-
for each place a surface can sit.
|
|
13
|
+
because a shadow cannot show on a black page. The surface ladder below sets the
|
|
14
|
+
ground color for each place a surface can sit.
|
|
15
15
|
|
|
16
16
|
## The four ways to separate a surface
|
|
17
17
|
|
|
@@ -35,13 +35,20 @@ Helix sets the choice with two pairs of policy tokens:
|
|
|
35
35
|
| `--helix-border-surface` | `var(--helix-border-thin)` | The border of a surface in the page flow. Set it to zero to separate surfaces with shadows. |
|
|
36
36
|
| `--helix-shadow-surface` | `var(--helix-shadow-none)` | The shadow of a surface in the page flow. Set it to none to separate surfaces with borders. |
|
|
37
37
|
| `--helix-border-floating` | `var(--helix-border-thin)` | The border of a surface that floats over content. Set it to zero to separate floating surfaces by their shadow alone. |
|
|
38
|
-
| `--helix-shadow-floating` | `var(--helix-shadow-lg)` | The shadow of a surface that floats over content. |
|
|
38
|
+
| `--helix-shadow-floating` | `var(--helix-shadow-sm), var(--helix-shadow-lg)` | The shadow of a surface that floats over content. |
|
|
39
39
|
|
|
40
40
|
[//]: # (/tokens)
|
|
41
41
|
|
|
42
42
|
A floating surface draws a hairline edge and a shadow by default. A shadow is
|
|
43
43
|
ink darker than the ground it falls on, so over a dark page it does not show,
|
|
44
|
-
and the edge keeps a menu or a popover apart from what it opened over.
|
|
44
|
+
and the edge keeps a menu or a popover apart from what it opened over. The edge
|
|
45
|
+
is `--helix-color-border-floating`: `border` in light mode, and 10% of white in
|
|
46
|
+
dark mode.
|
|
47
|
+
|
|
48
|
+
A Tooltip draws neither. Its fill is `surface-inverse`, the mode's opposite,
|
|
49
|
+
which sets it apart from any ground it opens over. A glass or frosted Tooltip
|
|
50
|
+
lets the page show through, so it takes the hairline edge every glass surface
|
|
51
|
+
draws, `--helix-material-border`.
|
|
45
52
|
|
|
46
53
|
To make every component shadow-first, set the border pair to zero and give the
|
|
47
54
|
shadow pair a value. Reverse them to go border-first. Every Helix surface reads
|
|
@@ -71,6 +78,40 @@ step darker to be seen. A lit row is different: it takes `hover`, a wash measure
|
|
|
71
78
|
against whatever it sits on. `overlay` works the other way. Its edge and its shadow separate it, so on
|
|
72
79
|
a white page it is white.
|
|
73
80
|
|
|
81
|
+
**In dark mode, a surface over a raised one steps up from it.** A shadow does
|
|
82
|
+
not show on a black page, so `overlay` stands one rung above `raised`: #1e1e1e
|
|
83
|
+
over #181818, 1.07:1. An elevated Card fills the `overlay` rung in dark, so it
|
|
84
|
+
reads above a filled card: #1e1e1e against #161616 on the page. Inside a Dialog,
|
|
85
|
+
a Drawer, a Popover, or an elevated Card, the rungs are washes of `foreground`
|
|
86
|
+
over the panel: `overlay` 12%, `raised` 9%, `surface` 3%, and `border` 12%.
|
|
87
|
+
Inside a default Card, `overlay` is 12% and the filled wash 6%. An elevated
|
|
88
|
+
Card inside any of these reads above a filled one. A Menu opened from an
|
|
89
|
+
elevated Card stands a step above the card, and a Dialog opened over another
|
|
90
|
+
Dialog stands 8% above it. Light mode keeps its rungs, where a shadow sets an
|
|
91
|
+
overlay apart. An elevated Card inside another card fills the `overlay` rung in
|
|
92
|
+
light too, white on the card's #fafafa.
|
|
93
|
+
|
|
94
|
+
**A sunken region restates the border for what it holds.** On
|
|
95
|
+
`surface-sunken`, the page's border measures 1.03:1 in light, so an outlined
|
|
96
|
+
Card, a Table rule, a Divider, or a field placed there has no visible edge. Mark
|
|
97
|
+
the region with `data-surface="sunken"`. It draws the sunken ground and mixes the
|
|
98
|
+
border from `foreground` into it, so an edge stands as far off the well as it
|
|
99
|
+
does off the page: 1.23:1 in light and 1.29:1 in dark.
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<section data-surface="sunken">
|
|
103
|
+
<helix-card separation="outlined">…</helix-card>
|
|
104
|
+
</section>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**In dark mode, a surface inside a sunken region steps up a rung.** The card
|
|
108
|
+
rung, #0c0c0c, is darker than the #121212 well, so a Card there would read as a
|
|
109
|
+
hole. Inside the region, `surface` takes the `raised` rung, #181818, and the
|
|
110
|
+
rungs above it step with it: `raised` is #272727 and `overlay` is #2d2d2d. An
|
|
111
|
+
elevated Card still stands above a default one, and a menu opened inside stands
|
|
112
|
+
above both. Light mode keeps its rungs, where a card is already lighter than
|
|
113
|
+
the well. Canvas's board is a sunken region too.
|
|
114
|
+
|
|
74
115
|
## Using the page color inside a component
|
|
75
116
|
|
|
76
117
|
**`--helix-color-background` is the page color. Do not use it inside a
|
|
@@ -97,6 +138,14 @@ Put the color behind a hook that defaults to the page color. When the component
|
|
|
97
138
|
sits on another surface, the hook can be set to match. Helix requires this of
|
|
98
139
|
its own components, and the same applies to anything you build with it.
|
|
99
140
|
|
|
141
|
+
**A tone faded toward the page needs no hook.** An outlined chart mark, a
|
|
142
|
+
Callout's hairline, or a Badge's tint mixes its tone toward
|
|
143
|
+
`--helix-color-background` to make a quieter color of the same tone. That color
|
|
144
|
+
is a mark, and it never has to match the ground under it, so it reads as the
|
|
145
|
+
tone on a card as it does on the page. A fill that has to disappear into its
|
|
146
|
+
ground, such as a marker that hides a rail or a ring around a point, is the page
|
|
147
|
+
color itself, and it takes a hook.
|
|
148
|
+
|
|
100
149
|
## Contrast
|
|
101
150
|
|
|
102
151
|
The theme engine measures each ink against the ground it is actually painted
|
package/content/theming.mdx
CHANGED
|
@@ -4,7 +4,7 @@ section: Theming
|
|
|
4
4
|
title: Deriving a theme
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Deriving a theme
|
|
8
8
|
|
|
9
9
|
Helix computes your color tokens from a few inputs, such as your brand color.
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ the page, with the page's own color for its label. The neutral ramp supplies
|
|
|
16
16
|
both, so a gray with a tint gives a tinted ink. Set a brand color to replace the
|
|
17
17
|
ink, as a seed in CSS or as `brand` in the theme engine.
|
|
18
18
|
|
|
19
|
-
Before ink, the default was a blue. To
|
|
19
|
+
Before ink, the default was a blue. To draw that blue, set it as your seed:
|
|
20
20
|
|
|
21
21
|
```css
|
|
22
22
|
:root {
|
|
@@ -24,6 +24,12 @@ Before ink, the default was a blue. To keep it, set it as your seed:
|
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
The primary color is held to a floor, described under
|
|
28
|
+
[Two ways to theme](#two-ways-to-theme), so in light mode this seed draws at
|
|
29
|
+
L 0.5, a little darker than the 0.539 the old default drew. In dark mode it is
|
|
30
|
+
set at L 0.68. That color is outside sRGB, so a screen draws it as `#4495ff`, at
|
|
31
|
+
L 0.672.
|
|
32
|
+
|
|
27
33
|
When a design system ships two hundred fixed color values, you theme it by
|
|
28
34
|
changing them one at a time. A change to one value can break the contrast of a
|
|
29
35
|
component elsewhere, and nothing tells you.
|
|
@@ -56,13 +62,52 @@ on the element where the property is *declared*, so the ramp has already
|
|
|
56
62
|
resolved at the root. The stylesheet declares the ramp again on each
|
|
57
63
|
`[data-helix-theme]` element, so the ramp there reads the seeds you set on it.
|
|
58
64
|
|
|
59
|
-
Tuned
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
The
|
|
65
|
-
|
|
65
|
+
Tuned holds primary text and fills to a floor for any seed. CSS has no contrast
|
|
66
|
+
function, so it cannot search for the least change that meets a target, but it
|
|
67
|
+
can hold a lightness. Measured across every hue, the limits below clear 4.5:1
|
|
68
|
+
for text on each surface.
|
|
69
|
+
|
|
70
|
+
- **Light mode.** The primary color is held at L 0.5 or less. A seed at 0.5 or
|
|
71
|
+
darker is drawn exactly. A lighter seed is darkened to 0.5, so a very light
|
|
72
|
+
brand draws a darker primary color than the one you set.
|
|
73
|
+
- **Dark mode.** The primary color is the seed lightened by 0.13, at least
|
|
74
|
+
0.68, and no lighter than 0.87 or the seed, whichever is lighter. A seed at
|
|
75
|
+
0.87 or lighter is drawn exactly: on a `#ffe600` seed, primary text is
|
|
76
|
+
`#ffe600` and measures 16.57:1 on the black page. A darker seed is drawn
|
|
77
|
+
lighter than the one you set.
|
|
78
|
+
- **A filled control in dark mode.** A seed at L 0.68 or darker fills at a
|
|
79
|
+
luminance between 0.115 and 0.135, with its hue and chroma kept. Lightness
|
|
80
|
+
alone is a different luminance in each hue, so a green filled at the same
|
|
81
|
+
lightness as a blue carried a white label at 4.43:1. At that luminance the
|
|
82
|
+
fill clears 3:1 against a card, and a white label clears 4.5:1 on it at rest,
|
|
83
|
+
under the pointer, and pressed, which step lighter. A lighter seed fills 0.05 darker than itself
|
|
84
|
+
and takes a black label.
|
|
85
|
+
|
|
86
|
+
The accent seed is held to the same limits.
|
|
87
|
+
|
|
88
|
+
The focus ring keeps the primary color's hue and chroma, and its lightness is
|
|
89
|
+
held at 0.6 or less in light mode and 0.65 or more in dark mode. The ring stays
|
|
90
|
+
visible on the page whichever seed you set. On a `#ffe600` seed, the ring
|
|
91
|
+
measures 5.89:1 on white.
|
|
92
|
+
|
|
93
|
+
A development build warns when primary text measures under 4.5:1 or a filled
|
|
94
|
+
control under 3:1 against the page, in light or dark mode. A seed alone cannot
|
|
95
|
+
cause this. An override of `--helix-color-primary`,
|
|
96
|
+
`--helix-color-primary-surface`, or the page color can. It also warns when the
|
|
97
|
+
primary color sits within 0.08 in OKLab of a status color, so a warning or a
|
|
98
|
+
success reads as the brand. A yellow, green, or red seed can cause this. Each
|
|
99
|
+
warning prints once.
|
|
100
|
+
|
|
101
|
+
The build checks the page when the first element renders, and again when one of
|
|
102
|
+
these changes:
|
|
103
|
+
|
|
104
|
+
- the seed
|
|
105
|
+
- a `style`, `class`, or `data-theme` attribute on the root or the body
|
|
106
|
+
- a stylesheet in the head, once it has loaded
|
|
107
|
+
- the system setting for light or dark mode
|
|
108
|
+
|
|
109
|
+
A page that sets its colors for one mode at a time on the root is checked in the
|
|
110
|
+
mode it shows. The other mode is checked once the page switches to it.
|
|
66
111
|
|
|
67
112
|
**Verified** uses the theme engine. It searches for each color that meets its
|
|
68
113
|
target, measures every pair, and returns the theme with any violations:
|
|
@@ -105,7 +150,8 @@ computes the values the engine does not, from the same seeds the engine used:
|
|
|
105
150
|
|
|
106
151
|
This keeps both ways of theming in agreement on the same page.
|
|
107
152
|
|
|
108
|
-
Use tuned to try a color. Use verified for the theme you ship
|
|
153
|
+
Use tuned to try a color. Use verified for the theme you ship, since it moves
|
|
154
|
+
each color the least distance that meets its target on every ground.
|
|
109
155
|
|
|
110
156
|
## Derive both modes
|
|
111
157
|
|
package/content/tokens.mdx
CHANGED
|
@@ -15,7 +15,7 @@ Helix has two layers of tokens. You use the second layer, the semantic tokens.
|
|
|
15
15
|
| Semantic | `--helix-color-primary` | Any code, including yours |
|
|
16
16
|
|
|
17
17
|
Each semantic token is named for its purpose. The name does not describe its
|
|
18
|
-
value. Every token belongs to exactly one of
|
|
18
|
+
value. Every token belongs to exactly one of seventeen categories:
|
|
19
19
|
|
|
20
20
|
- `color`
|
|
21
21
|
- `scrollbar`
|
|
@@ -29,6 +29,7 @@ value. Every token belongs to exactly one of sixteen categories:
|
|
|
29
29
|
- `border`
|
|
30
30
|
- `shadow`
|
|
31
31
|
- `material`
|
|
32
|
+
- `opacity`
|
|
32
33
|
- `duration`
|
|
33
34
|
- `easing`
|
|
34
35
|
- `size`
|
|
@@ -47,20 +48,28 @@ nothing is lighter than white, so a raised surface is *darker* than the page.
|
|
|
47
48
|
- **`background`**: the page.
|
|
48
49
|
- **`surface`**: a plane on the page, such as a card or a panel you own.
|
|
49
50
|
- **`surface-raised`**: something lifted that still *lies on* the page, such as
|
|
50
|
-
a
|
|
51
|
+
a card inside a card, or the header of a Code Block or a Terminal. The page
|
|
51
52
|
surrounds it on all sides, so its fill sets it apart. On a white page, that
|
|
52
53
|
fill is one step darker.
|
|
53
54
|
- **`surface-overlay`**: something *over* the page, such as a menu, a popover, a
|
|
54
|
-
dialog, or the thumb of a switch or a segmented control. Its
|
|
55
|
-
content it covers set it apart, so on a white page it is
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
dialog, or the thumb of a switch or a segmented control. Its edge, its
|
|
56
|
+
shadow, and the content it covers set it apart, so on a white page it is
|
|
57
|
+
white. In dark mode it is one rung above `surface-raised`.
|
|
58
|
+
- **`surface-sunken`**: a recessed fill, such as a progress track, a keyboard
|
|
59
|
+
key, or the groove of a segmented control.
|
|
60
|
+
|
|
61
|
+
Two fills are a step from whatever ground they sit on, so they read the same on
|
|
62
|
+
the page, a card, or a raised surface. `--helix-color-well` fills a field, such
|
|
63
|
+
as an input. `--helix-color-hover` lights a row under the pointer, such as an
|
|
64
|
+
option or a menu item.
|
|
65
|
+
|
|
66
|
+
**Use `raised` and `overlay` for different jobs.** In dark mode they are one
|
|
67
|
+
rung apart, #181818 and #1e1e1e, so either token can seem to do both jobs. In
|
|
68
|
+
light mode they need opposite fills. A Code Block's header must be darker than
|
|
69
|
+
a white page, and a thumb must be lighter than the groove it sits in. A menu is
|
|
70
|
+
white on a white page, set apart by its edge and its shadow. If a surface looks
|
|
71
|
+
almost right in dark mode and wrong in light mode, it usually uses the wrong one
|
|
72
|
+
of these two tokens.
|
|
64
73
|
|
|
65
74
|
## Per-component hooks
|
|
66
75
|
|
|
@@ -96,7 +105,7 @@ loses its styles.
|
|
|
96
105
|
Each token declares its light and dark values in one declaration:
|
|
97
106
|
|
|
98
107
|
```css
|
|
99
|
-
--helix-color-surface: light-dark(var(--_helix-neutral-50), var(--_helix-neutral-
|
|
108
|
+
--helix-color-surface: light-dark(var(--_helix-neutral-50), var(--_helix-neutral-925));
|
|
100
109
|
```
|
|
101
110
|
|
|
102
111
|
The `color-scheme` property alone decides which value applies. You set the
|