@codenhub/styles 0.0.4 → 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.
Files changed (71) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +27 -0
  3. package/README.md +60 -92
  4. package/dist/aesthetics/chunky-tile.css +1 -0
  5. package/dist/aesthetics/glass.css +1 -0
  6. package/dist/aesthetics/index.css +2 -0
  7. package/dist/aesthetics/neobrutalism.css +1 -0
  8. package/dist/aesthetics/pixel.css +1 -0
  9. package/dist/components.css +2 -2
  10. package/dist/index.css +2 -2
  11. package/dist/native.css +2 -0
  12. package/dist/theme.css +2 -2
  13. package/dist/tw/aesthetics/chunky-tile.css +107 -0
  14. package/dist/tw/aesthetics/glass.css +66 -0
  15. package/dist/tw/aesthetics/index.css +9 -0
  16. package/dist/tw/aesthetics/neobrutalism.css +63 -0
  17. package/dist/tw/aesthetics/pixel.css +88 -0
  18. package/dist/tw/box.css +185 -0
  19. package/dist/tw/components/button.css +88 -0
  20. package/dist/tw/components/feedback.css +163 -0
  21. package/dist/tw/components/form.css +601 -0
  22. package/dist/tw/components/index.css +18 -0
  23. package/dist/tw/components/loader.css +122 -0
  24. package/dist/tw/components/surface.css +98 -0
  25. package/dist/tw/components/tooltip.css +132 -0
  26. package/dist/tw/elevation.css +39 -0
  27. package/dist/tw/index.css +12 -0
  28. package/dist/tw/intent.css +189 -0
  29. package/dist/tw/native.css +203 -0
  30. package/dist/tw/presentation.css +77 -0
  31. package/dist/tw/reset.css +142 -0
  32. package/dist/tw/theme.css +218 -0
  33. package/dist/tw/typography.css +34 -0
  34. package/dist/tw/utilities/content.css +349 -0
  35. package/dist/tw/utilities/index.css +6 -0
  36. package/dist/tw/utilities/layout.css +107 -0
  37. package/docs/accessibility.md +82 -0
  38. package/docs/concepts.md +94 -0
  39. package/docs/index.md +62 -0
  40. package/docs/integrating/astro.md +29 -0
  41. package/docs/integrating/index.md +32 -0
  42. package/docs/integrating/nextjs.md +44 -0
  43. package/docs/integrating/svelte.md +37 -0
  44. package/docs/integrating/tailwind.md +40 -0
  45. package/docs/integrating/vue.md +25 -0
  46. package/docs/setup.md +116 -0
  47. package/docs/usage/aesthetics.md +197 -0
  48. package/docs/usage/buttons.md +74 -0
  49. package/docs/usage/composing.md +218 -0
  50. package/docs/usage/content-and-layout.md +200 -0
  51. package/docs/usage/customizing.md +213 -0
  52. package/docs/usage/feedback.md +117 -0
  53. package/docs/usage/forms.md +177 -0
  54. package/docs/usage/index.md +32 -0
  55. package/docs/usage/theming.md +210 -0
  56. package/docs/usage/tooltips.md +45 -0
  57. package/llms-full.txt +2122 -0
  58. package/llms.txt +26 -0
  59. package/package.json +95 -29
  60. package/src/components/button.css +0 -155
  61. package/src/components/feedback.css +0 -214
  62. package/src/components/form.css +0 -303
  63. package/src/components/index.css +0 -9
  64. package/src/components/loader.css +0 -56
  65. package/src/components/surface.css +0 -6
  66. package/src/components/tooltip.css +0 -60
  67. package/src/index.css +0 -7
  68. package/src/overrides.css +0 -76
  69. package/src/theme.css +0 -234
  70. package/src/typography.css +0 -30
  71. package/src/utilities.css +0 -40
