actual-css 0.14.1 → 0.15.1

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 (67) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +4 -4
  3. package/components.json +51 -6
  4. package/dist/actual.full.css +380 -32
  5. package/dist/actual.full.js +1 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/architecture.md +3 -0
  8. package/docs/design-notes/enhancement-contract.md +14 -0
  9. package/docs/design-notes/naming.md +6 -0
  10. package/docs/design-notes/steps.md +13 -2
  11. package/docs/design-notes/tokens.md +159 -0
  12. package/docs/navigation.json +4 -1
  13. package/docs/pages/components/accordion.md +15 -18
  14. package/docs/pages/components/avatar.md +1 -0
  15. package/docs/pages/components/badge.md +41 -5
  16. package/docs/pages/components/button.md +32 -7
  17. package/docs/pages/components/card.md +40 -7
  18. package/docs/pages/components/diagrams.md +96 -0
  19. package/docs/pages/components/steps.md +31 -17
  20. package/docs/pages/components/table.md +4 -0
  21. package/docs/pages/components/timeline.md +111 -0
  22. package/docs/pages/enhancements/overview.md +13 -20
  23. package/docs/pages/enhancements/status-bar.md +7 -9
  24. package/docs/pages/enhancements/tabs.md +59 -21
  25. package/docs/pages/enhancements/tooltip.md +10 -19
  26. package/docs/pages/examples/overview.md +3 -0
  27. package/docs/pages/forms/choice-cards.md +3 -0
  28. package/docs/pages/forms/combobox.md +34 -19
  29. package/docs/pages/forms/controls.md +2 -0
  30. package/docs/pages/forms/date-picker.md +34 -13
  31. package/docs/pages/forms/file-upload.md +120 -0
  32. package/docs/pages/forms/joined-controls.md +4 -2
  33. package/docs/pages/forms/overview.md +8 -0
  34. package/docs/pages/foundations/philosophy.md +32 -62
  35. package/docs/pages/foundations/theming.md +63 -26
  36. package/docs/pages/foundations/tokens.md +91 -159
  37. package/docs/pages/foundations/typography.md +3 -0
  38. package/docs/pages/guides/integrating-actual-css.md +1 -1
  39. package/docs/pages/guides/introduction.md +14 -14
  40. package/docs/pages/guides/modular-import.md +124 -0
  41. package/docs/pages/guides/upgrading.md +63 -0
  42. package/docs/pages/layout/choosing.md +10 -16
  43. package/docs/pages/layout/grid.md +8 -16
  44. package/docs/pages/patterns/intent-nesting.md +13 -1
  45. package/package.json +2 -2
  46. package/reserved-classes.json +3 -0
  47. package/src/css/components/accordion.css +7 -3
  48. package/src/css/components/alert.css +9 -1
  49. package/src/css/components/app-nav.css +2 -0
  50. package/src/css/components/badge.css +38 -11
  51. package/src/css/components/button.css +10 -2
  52. package/src/css/components/card.css +9 -0
  53. package/src/css/components/index.css +1 -0
  54. package/src/css/components/skeleton.css +11 -0
  55. package/src/css/components/tab.css +77 -0
  56. package/src/css/components/table.css +7 -1
  57. package/src/css/components/timeline.css +160 -0
  58. package/src/css/core/base.css +13 -2
  59. package/src/css/core/reset.css +5 -0
  60. package/src/css/core/theme.css +6 -1
  61. package/src/css/core/tokens.css +3 -3
  62. package/src/css/forms/choice-card.css +5 -2
  63. package/src/css/forms/control.css +12 -3
  64. package/src/css/forms/custom-select.css +1 -1
  65. package/src/css/typography/prose.css +4 -2
  66. package/src/tooling/design-tokens.js +2 -0
  67. package/src/tooling/theme-contrast.js +1 -1
@@ -58,28 +58,49 @@ date-calendar {
58
58
  --dp-accent: var(--primary);
59
59
  --dp-accent-fg: var(--primary-fg);
60
60
  --dp-radius: var(--radius);
61
+ --dp-focus: var(--focus);
62
+ --dp-focus-width: var(--focus-ring-width);
61
63
  /* Trigger glyph on the select chevron axis. */
62
64
  --dp-picker-button-size: calc(var(--control-pad-x) * 2 + 1em + var(--border-width) * 2);
63
65
  }
64
66
 
