@codenhub/styles 0.0.3 → 0.1.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/LICENSE +201 -0
- package/NOTICE +52 -0
- package/README.md +60 -90
- package/dist/aesthetics/chunky-tile.css +1 -0
- package/dist/aesthetics/glass.css +1 -0
- package/dist/aesthetics/index.css +2 -0
- package/dist/aesthetics/neobrutalism.css +1 -0
- package/dist/aesthetics/pixel.css +1 -0
- package/dist/components.css +2 -2
- package/dist/index.css +2 -2
- package/dist/native.css +2 -0
- package/dist/theme.css +2 -2
- package/dist/tw/aesthetics/chunky-tile.css +107 -0
- package/dist/tw/aesthetics/glass.css +66 -0
- package/dist/tw/aesthetics/index.css +9 -0
- package/dist/tw/aesthetics/neobrutalism.css +63 -0
- package/dist/tw/aesthetics/pixel.css +88 -0
- package/dist/tw/box.css +185 -0
- package/dist/tw/components/button.css +88 -0
- package/dist/tw/components/feedback.css +163 -0
- package/dist/tw/components/form.css +601 -0
- package/dist/tw/components/index.css +18 -0
- package/dist/tw/components/loader.css +122 -0
- package/dist/tw/components/surface.css +98 -0
- package/dist/tw/components/tooltip.css +132 -0
- package/dist/tw/elevation.css +39 -0
- package/dist/tw/index.css +12 -0
- package/dist/tw/intent.css +189 -0
- package/dist/tw/native.css +203 -0
- package/dist/tw/presentation.css +77 -0
- package/dist/tw/reset.css +142 -0
- package/dist/tw/theme.css +218 -0
- package/dist/tw/typography.css +34 -0
- package/dist/tw/utilities/content.css +349 -0
- package/dist/tw/utilities/index.css +6 -0
- package/dist/tw/utilities/layout.css +107 -0
- package/docs/accessibility.md +43 -14
- package/docs/concepts.md +94 -0
- package/docs/index.md +62 -73
- package/docs/integrating/astro.md +29 -0
- package/docs/integrating/index.md +32 -0
- package/docs/integrating/nextjs.md +44 -0
- package/docs/integrating/svelte.md +37 -0
- package/docs/integrating/tailwind.md +40 -0
- package/docs/integrating/vue.md +25 -0
- package/docs/setup.md +116 -0
- package/docs/usage/aesthetics.md +197 -0
- package/docs/usage/buttons.md +74 -0
- package/docs/usage/composing.md +218 -0
- package/docs/usage/content-and-layout.md +200 -0
- package/docs/usage/customizing.md +213 -0
- package/docs/usage/feedback.md +117 -0
- package/docs/usage/forms.md +177 -0
- package/docs/usage/index.md +32 -0
- package/docs/usage/theming.md +210 -0
- package/docs/usage/tooltips.md +45 -0
- package/llms-full.txt +2122 -0
- package/llms.txt +26 -0
- package/package.json +96 -32
- package/docs/classes.md +0 -198
- package/docs/roadmap.md +0 -34
- package/docs/tests.md +0 -128
- package/docs/tokens.md +0 -101
- package/src/components/button.css +0 -155
- package/src/components/feedback.css +0 -214
- package/src/components/form.css +0 -296
- package/src/components/index.css +0 -9
- package/src/components/loader.css +0 -56
- package/src/components/surface.css +0 -6
- package/src/components/tooltip.css +0 -60
- package/src/index.css +0 -7
- package/src/overrides.css +0 -76
- package/src/theme.css +0 -136
- package/src/typography.css +0 -30
- package/src/utilities.css +0 -40
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Content and layout
|
|
3
|
+
description: Layout helpers, content chips and tables, surfaces, and typography utilities.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Content and layout
|
|
7
|
+
|
|
8
|
+
## Layout
|
|
9
|
+
|
|
10
|
+
Layout helpers use the shared `--layout-gap` token. `.tight` sets it to
|
|
11
|
+
`0.5rem` and `.loose` sets it to `1.5rem` within a view, stack, cluster, or
|
|
12
|
+
auto-grid.
|
|
13
|
+
|
|
14
|
+
- `.view` is a flex container; `.vertical` and `.horizontal` set its
|
|
15
|
+
direction, and horizontal views wrap with centered cross-axis alignment.
|
|
16
|
+
- `.stack` is a vertical flex stack.
|
|
17
|
+
- `.cluster` is a wrapping horizontal flex row; `.between` adds
|
|
18
|
+
`space-between` alignment.
|
|
19
|
+
- `.auto-grid` is a responsive auto-fit grid using `--layout-grid-min`.
|
|
20
|
+
- `.tight` and `.loose` set the shared gap to `0.5rem` or `1.5rem` on views,
|
|
21
|
+
stacks, clusters, and auto-grids.
|
|
22
|
+
- `.section` adds responsive block padding and an inline gutter.
|
|
23
|
+
- `.section-content` centers content at `--container-max`; `.narrow` and
|
|
24
|
+
`.wide` select the corresponding container tokens.
|
|
25
|
+
- `.divider` is horizontal; `.vertical` makes it self-stretch vertically. It
|
|
26
|
+
takes intent, but presentation classes do not affect it.
|
|
27
|
+
|
|
28
|
+
The removed `--layout-stack-gap` and `--layout-cluster-gap` tokens have no
|
|
29
|
+
compatibility aliases.
|
|
30
|
+
|
|
31
|
+
## Content
|
|
32
|
+
|
|
33
|
+
| Class | Purpose | Intent affects |
|
|
34
|
+
| --------------- | ---------------------------------------------------------------------------------------- | ---------------------- |
|
|
35
|
+
| `.table-wrap` | Full-width horizontal overflow wrapper for wide tables. | Nothing. |
|
|
36
|
+
| `.data-table` | Rounded nested table styling for captions, heads, footers, cells, and rows. | Head, border, hover. |
|
|
37
|
+
| `.ruled` | On `.data-table`. Draws a rule between body rows. | Rule color. |
|
|
38
|
+
| `.ruleless` | On `.data-table`. Draws no lines inside the table at all. | Nothing. |
|
|
39
|
+
| `.kbd` | Inline keyboard-input styling. | Surface, border, text. |
|
|
40
|
+
| `.quote` | Block quote styling; a nested `cite` is set upright and takes the quotation's own color. | Bar, surface, text. |
|
|
41
|
+
| `.quote-inline` | Inline quotation styling. | Nothing. |
|
|
42
|
+
| `.code` | Inline code formatting. | Surface. |
|
|
43
|
+
| `.pre` | Scrollable block code formatting with larger padding. | Surface. |
|
|
44
|
+
|
|
45
|
+
### Table rules
|
|
46
|
+
|
|
47
|
+
A table draws three kinds of line, and `.ruled` and `.ruleless` move all of
|
|
48
|
+
them together:
|
|
49
|
+
|
|
50
|
+
| Class | Head and foot boundaries | Rules between body rows |
|
|
51
|
+
| ----------- | ------------------------ | ----------------------- |
|
|
52
|
+
| `.ruleless` | No | No |
|
|
53
|
+
| _no class_ | Yes | No |
|
|
54
|
+
| `.ruled` | Yes | Yes |
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<table class="data-table">Head and foot boundaries only</table>
|
|
58
|
+
<table class="data-table ruled">Every row separated</table>
|
|
59
|
+
<table class="data-table ruleless">No lines inside the table at all</table>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The boundaries under a head and above a foot separate the parts of a table
|
|
63
|
+
from each other, so they are drawn by default where the row rules are not.
|
|
64
|
+
Rules between body rows used to arrive on their own, because the
|
|
65
|
+
component's published edge default is `edged` and the edge axis wrote the
|
|
66
|
+
rules along with the boundary — so whether you got them depended on a
|
|
67
|
+
registry default rather than on anything in your markup.
|
|
68
|
+
|
|
69
|
+
`--ui-rule` is the token behind both classes, so a container can set the
|
|
70
|
+
answer for a whole region without classing each table:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<section style="--ui-rule: 100%">
|
|
74
|
+
<table class="data-table">Ruled by the region</table>
|
|
75
|
+
</section>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The frame around the table is the edge axis and is asked for the same way:
|
|
79
|
+
`.data-table` publishes `edgeless`, so `.edged` draws one. None of the
|
|
80
|
+
three switches reaches the others — `.data-table.ruleless.edged` is a
|
|
81
|
+
framed table with no lines inside it, and `.data-table.ruled` is a
|
|
82
|
+
frameless one with every row separated.
|
|
83
|
+
|
|
84
|
+
A table's rows deliberately inherit its intent instead of resetting it, so
|
|
85
|
+
`.data-table.success` tints throughout. A row carrying its own intent still
|
|
86
|
+
wins:
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<table class="data-table success">
|
|
90
|
+
<tbody>
|
|
91
|
+
<tr>
|
|
92
|
+
<td>Inherits the table intent</td>
|
|
93
|
+
</tr>
|
|
94
|
+
<tr class="destructive">
|
|
95
|
+
<td>Overrides it for this row</td>
|
|
96
|
+
</tr>
|
|
97
|
+
</tbody>
|
|
98
|
+
</table>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This is the one place intent cascades, because a table's rows are parts of
|
|
102
|
+
the table rather than independent components.
|
|
103
|
+
|
|
104
|
+
`.data-table`, `.kbd`, `.code`, and `.pre` also read
|
|
105
|
+
[presentation](./composing.md#presentation). A table applies it to its
|
|
106
|
+
header, its rules and its border; a chip to its whole plate:
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<table class="data-table success soft edged">...</table>
|
|
110
|
+
<table class="data-table">A ghost table: rules and type, no header plate</table>
|
|
111
|
+
<kbd class="kbd primary solid">Ctrl</kbd>
|
|
112
|
+
<kbd class="kbd primary soft edged">Shift</kbd>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`.ghost` means two different things on these components, and both are worth
|
|
116
|
+
knowing before you reach for it.
|
|
117
|
+
|
|
118
|
+
On `.data-table` it removes the header plate along with the body tint, so
|
|
119
|
+
`.data-table.ghost` is boundaries and type alone. The component rests at
|
|
120
|
+
`soft`, so that is something to ask for rather than the default.
|
|
121
|
+
|
|
122
|
+
On `.kbd`, `.code`, and `.pre` it is **not supported**. All three rest on
|
|
123
|
+
`--intent-subtle`, and that ground draws the plate whatever the fill says —
|
|
124
|
+
so `.ghost` took the fill away and changed nothing visible. Worse, the
|
|
125
|
+
ground alone is a near-page tint: a ghost chip measured the same `#e5e5e5`
|
|
126
|
+
for neutral and primary on the light page, and `#f5f5f5` at 1.04:1 against
|
|
127
|
+
it for secondary. All three rest at `.soft` instead, which puts a real `12%`
|
|
128
|
+
of the intent over the ground and separates them.
|
|
129
|
+
|
|
130
|
+
Use `.table-wrap` around `.data-table` when table width may exceed its
|
|
131
|
+
container:
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<div class="table-wrap">
|
|
135
|
+
<table class="data-table">
|
|
136
|
+
<thead>
|
|
137
|
+
<tr>
|
|
138
|
+
<th>Package</th>
|
|
139
|
+
<th>Status</th>
|
|
140
|
+
</tr>
|
|
141
|
+
</thead>
|
|
142
|
+
<tbody>
|
|
143
|
+
<tr>
|
|
144
|
+
<td>styles</td>
|
|
145
|
+
<td>Ready</td>
|
|
146
|
+
</tr>
|
|
147
|
+
</tbody>
|
|
148
|
+
</table>
|
|
149
|
+
</div>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Surfaces
|
|
153
|
+
|
|
154
|
+
| Class | Purpose |
|
|
155
|
+
| -------------------- | ---------------------------------------------------------------------------- |
|
|
156
|
+
| `.card` | Bordered container, surface radius, padded. Rests at elevation `1`. |
|
|
157
|
+
| `.panel` | Flush container for sidebars, toolbars, and wells. No elevation. |
|
|
158
|
+
| `.interactive` | On `.card`. Adds pointer cursor, hover and press response, and a focus ring. |
|
|
159
|
+
| `.p-sm`, `.compact` | On `.card` or `.panel`. Reduces padding. |
|
|
160
|
+
| `.p-lg`, `.spacious` | On `.card` or `.panel`. Increases padding. |
|
|
161
|
+
| `.flush` | On `.card` or `.panel`. Removes padding, for edge-to-edge content. |
|
|
162
|
+
|
|
163
|
+
Both read intent, [presentation](./composing.md#presentation), and
|
|
164
|
+
[material tokens](./customizing.md#material-tokens). A plain `.card` is a
|
|
165
|
+
neutral bordered container; only an explicit presentation tints it. Resting
|
|
166
|
+
at elevation `1` is not a visible shadow by itself — nothing draws depth
|
|
167
|
+
until an [aesthetic](./aesthetics.md) supplies shadow geometry or
|
|
168
|
+
`.elevation-sm`/`.elevation-md` asks for it; see
|
|
169
|
+
[Composing → Elevation](./composing.md#elevation).
|
|
170
|
+
|
|
171
|
+
On the base look, `.card.interactive` scales down slightly on press
|
|
172
|
+
(`--ui-active-transform`, `scale(0.97)`); an [aesthetic](./aesthetics.md)
|
|
173
|
+
substitutes its own press gesture, and `prefers-reduced-motion` turns it off.
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<article class="card">Neutral card</article>
|
|
177
|
+
<article class="card success soft">Tinted success card</article>
|
|
178
|
+
<article class="card primary ghost edged">Intent border, no fill</article>
|
|
179
|
+
<a class="card interactive" href="/package">Responds to hover and press</a>
|
|
180
|
+
<aside class="panel">Flush panel</aside>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`.interactive` is styling only. Use a real interactive element and give it
|
|
184
|
+
an accessible name; a `<div class="card interactive">` is not focusable or
|
|
185
|
+
operable by keyboard.
|
|
186
|
+
|
|
187
|
+
## Typography utilities
|
|
188
|
+
|
|
189
|
+
All typography classes and `.selection-contrast` are `@utility` classes.
|
|
190
|
+
|
|
191
|
+
| Class | Purpose |
|
|
192
|
+
| --------------------- | ------------------------------------------------------------ |
|
|
193
|
+
| `.text-display` | Large display headings. |
|
|
194
|
+
| `.text-title-lg` | Large section titles. |
|
|
195
|
+
| `.text-title` | Default section titles. |
|
|
196
|
+
| `.text-title-sm` | Smaller titles or card titles. |
|
|
197
|
+
| `.text-label-lg` | Large label text. |
|
|
198
|
+
| `.text-label` | Default label text. |
|
|
199
|
+
| `.text-body` | Default body copy. |
|
|
200
|
+
| `.selection-contrast` | Inverts `::selection` colors to primary-contrast background. |
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Customizing
|
|
3
|
+
description: Presentation and material token reference, and aesthetic knobs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Customizing
|
|
7
|
+
|
|
8
|
+
Presentation tokens decide how much of an intent shows. Material tokens
|
|
9
|
+
decide what a component is made of. Aesthetic tokens are the small set of
|
|
10
|
+
named knobs a shipped aesthetic exposes to scale its own look.
|
|
11
|
+
|
|
12
|
+
## Presentation tokens
|
|
13
|
+
|
|
14
|
+
Presentation tokens describe _how much_ of an intent a component shows,
|
|
15
|
+
never _which_ intent it shows. They are unitless numbers and percentages, so
|
|
16
|
+
they carry no color and inherit safely: a container sets them once and every
|
|
17
|
+
component below resolves them against its own intent.
|
|
18
|
+
|
|
19
|
+
| Token | Purpose |
|
|
20
|
+
| ----------------- | -------------------------------------------------------------------------- |
|
|
21
|
+
| `--ui-fill` | Percentage of the intent color mixed into the background. |
|
|
22
|
+
| `--ui-fg-on-fill` | Percentage blended from the intent readable tone toward its contrast tone. |
|
|
23
|
+
| `--ui-border` | Percentage of the intent color mixed into the border color. |
|
|
24
|
+
|
|
25
|
+
A component resolves them with `color-mix` from its published default. Hover
|
|
26
|
+
is derived by adding `--hover-step` to the resting fill and using
|
|
27
|
+
`--intent-hover`; there are no per-presentation hover tokens.
|
|
28
|
+
|
|
29
|
+
No fill class writes `--ui-border` and no edge class writes `--ui-fill`. A
|
|
30
|
+
filled box with no line is `.solid.edgeless`, which is worth reaching for on
|
|
31
|
+
a neutral component: neutral caps its fill, so the box stays translucent and
|
|
32
|
+
a border over it paints a second coat of the same tint instead of blending
|
|
33
|
+
into it.
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
background: color-mix(in oklab, var(--color-primary) var(--ui-fill, 100%), transparent);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Two choices there are deliberate. Mixing toward `transparent` rather than a
|
|
40
|
+
background token lets a tinted surface adapt to whatever it is placed on.
|
|
41
|
+
Mixing in `oklab` keeps the wide-gamut token palette intact and blends
|
|
42
|
+
perceptually, where `srgb` would clip it.
|
|
43
|
+
|
|
44
|
+
A computed color therefore reaches the page as a resolved `color-mix` result
|
|
45
|
+
rather than the token's own `oklch` syntax. It is the same color; code that
|
|
46
|
+
compares computed color strings should compare colors instead.
|
|
47
|
+
|
|
48
|
+
> **Presentation token contract**: only presentation classes and consumer
|
|
49
|
+
> overrides set these tokens; components only read them. Setting a value
|
|
50
|
+
> that no presentation class produces is supported but unvalidated. See
|
|
51
|
+
> [Composing](./composing.md) for the classes that ship these values.
|
|
52
|
+
|
|
53
|
+
## Material tokens
|
|
54
|
+
|
|
55
|
+
Material tokens describe what a component is _made of_ rather than which
|
|
56
|
+
intent it shows or how strongly. They control shape, borders, shadows,
|
|
57
|
+
translucency, filters, and transforms.
|
|
58
|
+
|
|
59
|
+
Components read each with a fallback, so leaving them unset produces the
|
|
60
|
+
default look. Setting them on a container restyles the whole subtree. Only
|
|
61
|
+
shadow geometry is split into colorless parts that inherit safely;
|
|
62
|
+
color-capable inputs such as `--ui-ink` and `--ui-surface-shadow` may
|
|
63
|
+
include their own colors.
|
|
64
|
+
|
|
65
|
+
| Token | Purpose | Fallback |
|
|
66
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------- |
|
|
67
|
+
| `--ui-radius` | Corner radius for controls. | `--radius-control` |
|
|
68
|
+
| `--ui-radius-surface` | Corner radius for surfaces. | `--radius-surface` |
|
|
69
|
+
| `--ui-border-width` | Edge thickness. | `--border-width` |
|
|
70
|
+
| `--ui-border-max` | Ceiling on computed edge width. | `100px` |
|
|
71
|
+
| `--ui-ink` | Neutral line color when no intent is set. | `--color-border` |
|
|
72
|
+
| `--ui-rule` | Lines inside a table. Unset draws the head and foot boundaries only; `0%` draws none; `100%` rules every row. | unset |
|
|
73
|
+
| `--ui-shadow-x` | Shadow horizontal offset. | `0px` |
|
|
74
|
+
| `--ui-shadow-y` | Shadow vertical offset. | `0px` |
|
|
75
|
+
| `--ui-shadow-blur` | Shadow blur radius. | `0px` |
|
|
76
|
+
| `--ui-shadow-spread` | Shadow spread radius. | `0px` |
|
|
77
|
+
| `--ui-shadow-inset` | The `inset` keyword for an inner ring. | Empty |
|
|
78
|
+
| `--ui-hover-shadow-x` | Shadow horizontal offset while hovered. | `--ui-shadow-x` |
|
|
79
|
+
| `--ui-hover-shadow-y` | Shadow vertical offset while hovered. | `--ui-shadow-y` |
|
|
80
|
+
| `--ui-active-shadow-x` | Shadow horizontal offset while pressed. | `--ui-shadow-x` |
|
|
81
|
+
| `--ui-active-shadow-y` | Shadow vertical offset while pressed. | `--ui-shadow-y` |
|
|
82
|
+
| `--ui-active-transform` | Transform while pressed. `none` under `prefers-reduced-motion`. | `scale(0.97)` |
|
|
83
|
+
| `--ui-shadow-ink` | Percentage of shadow color taken from intent ink. | `0%` |
|
|
84
|
+
| `--ui-shadow-edge` | Declared, even empty, when the shadow is the element's edge rather than its depth. Read for presence. | Unset |
|
|
85
|
+
| `--ui-elevation` | Unitless multiplier over shadow geometry. | `1` |
|
|
86
|
+
| `--ui-surface-shadow` | Complete multi-layer shadow accepted by surfaces only. | Unset |
|
|
87
|
+
| `--ui-surface-ground` | Ground a surface sits on. | `--color-background` |
|
|
88
|
+
| `--ui-bg-alpha` | Multiplier over fill for translucent materials. | `1` |
|
|
89
|
+
| `--ui-backdrop` | Backdrop filter accepted by surfaces only. | `none` |
|
|
90
|
+
| `--ui-hover-transform` | Transform while an interactive element is hovered. | `none` |
|
|
91
|
+
| `--ui-clip` | Structural component silhouette. | `none` |
|
|
92
|
+
| `--ui-clip-tight` | Compact component silhouette. | `--ui-clip` |
|
|
93
|
+
| `--ui-focus-inset` | Inset focus layer width. | Unset |
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<section style="--ui-radius: 0; --ui-border-width: 3px">
|
|
97
|
+
<button class="btn primary">Square and heavy</button>
|
|
98
|
+
<input class="ipt" placeholder="Matches" />
|
|
99
|
+
</section>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
> **Material token contract**: components read these; aesthetic classes and
|
|
103
|
+
> consumer overrides set them.
|
|
104
|
+
|
|
105
|
+
### Shape and ring composition
|
|
106
|
+
|
|
107
|
+
Clipping removes borders, outlines, and outer shadows. An aesthetic that uses
|
|
108
|
+
a clip can replace the border with an inset shadow by setting
|
|
109
|
+
`--ui-shadow-inset` and the four shadow geometry parts. Set
|
|
110
|
+
`--ui-border-max: 0px` when that ring replaces the component border.
|
|
111
|
+
Focusable components restore the clipped focus outline through
|
|
112
|
+
`--ui-focus-inset`.
|
|
113
|
+
|
|
114
|
+
Declare `--ui-shadow-edge` when that ring _is_ the border. The ring then
|
|
115
|
+
takes the element's edge color, which carries the edge axis as its alpha, so
|
|
116
|
+
`.edged` draws it and `.edgeless` does not — the same answer a real border
|
|
117
|
+
gives. Without it the ring paints on every component the aesthetic reaches
|
|
118
|
+
and the edge classes have no effect. Use `--ui-shadow-ink` instead when the
|
|
119
|
+
shadow is depth cast in the intent's own ink, such as a hard offset slab,
|
|
120
|
+
which an `.edgeless` element still gets.
|
|
121
|
+
|
|
122
|
+
The token is read for its presence, not its value: declare it empty to
|
|
123
|
+
switch the ring on, and `initial` to switch it back off in an aesthetic
|
|
124
|
+
nested inside one that declares it.
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
.stepped {
|
|
128
|
+
--ui-clip: polygon(/* structural silhouette */);
|
|
129
|
+
--ui-clip-tight: none;
|
|
130
|
+
--ui-border-max: 0px;
|
|
131
|
+
--ui-shadow-inset: inset;
|
|
132
|
+
--ui-shadow-edge: ;
|
|
133
|
+
--ui-shadow-x: 0px;
|
|
134
|
+
--ui-shadow-y: 0px;
|
|
135
|
+
--ui-shadow-blur: 0px;
|
|
136
|
+
--ui-shadow-spread: 4px;
|
|
137
|
+
--ui-focus-inset: var(--focus-ring-width);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Variables named `--shape-*` are internal composition outputs. Do not set or
|
|
142
|
+
read them; only the `--ui-*` inputs above are public.
|
|
143
|
+
|
|
144
|
+
## Aesthetic tokens
|
|
145
|
+
|
|
146
|
+
The shipped [aesthetic classes](./aesthetics.md) set material tokens for you.
|
|
147
|
+
Only aesthetics with a token listed below expose an aesthetic-specific
|
|
148
|
+
token. Tune all other behavior through the shared material tokens above.
|
|
149
|
+
Listed tokens are available only where that aesthetic's stylesheet is
|
|
150
|
+
imported.
|
|
151
|
+
|
|
152
|
+
| Token | Aesthetic | Purpose | Default |
|
|
153
|
+
| ------------------------ | --------------- | ----------------------------------------------------------- | --------------------------------- |
|
|
154
|
+
| `--neo-offset` | `.neobrutalism` | Hard shadow offset and distance the press travels. | `4px` |
|
|
155
|
+
| `--glass-radius` | `.glass` | Control corner radius. | `0.75rem` |
|
|
156
|
+
| `--glass-radius-surface` | `.glass` | Surface corner radius. | `1rem` |
|
|
157
|
+
| `--pixel-unit` | `.pixel` | One pixel of the grid. The corner cut and the ring are one. | `4px` |
|
|
158
|
+
| `--font-pixel` | `.pixel` | Consumer-supplied pixel font stack. | Falls back to the monospace stack |
|
|
159
|
+
| `--tile-radius` | `.chunky-tile` | Corner radius, on controls and surfaces alike. | `0.75rem` |
|
|
160
|
+
| `--tile-lift` | `.chunky-tile` | Depth of the seated bar, and how far a press travels. | `4px` |
|
|
161
|
+
| `--font-rounded` | `.chunky-tile` | Consumer-supplied rounded font stack. | Falls back to the page stack |
|
|
162
|
+
|
|
163
|
+
All four aesthetics reach the same way: each knob is _read_ with its default
|
|
164
|
+
as a `var()` fallback rather than declared, so it resolves once into a
|
|
165
|
+
private on the aesthetic's own class (`--_pixel-unit`, `--_neo-offset`,
|
|
166
|
+
`--_tile-radius`, `--_tile-lift`, and so on). Set a knob on the element
|
|
167
|
+
carrying the aesthetic class, or on any ancestor including `:root`:
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<section class="pixel" style="--pixel-unit: 6px">
|
|
171
|
+
<button class="btn primary">Chunkier</button>
|
|
172
|
+
</section>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<html class="pixel" style="--pixel-unit: 6px">
|
|
177
|
+
<body>
|
|
178
|
+
<button class="btn primary">Also chunkier, set from the root</button>
|
|
179
|
+
</body>
|
|
180
|
+
</html>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Knobs and material tokens reach in opposite directions, and telling them
|
|
184
|
+
apart matters. A knob resolves once at the aesthetic's own class and
|
|
185
|
+
inherits down already-resolved, so it reaches the aesthetic **from above**:
|
|
186
|
+
setting it on the element or any ancestor works, but setting it on a
|
|
187
|
+
_descendant_ of the aesthetic class changes nothing — the value has already
|
|
188
|
+
been read. `--ui-radius` and the other material tokens above are read fresh
|
|
189
|
+
by each component as it draws, so they reach **at or below** the element
|
|
190
|
+
carrying them, which is how you round one card differently from its
|
|
191
|
+
neighbours without touching the knob at all.
|
|
192
|
+
|
|
193
|
+
Shipped aesthetics set the shared material tokens above. `.neobrutalism` and
|
|
194
|
+
`.pixel` set `--ui-ink` for their neutral outline; intent classes still
|
|
195
|
+
override the intent slots on each component.
|
|
196
|
+
|
|
197
|
+
## Component internals
|
|
198
|
+
|
|
199
|
+
Component classes may define scoped implementation variables such as
|
|
200
|
+
`--button-*`, `--surface-*`, `--control-*`, `--feedback-*`, and `--tooltip-*`.
|
|
201
|
+
These variables are internal wiring for class composition and are not the
|
|
202
|
+
public token contract.
|
|
203
|
+
|
|
204
|
+
Consumers should customize broad behavior through color, foundation, motion,
|
|
205
|
+
elevation, radius, layout, and focus tokens first. The only supported
|
|
206
|
+
component-scoped input is `--progress-value` on the `.progress` element,
|
|
207
|
+
because consumers must provide a value such as `64%`.
|
|
208
|
+
|
|
209
|
+
`--layout-gap` replaces the removed `--layout-stack-gap` and
|
|
210
|
+
`--layout-cluster-gap` tokens. No compatibility aliases are provided.
|
|
211
|
+
|
|
212
|
+
Next: [Aesthetics](./aesthetics.md) covers each shipped aesthetic's complete
|
|
213
|
+
look and its documented exceptions.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Feedback
|
|
3
|
+
description: Alert, badge, loader, skeleton, and progress class reference.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Feedback
|
|
7
|
+
|
|
8
|
+
| Class | Purpose |
|
|
9
|
+
| ---------------- | ---------------------------------------------------------------------------- |
|
|
10
|
+
| `.alert` | Inline feedback surface. |
|
|
11
|
+
| `.icon` | Subclass of `.alert`. Adds a corresponding intent icon and padding. |
|
|
12
|
+
| `.badge` | Compact status pill. |
|
|
13
|
+
| `.loader-mask` | Low-level activity indicator composition utility. Applies the spinner mask. |
|
|
14
|
+
| `.loader` | Standalone inline loader artwork. |
|
|
15
|
+
| `.skeleton` | Ambient loading placeholder. |
|
|
16
|
+
| `.progress` | Progress track. Uses `--progress-value` variable. |
|
|
17
|
+
| `.active` | Optional on `.progress` to add a track shimmer. |
|
|
18
|
+
| `.indeterminate` | Optional on `.progress` to animate a moving fill without `--progress-value`. |
|
|
19
|
+
|
|
20
|
+
Activity indicator modifier classes compose with `.loader`:
|
|
21
|
+
|
|
22
|
+
| Class | Animation style |
|
|
23
|
+
| ---------------------- | --------------------------------------- |
|
|
24
|
+
| _(default)_ | Circular spinner (rotating arc). |
|
|
25
|
+
| `.dots-wave` | Three dots bouncing up/down in a wave. |
|
|
26
|
+
| `.dots-fade` | Three dots fading in and out. |
|
|
27
|
+
| `.dots-queue` | Dot queuing from left to right. |
|
|
28
|
+
| `.dots-rotate` | Side dots rotating around a center dot. |
|
|
29
|
+
| `.dots-grow` | Three dots growing and shrinking. |
|
|
30
|
+
| `.dots-grow-alternate` | Outer dots small, center dot pulses. |
|
|
31
|
+
| `.dot-bounce` | Single dot bouncing with squash effect. |
|
|
32
|
+
| `.bars-wave` | Three vertical bars scaling in a wave. |
|
|
33
|
+
| `.pulse-ring` | Two concentric rings pulsing outward. |
|
|
34
|
+
|
|
35
|
+
These variants retain their embedded SVG animations normally. Under
|
|
36
|
+
`prefers-reduced-motion: reduce`, loader CSS substitutes a corresponding
|
|
37
|
+
static mask. This fallback is part of focused loader, button, and components
|
|
38
|
+
imports; it does not depend on the global reset. See
|
|
39
|
+
[Accessibility](../accessibility.md).
|
|
40
|
+
|
|
41
|
+
Loader size modifiers:
|
|
42
|
+
|
|
43
|
+
| Class | Size |
|
|
44
|
+
| -------- | ----------------- |
|
|
45
|
+
| _(none)_ | Default (`2rem`). |
|
|
46
|
+
| `.sm` | Small (`1.5rem`). |
|
|
47
|
+
| `.lg` | Large (`2.5rem`). |
|
|
48
|
+
|
|
49
|
+
Alerts, badges, progress bars, skeletons, and loaders accept `.primary`,
|
|
50
|
+
`.secondary`, `.success`, `.warning`, `.destructive`, `.danger`, `.error`,
|
|
51
|
+
and `.info`. Without an intent, they use the text palette, except `.loader`,
|
|
52
|
+
which keeps `currentColor` so it matches whatever content surrounds it.
|
|
53
|
+
|
|
54
|
+
Skeletons, loaders, progress bars, and dividers are indicators. They read
|
|
55
|
+
intent but ignore fill and edge [presentation](./composing.md#presentation).
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<span class="loader success" aria-hidden="true"></span>
|
|
59
|
+
<span class="skeleton info"></span>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`.icon` is a subclass of `.alert`. When applied as `.alert.icon`, it
|
|
63
|
+
increases the left padding and adds an embedded SVG. Success, warning, and
|
|
64
|
+
destructive intents use corresponding symbols; other intents use the
|
|
65
|
+
information symbol.
|
|
66
|
+
|
|
67
|
+
Alerts and badges read the shared [presentation](./composing.md#presentation)
|
|
68
|
+
classes. Without one they use a tinted surface, intent-colored text, and a
|
|
69
|
+
mixed intent border.
|
|
70
|
+
|
|
71
|
+
## Example
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<div class="alert success" role="status">Saved successfully.</div>
|
|
75
|
+
<div class="alert primary solid" role="status">Deployment started.</div>
|
|
76
|
+
<div class="alert warning soft icon" role="status">Review required.</div>
|
|
77
|
+
<div class="alert destructive ghost edged" role="alert">Deployment failed.</div>
|
|
78
|
+
<span class="badge warning">Queued</span>
|
|
79
|
+
<span class="badge success solid">Live</span>
|
|
80
|
+
<span class="badge info soft">Draft</span>
|
|
81
|
+
<span class="loader" aria-hidden="true"></span>
|
|
82
|
+
<span class="loader dots-wave" aria-hidden="true"></span>
|
|
83
|
+
<span class="loader dots-fade" aria-hidden="true"></span>
|
|
84
|
+
<span class="loader bars-wave" aria-hidden="true"></span>
|
|
85
|
+
<span class="loader pulse-ring sm" aria-hidden="true"></span>
|
|
86
|
+
<span class="loader dots-grow lg" aria-hidden="true"></span>
|
|
87
|
+
<div
|
|
88
|
+
class="progress"
|
|
89
|
+
role="progressbar"
|
|
90
|
+
aria-label="Upload progress"
|
|
91
|
+
aria-valuemin="0"
|
|
92
|
+
aria-valuemax="100"
|
|
93
|
+
aria-valuenow="64"
|
|
94
|
+
style="--progress-value: 64%"
|
|
95
|
+
></div>
|
|
96
|
+
<div
|
|
97
|
+
class="progress secondary active"
|
|
98
|
+
role="progressbar"
|
|
99
|
+
aria-label="Upload progress"
|
|
100
|
+
aria-valuemin="0"
|
|
101
|
+
aria-valuemax="100"
|
|
102
|
+
aria-valuenow="64"
|
|
103
|
+
style="--progress-value: 64%"
|
|
104
|
+
></div>
|
|
105
|
+
<div
|
|
106
|
+
class="progress info indeterminate"
|
|
107
|
+
role="progressbar"
|
|
108
|
+
aria-label="Loading"
|
|
109
|
+
aria-valuemin="0"
|
|
110
|
+
aria-valuemax="100"
|
|
111
|
+
></div>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Add `role="status"` or `role="alert"` to alerts based on announcement
|
|
115
|
+
urgency, mark decorative loading visuals with `aria-hidden="true"`, and use
|
|
116
|
+
semantic progress elements or ARIA values when numeric progress must be
|
|
117
|
+
announced; see [Accessibility](../accessibility.md).
|