@@ -0,0 +1,218 @@
1
+ ---
2
+ title: Composing
3
+ description: Combining intent, presentation, and aesthetic on a component, and the axis-support matrix.
4
+ ---
5
+
6
+ # Composing the three axes
7
+
8
+ See [Concepts](../concepts.md#the-three-axes) for what each axis means. This
9
+ page covers how they combine in markup, what the presentation classes mean in
10
+ depth, which components support which axis, and elevation.
11
+
12
+ ## Combining axes
13
+
14
+ ```html
15
+ <div class="soft">
16
+ <button class="btn primary">Soft primary button</button>
17
+ <span class="badge success">Soft success badge</span>
18
+ <button class="btn primary ghost edged">Outlined; the element wins</button>
19
+ </div>
20
+ ```
21
+
22
+ A declaration on the element always beats one inherited from a container, so
23
+ a container sets the default look for its subtree and any element opts out.
24
+
25
+ Intent classes do not cascade. `.primary` and its siblings stay on the
26
+ element that shows the intent, because a container silently recoloring every
27
+ descendant is a trap rather than a feature — see
28
+ [Theming → Intent tokens](./theming.md#intent-tokens). Use `.neutral` to opt
29
+ an element back out of an inherited intent context. Presentation and
30
+ [material tokens](./customizing.md#material-tokens) do cascade, so a
31
+ container can set the look of its whole subtree while any element overrides
32
+ it.
33
+
34
+ ## Presentation
35
+
36
+ Presentation has two independent axes. `.solid`, `.soft`, and `.ghost`
37
+ decide how much intent fills a component; `.edged` and `.edgeless` decide
38
+ whether it draws a boundary. They set
39
+ [presentation tokens](./customizing.md#presentation-tokens) and nothing
40
+ else, so they work on the component itself or on any ancestor.
41
+
42
+ | Class | Look |
43
+ | ----------- | ---------------------------------------------------------- |
44
+ | `.solid` | Intent-colored fill with contrast text. |
45
+ | `.soft` | Lightly tinted fill with intent-colored text. |
46
+ | `.ghost` | No fill at rest, with intent-colored text. |
47
+ | `.edged` | Intent-colored boundary at the aesthetic's material width. |
48
+ | `.edgeless` | No boundary. |
49
+
50
+ Values each class ships:
51
+
52
+ | Class | `--ui-fill` | `--ui-fg-on-fill` | `--ui-border` |
53
+ | ----------- | ----------- | ----------------- | ------------- |
54
+ | `.solid` | `100%` | `100%` | |
55
+ | `.soft` | `12%` | `0%` | |
56
+ | `.ghost` | `0%` | `0%` | |
57
+ | `.edged` | | | `100%` |
58
+ | `.edgeless` | | | `0%` |
59
+
60
+ The combinations mean exactly what they spell:
61
+
62
+ ```html
63
+ <button class="btn primary">Solid, the button default</button>
64
+ <button class="btn soft edged">Tinted with a border</button>
65
+ <button class="btn primary ghost edged">Outline</button>
66
+ <button class="btn ghost">Ghost; picks up a tint on hover</button>
67
+ <input class="ipt soft edgeless" />
68
+ <!-- A field sunk into the page -->
69
+ ```
70
+
71
+ A fill class never decides an edge and an edge class never decides a fill.
72
+ Use `.solid.edgeless` for a filled box with no line — and prefer it on a
73
+ neutral one, because a capped fill leaves the box translucent and the edge
74
+ blend then paints a second coat of the same tint rather than disappearing
75
+ into it (measured 1.53:1 against its own plate in light, 1.82:1 in dark).
76
+
77
+ The edge is the silhouette and nothing else. Rules _inside_ a component that
78
+ has an inside are a separate switch — see
79
+ [Content and layout → Table rules](./content-and-layout.md#table-rules) —
80
+ because tying them to this axis made them arrive by implication rather than
81
+ by request.
82
+
83
+ With no presentation class in scope, each component keeps its own default:
84
+ buttons are filled, alerts and badges are tinted, surfaces and controls are
85
+ neutral and bordered.
86
+
87
+ | Component | Reads |
88
+ | ----------------------------------------------- | ------------------------------------------- |
89
+ | `.btn`, `.alert`, `.badge`, `.card`, `.panel` | Fill, text, border, and border width. |
90
+ | `.kbd` | Fill, text, border, and border width. |
91
+ | `.data-table` | Header fill and text, border, border width. |
92
+ | `.ipt`, `.textarea`, `.select`, `.text-control` | Border, border width, and a capped fill. |
93
+ | `.input-group` | Border, border width, and a capped fill. |
94
+ | `.checkbox`, `.radio` | A capped fill, checked and unchecked. |
95
+ | `.switch` | Border, border width, and a capped fill. |
96
+ | `.quote` | Fill, text, border, and width. |
97
+ | `.code`, `.pre`, `.tooltip` | Fill, text, border, and material. |
98
+ | `.loader`, `.skeleton`, `.progress`, `.divider` | Intent only, not presentation. |
99
+
100
+ Text controls and toggles cap a **cascaded** fill at `6%`, keeping typed
101
+ text legible when a `.solid` container reaches a field nobody classed. A
102
+ fill class written on the control itself names its own cap instead, because
103
+ that is a consumer describing what they want: `.soft` takes `12%` and
104
+ `.solid` takes `20%`. A switch caps at `40%`, where its three fills separate
105
+ far enough to read on a track.
106
+
107
+ | On a text control | fill |
108
+ | ----------------- | ---- |
109
+ | `.ghost` | 0% |
110
+ | cascaded `.solid` | 6% |
111
+ | `.soft` | 12% |
112
+ | `.solid` | 20% |
113
+
114
+ The same split governs the edge: a cascaded `.edgeless` is floored and the
115
+ element's own is honoured — except on `.checkbox` and `.radio`, which never
116
+ drop their line at all. See [Forms](./forms.md) for the full toggle and text
117
+ control reference.
118
+
119
+ A tooltip bubble is filled, over a tinted ground. An intent fills it with
120
+ that intent's own color: `.tooltip.primary` is the primary color, black on a
121
+ light page and white on a dark one, and `.tooltip.destructive` is a red
122
+ bubble.
123
+
124
+ With no intent the bubble is `--color-tooltip`, the one plate in the package
125
+ chosen per theme rather than derived from an intent. Composed like
126
+ everything else it was `20%` of the page's ink over the surface tone, which
127
+ steps _lighter_ than the surface on a dark page and _darker_ on a light
128
+ one — so the dark bubble read as lifted and the light one as a mid-grey
129
+ slab two steps darker than every card on the screen. The token states each
130
+ direction instead: near-white over a light page, a mid grey over a dark
131
+ one. `--color-tooltip-contrast` is its ink.
132
+
133
+ Near-white is only 1.04:1 against a light page, so the bubble draws a
134
+ hairline as well, and floors it: a container's `.solid` or `.edgeless`
135
+ cannot take the boundary away from a bubble nobody classed, while
136
+ `.tooltip.edgeless` still can. The ground keeps the bubble opaque at every
137
+ fill, so a cascaded presentation leaves it readable over whatever it floats
138
+ above. It reads the material tokens too, so an [aesthetic](./aesthetics.md)
139
+ in scope shapes the bubble like any other component. See
140
+ [Tooltips](./tooltips.md) for the full tooltip reference.
141
+
142
+ ## Component axis reference
143
+
144
+ This table is the authoritative axis map for demonstrated components. "Shape"
145
+ means the component reads applicable radius, border-width, shadow, hover, or
146
+ clip/edge material tokens; an aesthetic may intentionally affect only the
147
+ materials that component draws.
148
+
149
+ Presentation is two independent axes, so they get a column each. A `Yes` means
150
+ the class changes what the component computes, which
151
+ `tests/browser/axes.spec.ts` asserts against `registry.json` in both
152
+ directions: an axis marked `Yes` must move, and an axis marked `No` must not.
153
+
154
+ | Components | Intent | Fill | Edge | Aesthetic material |
155
+ | --------------------------------------------------------- | ------ | ---- | ---- | ------------------ |
156
+ | `.btn`, `.alert`, `.badge`, `.card`, `.panel` | Yes | Yes | Yes | Shape |
157
+ | `.loader` | Yes | No | No | No |
158
+ | `.kbd`, `.data-table` | Yes | Yes | Yes | Radius and edge |
159
+ | `.quote` | Yes | Yes | Yes | Edge width |
160
+ | `.divider`, `.skeleton` | Yes | No | No | No |
161
+ | `.ipt`, `.textarea`, `.select`, `.text-control` | Yes | Yes | Yes | Shape |
162
+ | `.input-group` | Yes | Yes | Yes | Shape |
163
+ | `.surface` | Yes | Yes | Yes | Shape |
164
+ | `.checkbox`, `.radio` | Yes | Yes | No | Radius and edge |
165
+ | `.switch` | Yes | Yes | Yes | Radius and edge |
166
+ | `.progress` | Yes | No | No | No |
167
+ | `.code`, `.pre` | Yes | Yes | Yes | Radius and clip |
168
+ | `.tooltip` | Yes | Yes | Yes | Shape and overlay |
169
+ | `.table-wrap`, `.quote-inline`, layout and text utilities | No | No | No | No |
170
+
171
+ `.checkbox` and `.radio` are the only components that read one axis and not
172
+ the other. Their line is the only thing marking an unchecked box, so it is
173
+ drawn whatever the edge class says, from a container or from the element
174
+ itself. `.edgeless` on either is unsupported rather than merely discouraged.
175
+
176
+ Every other text control floors a _cascaded_ `.edgeless` and honours its own:
177
+ a `.edgeless` toolbar will not erase the line of a field nobody classed, while
178
+ `.ipt.edgeless` is a consumer describing what they want and gets it.
179
+
180
+ Intent aliases such as `.danger` and `.error` occupy the same intent axis as
181
+ `.destructive`; they do not add component behavior. State and modifier
182
+ classes such as `.interactive`, `.loading`, `.invalid`, `.compact`, and
183
+ `.vertical` sit above this map and are documented with their component.
184
+
185
+ ## Elevation
186
+
187
+ Depth is a modifier, not an axis. Nothing is raised until an
188
+ [aesthetic](./aesthetics.md) draws depth or one of these classes asks for it.
189
+
190
+ | Class | Alias | Depth |
191
+ | ----------------- | ----------- | ------------------------------------------------------------------------ |
192
+ | `.elevation-none` | `.flat` | Removes part-based elevation; glass surfaces keep their complete shadow. |
193
+ | `.elevation-sm` | `.raised` | One unit of the depth in scope. Cards, tiles, popovers that sit close. |
194
+ | `.elevation-md` | `.floating` | Twice it, for menus and popovers. |
195
+
196
+ Both names in a row are equivalent, interchangeable classes — `.elevation-sm`
197
+ and `.raised` are aliases, not a canonical form and a deprecated one, the way
198
+ `.destructive` and `.danger` are on the intent axis. The `none`/`sm`/`md`
199
+ naming matches the raw `--elevation-*` tokens in
200
+ [Theming](./theming.md#foundation-tokens) for the same weight of depth, even
201
+ though the two are read from different places.
202
+
203
+ Each is one unitless multiplier over whatever shadow geometry is in scope, so
204
+ the same class reads as a soft blur on a plain page and as a hard offset slab
205
+ under `.neobrutalism` — the aesthetic decides what depth looks like, the
206
+ class decides how much of it this element takes.
207
+
208
+ ```html
209
+ <article class="card elevation-sm">Lifted</article>
210
+ <div class="elevation-md panel">A menu surface</div>
211
+ <article class="card elevation-none">Flat, whatever the page or container says</article>
212
+ ```
213
+
214
+ The multiplier is a plain number, so it inherits: a container lifts or
215
+ flattens a whole region and any element inside it still opts out on itself.
216
+ Spread is deliberately left out of the multiplication, because an aesthetic
217
+ that draws its edge as an inset ring spends spread on it and scaling that
218
+ would erase the edge.
@@ -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.