65
- .dp-calendar-header :where(button, select, input):focus-visible {
66
- border-color: var(--dp-border);
67
- outline: var(--focus-ring-width) solid var(--focus);
68
- outline-offset: calc(var(--focus-ring-width) * -1);
69
- box-shadow: none;
70
- }
71
-
72
- .dp-picker-button:focus-visible,
73
- .dp-day:focus-visible {
74
- outline-color: var(--focus);
67
+ .dp-picker-panel[popover] {
68
+ box-shadow: var(--shadow-popout);
75
69
  }
76
70
  ```
77
71
 
78
- The field is a plain `.input`, so the core inset focus outline already outranks
79
- the library's halo; the calendar's own controls paint a `--dp-accent` halo, so
80
- the two focus rules map them onto the core outline. The calendar popup is its own
72
+ The picker draws focus as an inset line, like the core, so `--dp-focus` and
73
+ `--dp-focus-width` are the whole focus mapping; the field itself is a plain
74
+ `.input` and keeps the core outline. The panel has no shadow token, so it takes
75
+ `--shadow-popout` directly. It opens as a popover, in the top layer,
76
+ so inside a modal, even in a scrolling body, it is neither clipped nor stacked
77
+ under the dialog. The calendar popup is its own
81
78
  element, so the `--dp-*` map is declared on `date-picker`/`date-calendar` rather
82
79
  than inherited from a wrapper.
80
+
81
+ The header month, year and arrows take host classes through `controlClasses`,
82
+ so they render as real Actual controls:
83
+
84
+ ```js
85
+ picker.controlClasses = { month: "select sm", year: "input sm", nav: "btn outline sm icon-only" };
86
+ ```
87
+
88
+ Set the defaults once for every picker and inline calendar. With the CDN script,
89
+ call the registered constructor after the deferred script has loaded:
90
+
91
+ ```js
92
+ customElements.get("date-picker").setDefaultControlClasses({
93
+ month: "select sm",
94
+ year: "input sm",
95
+ nav: "btn outline sm icon-only",
96
+ });
97
+ ```
98
+
99
+ With a bundler, import `setDefaultControlClasses` from `@lekoala/date-picker`.
100
+ An instance's `controlClasses` overrides only the supplied roles; omitted roles
101
+ follow the current defaults. Day cells and the field trigger stay on the
102
+ `--dp-*` tokens.
103
+
83
104
  As with the combobox, the bridge stays in docs/demo — it is a recipe, not package
84
105
  API, and pins no widget version.
85
106
 
@@ -0,0 +1,120 @@
1
+ # File upload
2
+
3
+ > An upload widget is not shipped by the framework — the native `.file` input stays the baseline. Compose Dropzone's rows from Actual components, or theme FilePond with Actual tokens.
4
+
5
+ The native input is the default: it submits with the form and needs no
6
+ JavaScript. Reach for an uploader when the product needs drag and drop,
7
+ previews, progress, or asynchronous and chunked uploads.
8
+
9
+ **Related terms:** file upload, uploader, file input, drag and drop, drop zone, dropzone, attachments, upload progress, file preview, FilePond.
10
+
11
+ ## Native baseline
12
+
13
+ ```html demo
14
+ <label class="field">
15
+ <span class="field-label">Profile picture</span>
16
+ <input class="file" type="file" accept="image/*" />
17
+ </label>
18
+ ```
19
+
20
+ See [Controls](controls.md#file) for what `.file` styles.
21
+
22
+ ## Dropzone: rows from Actual components
23
+
24
+ The [file upload template](../../demo/templates/file-upload.html) puts the
25
+ native input, [Dropzone](https://docs.dropzone.dev/) and FilePond side by side.
26
+ Dropzone owns drop, queue and requests; its stylesheet is not loaded. Its
27
+ `previewTemplate` is plain markup, so each file renders as a `.list-item`, and
28
+ Dropzone fills the `data-dz-*` slots:
29
+
30
+ ```html
31
+ <template id="upload-row">
32
+ <li class="list-item">
33
+ <span class="avatar"><span data-dz-ext aria-hidden="true"></span><img data-dz-thumbnail alt="" hidden></span>
34
+ <span class="list-item-content">
35
+ <strong class="list-item-title truncate" data-dz-name></strong>
36
+ <span class="list-item-text" data-dz-size></span>
37
+ <span class="list-item-text"><span class="danger intent-color" data-dz-errormessage></span></span>
38
+ <progress class="progress" value="0" max="100" data-dz-uploadprogress></progress>
39
+ </span>
40
+ <button class="close" type="button" aria-label="Remove file" data-dz-remove></button>
41
+ </li>
42
+ </template>
43
+ ```
44
+
45
+ ```js
46
+ const dropzone = new Dropzone(zone, {
47
+ url: "/upload",
48
+ clickable: zone.querySelector("button"), // a real button, not the whole zone
49
+ previewsContainer: "#upload-list", // a <ul class="list">
50
+ previewTemplate: document.getElementById("upload-row").innerHTML,
51
+ });
52
+ dropzone.on("success", (file) => file.previewElement.querySelector("progress").classList.add("success"));
53
+ ```
54
+
55
+ Dropzone sets the value of a `<progress>` slot, so `.progress` works as is.
56
+ Outcomes take intent classes from event listeners rather than styling
57
+ Dropzone's `dz-success` and `dz-error` classes. The thumbnail starts
58
+ `hidden` and a `thumbnail` listener reveals it; until then the avatar shows
59
+ the file extension.
60
+
61
+ The drop target is the one piece left to draw: a dashed `--border-control`
62
+ outline on `--surface-subtle`, with a `.dz-drag-hover` rule (Dropzone writes
63
+ the class while files hover the zone). Put a native `.file` input in the zone
64
+ for the no-JavaScript case and remove it at init, as the template does:
65
+ Dropzone appends its own hidden input to `<body>`.
66
+
67
+ ## FilePond: theme bridge
68
+
69
+ [FilePond v5](https://v5.filepond.com/) is a `<file-pond>` web component that
70
+ wraps a native input and renders its own UI in a shadow root. Its
71
+ `--default-*` properties inherit into that root, so the bridge is one rule:
72
+
73
+ ```html
74
+ <div class="field">
75
+ <label class="field-label" for="attachments">Attachments</label>
76
+ <file-pond>
77
+ <input class="file" id="attachments" type="file" name="attachments" multiple>
78
+ </file-pond>
79
+ </div>
80
+ ```
81
+
82
+ ```css
83
+ file-pond {
84
+ --default-color: var(--text);
85
+ --default-background-color: var(--surface-subtle);
86
+ --default-accent-color: var(--primary);
87
+ --default-accent-color-text: var(--primary-fg);
88
+ --default-border: var(--border-width) solid var(--border-control);
89
+ --default-border-radius: var(--radius);
90
+ --default-padding: var(--space-40);
91
+ --outline: var(--focus-ring-width) solid var(--focus);
92
+ display: block;
93
+ }
94
+ ```
95
+
96
+ ```js
97
+ import { defineFilePond } from "filepond";
98
+ import { locale } from "filepond/locales/en-gb.js";
99
+
100
+ defineFilePond({ locale });
101
+ ```
102
+
103
+ FilePond reads `color-scheme` for everything the map leaves out, so light,
104
+ dark and `data-theme` islands need no second rule. Font and line height
105
+ inherit from the page. `--outline` is not documented by FilePond: it is the
106
+ property every focus-visible outline inside the component reads, and mapping
107
+ it gives the browse button and entry buttons the framework focus line. The
108
+ host is `inline-block` by default; `display: block` makes the drop area span
109
+ its field. For deeper changes, FilePond exposes `::part()` hooks and a
110
+ template API; the template does not need them.
111
+
112
+ FilePond v5 is in beta: pin an exact version (`npm install filepond@beta`).
113
+
114
+ Both bridges stay in docs/demo — they are recipes, not package API.
115
+
116
+ ## Which one?
117
+
118
+ - A form that posts a few files: native `.file`.
119
+ - Drag and drop, previews and progress in your own markup: Dropzone with an Actual `previewTemplate`.
120
+ - A complete uploader UI (media previews, image editing, camera, chunked uploads): FilePond on the token bridge.
@@ -17,9 +17,11 @@ choice among a few on a shared track, use a
17
17
 
18
18
  Add `.join` to the wrapper that groups the controls. Use `.join-addon` for static prefix/suffix content such as currency symbols, units, or protocol text. Action buttons inside the group should use `.btn`. The wrapper should still carry `role="group"` with a label for accessibility.
19
19
 
20
- `.join` reshapes corners and shared edges; it does not unify the segments' treatments, and the children keep whatever classes they carry. Give them one variant family so the group reads as a single unit, and change a segment's variant only to mark state — a solid button among outlines for a pressed toggle. A group mixing `.btn`, `.btn outline` and `.btn soft` is valid markup that renders as three unrelated controls stuck together.
20
+ Each child keeps its own variant. Use the same variant across the group, and
21
+ change it only to mark state, such as a solid pressed toggle among outlines.
21
22
 
22
- When composing source files manually, import `components/join.css` after the controls it groups. `.join` writes child border-radius longhands directly so joined corners win at equal specificity.
23
+ When composing source files manually, import `components/join.css` after the
24
+ controls it groups so joined corners take precedence.
23
25
 
24
26
  ```html demo
25
27
  <div class="field">
@@ -172,9 +172,17 @@ A full form using the control classes, field wrappers, and form actions:
172
172
 
173
173
  ## Hooks
174
174
 
175
+ Set `--control-default-bg` on a theme or region for an inherited resting field
176
+ background shared by `.input`, `.textarea`, `.select` and external widget bridges.
177
+ Use `--control-bg` for a local field override; state rules still own readonly,
178
+ disabled and validation fills.
179
+
175
180
  Set `--control-hover-border` to tune the hover border of `.input` and `.textarea`.
176
181
  Set `--control-hover-bg` to keep a `.select` background steady on hover, or give
177
182
  it a stronger fill.
183
+ Set `--control-shadow` to give `.input`, `.textarea` and `.select` a resting
184
+ elevation (unset by default). It inherits, so a theme can set it once on its
185
+ root; keyboard focus and an open custom select keep it.
178
186
 
179
187
  ## Notes
180
188
 
@@ -33,9 +33,9 @@ the next card, belongs to the layout around it:
33
33
  A rule such as `.card + .card { margin-block-start: 2rem }` moves page layout
34
34
  into the component; put a composition around the cards instead.
35
35
 
36
- **A composition on a component takes over its default layout.** A component's
37
- own layout sits at zero specificity, so `<article class="card media">` lays out
38
- as a `.media` without an override, whatever the import order.
36
+ **A layout primitive replaces the component's default layout.** For example,
37
+ `<article class="card media">` keeps the card's appearance and uses `.media`
38
+ for its layout.
39
39
 
40
40
  **State uses the most semantic attribute; classes choose presentation.**
41
41
 
@@ -81,19 +81,6 @@ A component takes optional intent, variant and size classes:
81
81
  A modifier is a separate class that combines with others (`.btn.primary.soft`,
82
82
  not `.btn--primary`), and a part gets a prefixed class (`.alert-icon`,
83
83
  `.list-item-title`) only when its element does not already say what it is.
84
- There is no `__` or `--` in Actual's names, because:
85
-
86
- - **Modifiers are shared axes.** `.primary`, `.soft` and `.sm` mean the same
87
- thing on every component that supports them, so one class serves `.btn`,
88
- `.badge` and `.alert`. BEM names a modifier per block, which multiplies the
89
- vocabulary and keeps a custom intent such as `.tertiary` from working
90
- everywhere at once.
91
- - **State is not a modifier.** `disabled`, `aria-current` and `open` already
92
- name the state; a `--disabled` or `--active` class would duplicate them and
93
- drift out of sync.
94
- - **Elements come from HTML.** A card's `header` and `footer`, an avatar's
95
- `<img>` need no `__element` class; a prefixed class is kept for the parts
96
- HTML cannot name.
97
84
 
98
85
  Application CSS can use any convention, BEM included, alongside Actual's
99
86
  classes: `<article class="card pricing-plan pricing-plan--featured">`.
@@ -102,14 +89,19 @@ classes: `<article class="card pricing-plan pricing-plan--featured">`.
102
89
 
103
90
  Components are semantic boxes: `.btn`, `.badge`, `.alert`, `.card`, `.avatar`, etc. Each component owns its intrinsic layout and visual defaults.
104
91
 
92
+ Components are replaceable implementations. If a built-in component does more
93
+ than your application needs, omit its module and write your own. Keep the
94
+ semantic markup, state conventions, and shared design tokens where they fit.
95
+ See [Replace a component, keep the conventions](../guides/modular-import.md#replace-a-component-keep-the-conventions)
96
+ for a minimal Steps implementation.
97
+
105
98
  ## Intents
106
99
 
107
- `.primary`, `.secondary`, `.success`, `.warning`, `.danger` do not style elements directly. They only expose `--intent` and `--intent-fg`. Components and variants decide how to consume them.
100
+ `.primary`, `.secondary`, `.success`, `.warning`, and `.danger` choose a color
101
+ role. The component and variant decide how to display it.
108
102
 
109
- Intent classes define the current `--intent` value; they do not form a
110
- general-purpose color utility system. Use `.intent-color` when a simple element
111
- should consume the current intent as its foreground color. It works with an
112
- intent on the same element or inherited from an ancestor.
103
+ For plain text or an icon, add `.intent-color` to use the intent as its text
104
+ color. The intent can be on that element or an ancestor.
113
105
 
114
106
  ```html demo
115
107
  <button class="btn primary">Primary</button>
@@ -121,9 +113,7 @@ intent on the same element or inherited from an ancestor.
121
113
  </span>
122
114
  ```
123
115
 
124
- There is no `.btn-primary` or `.badge-success`. Intents are generic and reusable across any component that supports them.
125
-
126
- Components fall back to their own default intent when no intent class is set. Buttons, badges, and alerts use the neutral palette (`--neutral` / `--neutral-fg`) by default.
116
+ Without an intent class, components use their own default palette.
127
117
 
128
118
  Custom intents need no framework support — define `--intent` and `--intent-fg`
129
119
  (and `--intent-soft-fg` when the custom role needs its own soft foreground) on a
@@ -144,7 +134,8 @@ class:
144
134
 
145
135
  ## Variants
146
136
 
147
- `.solid`, `.soft`, `.outline`, `.surface` define the visual treatment by setting `--ui-bg`, `--ui-fg`, `--ui-border`. Components consume these tokens with sensible fallbacks. Interactive components also set a `--ui-hover-bg` recipe that their hover rule reads.
137
+ `.solid`, `.soft`, `.outline`, and `.surface` choose the visual treatment:
138
+ filled, tinted, outlined, or on the page surface.
148
139
 
149
140
  `.btn` defaults to `.solid`; `.badge` and `.alert` default to `.soft`.
150
141
 
@@ -162,37 +153,20 @@ class:
162
153
 
163
154
  ## Size and density
164
155
 
165
- `.sm` and `.lg` mean one size role below or above a component's natural size.
166
- Size names are shared roles, not shared measurements. Each participating
167
- component family maps them to its own optical scale: badges use `xs / sm / md`,
168
- while controls use `sm / md / lg`. Components without an explicit mapping do
169
- not change.
170
-
171
- A size role is applied to the component that participates in the scale and
172
- never styles arbitrary descendants. It propagates through token inheritance,
173
- though: components in the shared control scale set local `--control-size` and
174
- `--control-font-size`, and descendants consume them by their own rules. That is
175
- how `.field sm`, `.input-icon sm`, `.join sm`, and `.flyout sm` size the
176
- controls inside them, while a bare `.sm` on a plain element does nothing.
177
-
178
- `.compact` and `.spacious` establish inherited density tokens. Density arranges
179
- how tightly UI sits — spacing and component geometry — while font size and
180
- icon size stay unchanged. `.tight` and `.loose` change the rhythm (`--gap`)
181
- alone. Participation is opt-in, and a component only joins
182
- where density has an effect independent from its optical size: if the result is
183
- merely that the component looks smaller or larger, that is size, not density.
184
-
185
- Density participation takes three levels:
186
-
187
- - **Geometry + rhythm** — controls and their wrappers (`.field`, `.join`,
188
- `.flyout`, …). Height, padding, and gap respond; typography is untouched.
189
- - **Rhythm only** — content rows and shells such as `.list`. Spacing tightens
190
- (`--list-item-gap: var(--gap)`), but the structural size stays stable.
191
- - **No density effect** — components whose geometry is intrinsic to their
192
- content (`.badge`, `.avatar`, `.spinner`, `.rating`, `.key`, prose, inline
193
- `.choice`/`.switch`). Their optical size belongs to `sm`/`lg` or local hooks.
194
-
195
- As inherited contexts, one class tightens or loosens the whole subtree:
156
+ - **Size:** `.sm` and `.lg` change a component's text and geometry. Each
157
+ component has its own scale; the same size name does not mean the same
158
+ dimensions everywhere.
159
+ - **Density:** `.compact` and `.spacious` change spacing and control geometry
160
+ throughout a region, keeping text and icons at the same size.
161
+ - **Rhythm:** `.tight` and `.loose` change only the inherited gap.
162
+
163
+ Apply size to a supported component or control wrapper. For example,
164
+ `.field sm`, `.input-icon sm`, `.join sm`, and `.flyout sm` size the controls
165
+ inside them. `.sm` on a plain element has no effect.
166
+
167
+ Density affects controls and layout spacing. Badges, avatars, spinners,
168
+ ratings, keys, prose, and inline choices keep their own size. One density
169
+ class applies to the whole subtree:
196
170
 
197
171
  ```html demo
198
172
  <div class="compact stack">
@@ -223,12 +197,8 @@ affect the same dimension:
223
197
  </div>
224
198
  ```
225
199
 
226
- The density tokens are `--gap`, `--density-space`, `--control-size`, and
227
- `--control-pad-x`.
228
- Components consume the dimensions that make sense for them and opt out of the
229
- rest. The absolute `--space-*` scale is not rebound by density scopes.
230
- Components with bespoke geometry (`.badge`, `.avatar`,
231
- `.spinner`, `.rating`) own their local `.sm`/`.lg` mappings.
200
+ Density leaves the absolute `--space-*` scale unchanged. See
201
+ [Control tokens](tokens.md#controls) to customize the shared scale.
232
202
 
233
203
  `.compact` also remains a meaningful local modifier for `.card` and `.table`.
234
204
  On those components it tightens their own padding and establishes the compact
@@ -1,8 +1,7 @@
1
1
  # Theming
2
2
 
3
- Find the right lever when you want to change how a component or layout looks, without knowing in advance which custom property to use.
4
-
5
- This is a problem-oriented index. It maps common intents to the public hooks and primitives that express them, then points to the canonical section. It is not a catalogue of every variable — the CSS source remains canonical for exact defaults and fallback chains. See the tokens page, Public surface section, for the public/internal rule.
3
+ Find a common customization below, then follow the reference for examples and
4
+ hook details. See [Tokens](tokens.md) for global settings and the theme contract.
6
5
 
7
6
  ## I want to…
8
7
 
@@ -64,19 +63,45 @@ Change `--switch-width`, `--switch-block-size`, and `--switch-knob-margin`; knob
64
63
 
65
64
  Set `--disabled-opacity`. All disabled-prone components — buttons, tabs, menu items, badges, avatars, choice cards, native inputs, and range sliders — read it for their dimmed state.
66
65
 
66
+ ### Customize focus beyond the ring / focus background, text and border
67
+
68
+ Use an application class with `:focus-visible` to change a button's fill, text,
69
+ and border while keeping its framework outline. Load the rule after Actual CSS:
70
+
71
+ ```css
72
+ .settings-action.btn:focus-visible:not(:where(:disabled, [aria-disabled="true"])) {
73
+ background: var(--surface-solid);
74
+ color: var(--surface-solid-fg);
75
+ border-color: var(--focus);
76
+ /* Hover paints an inset shadow over the background. */
77
+ --btn-hover-overlay: transparent;
78
+ }
79
+ ```
80
+
81
+ ```html
82
+ <button class="btn primary settings-action" type="button">Settings</button>
83
+ ```
84
+
85
+ Focus and hover can be active together. The selector takes precedence over the
86
+ generic hover fill; `--btn-hover-overlay` removes its extra tint while
87
+ preserving any `--btn-shadow` elevation. Check keyboard focus both with and
88
+ without the pointer over the button, in each color scheme and in forced colors.
89
+ Keep the outline visible against the surrounding surface when changing colors.
90
+
91
+ → [Button hooks](../components/button.md#css-hooks) · [Focus tokens](./tokens.md#color)
92
+
67
93
  ### Keep bare native controls on-theme / accent-color
68
94
 
69
- Native controls that no component class restyles — a bare checkbox, radio, range, or `<progress>` — follow the theme through `accent-color: var(--primary)`, declared on `:root` and every `[data-theme]` island so each island recomputes it from its own palette. Component classes (`.check`, `.radio`, `.range`) paint their own rendering and do not read it.
95
+ Bare checkboxes, radios, ranges, and `<progress>` follow the theme through
96
+ `accent-color: var(--primary)`. Styled controls such as `.check`, `.radio`,
97
+ and `.range` use their own appearance.
70
98
 
71
99
  → Forms · Overview · Foundations · Tokens (theme contract)
72
100
 
73
101
  ### Store a theme name without applying it
74
102
 
75
- `data-theme` is an active theme boundary on every element that carries it, not
76
- a generic storage attribute. Use a different name such as `data-theme-value`,
77
- or a form control's `value`, when the element should only hold a theme name.
78
- Apply `data-theme` deliberately when that element and its subtree should paint
79
- with the selected palette — a theme swatch is a useful example.
103
+ `data-theme` applies a theme to the element and its subtree. To store a theme
104
+ name without applying it, use `data-theme-value` or a form control's `value`.
80
105
 
81
106
  ### Loading / busy overlay on a container
82
107
 
@@ -147,13 +172,10 @@ well as color.
147
172
 
148
173
  ### Dark mode toggle / theme switcher / remember the user's choice
149
174
 
150
- Actual CSS ships the mechanism, not the control. Without `data-theme` the page
151
- follows the OS; `data-theme="light"` or `"dark"` on `<html>` forces a scheme,
152
- and removing the attribute returns to the OS. The switcher UI and where the
153
- choice is stored belong to the application; a page with no setting already
154
- follows the OS. Apply a stored choice from an inline script in `<head>` so the
155
- first paint does not flash the OS scheme. The demo's theme picker is an
156
- inspection tool, not a component to copy.
175
+ The default theme follows the OS. Set `data-theme="light"` or `"dark"` on
176
+ `<html>` to force a scheme; remove the attribute to follow the OS again.
177
+ Build the switcher and store the preference in application code. Apply a saved
178
+ choice from an inline script in `<head>` to avoid a flash of the wrong scheme.
157
179
 
158
180
  ### Force light or dark on a theme that has both / theme and color scheme
159
181
 
@@ -206,6 +228,25 @@ step per role rather than importing the scale.
206
228
 
207
229
  → Foundations · Tokens (theme contract) · Guides · Tailwind (Map the palette to theme roles)
208
230
 
231
+ ### Use a custom font / webfont / typeface with a theme
232
+
233
+ Load fonts in the application stylesheet with `@font-face` or a font service.
234
+ Set `--font-sans` and `--font-mono` on `:root` so the type stays consistent
235
+ across theme changes and islands. Set a separate heading face directly in
236
+ application CSS:
237
+
238
+ ```css
239
+ :root {
240
+ --font-sans: "Space Grotesk Variable", system-ui, sans-serif;
241
+ }
242
+
243
+ :is(h1, h2) {
244
+ font-family: "Archivo Black", var(--font-sans);
245
+ }
246
+ ```
247
+
248
+ → Examples · Neo-brutalist
249
+
209
250
  ### Use or adapt a preset palette
210
251
 
211
252
  `src/css/themes/` holds example palettes (`ocean`, `spruce`, `neon`, `brutalist`, …) as
@@ -213,13 +254,9 @@ reference material to copy into your own `[data-theme]` island — they are demo
213
254
  assets, not package entrypoints. Each sets the intent/surface/text tokens and
214
255
  lets the core derive everything else.
215
256
 
216
- The `bootstrap-v6` example follows Bootstrap 6's blue palette, stronger subtle
217
- surfaces, filled badges, and steady select hover; its focus is the core solid
218
- line. Use `.badge.soft` for a subtle badge. It is a visual theme, not a
219
- Bootstrap compatibility layer. The `gradient` example keeps a Bootstrap 4 style
220
- outer halo on focused fields, for comparison. The `material` example restyles
221
- fields as filled underlines with pill buttons — tokens plus three small rules,
222
- and `.join` still needs no adaptation. The `glass` example paints translucent
223
- surfaces over its own backdrop: it sets `--surface-opaque` and
224
- `--surface-solid-fg` to opaque values, raises `--soft-bg-mix` so soft fills stay
225
- light over glass, and adds the blur and an opaque busy veil as small rules.
257
+ - `gradient`: outer focus halos on fields.
258
+ - `neo-brutalist`: hard shadows, pastel fills, and plus-shaped accordion
259
+ markers. Use it as a page skin: its rules cross nested theme boundaries.
260
+ - `material`: filled underline fields and pill buttons.
261
+ - `glass`: translucent surfaces over a backdrop. Keep `--surface-opaque` and
262
+ `--surface-solid-fg` opaque, and check soft fills against the actual backdrop.