@codenhub/styles 0.1.0 → 0.1.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.
- package/README.md +7 -69
- package/dist/aesthetics/chunky-tile.css +1 -1
- package/dist/aesthetics/index.css +1 -1
- package/dist/components.css +1 -1
- package/dist/index.css +1 -1
- package/dist/native.css +1 -1
- package/dist/theme.css +1 -1
- package/dist/tw/aesthetics/chunky-tile.css +4 -2
- package/dist/tw/box.css +21 -0
- package/dist/tw/components/button.css +23 -3
- package/dist/tw/components/form.css +0 -2
- package/dist/tw/components/index.css +16 -6
- package/dist/tw/components/surface.css +29 -5
- package/dist/tw/elevation.css +14 -7
- package/dist/tw/index.css +20 -5
- package/dist/tw/intent.css +20 -0
- package/dist/tw/native.css +4 -20
- package/dist/tw/reset.css +20 -33
- package/dist/tw/theme.css +12 -7
- package/dist/tw/utilities/content.css +14 -2
- package/docs/accessibility.md +58 -48
- package/docs/changelog/0.1.0.md +37 -0
- package/docs/changelog/0.1.1.md +10 -0
- package/docs/changelog/index.md +10 -0
- package/docs/concepts.md +20 -46
- package/docs/index.md +18 -45
- package/docs/integrating/astro.md +13 -7
- package/docs/integrating/index.md +25 -16
- package/docs/integrating/nextjs.md +31 -8
- package/docs/integrating/svelte.md +14 -8
- package/docs/integrating/tailwind.md +31 -15
- package/docs/integrating/vue.md +13 -7
- package/docs/setup.md +35 -55
- package/docs/usage/aesthetics.md +30 -107
- package/docs/usage/buttons.md +19 -35
- package/docs/usage/composing.md +25 -100
- package/docs/usage/content-and-layout.md +56 -81
- package/docs/usage/customizing.md +25 -90
- package/docs/usage/feedback.md +11 -49
- package/docs/usage/forms.md +16 -58
- package/docs/usage/index.md +9 -17
- package/docs/usage/theming.md +25 -81
- package/docs/usage/tooltips.md +15 -21
- package/llms-full.txt +1060 -1506
- package/package.json +121 -44
package/docs/usage/feedback.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Feedback
|
|
3
3
|
description: Alert, badge, loader, skeleton, and progress class reference.
|
|
4
|
+
order: 7
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Feedback
|
|
@@ -32,11 +33,7 @@ Activity indicator modifier classes compose with `.loader`:
|
|
|
32
33
|
| `.bars-wave` | Three vertical bars scaling in a wave. |
|
|
33
34
|
| `.pulse-ring` | Two concentric rings pulsing outward. |
|
|
34
35
|
|
|
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).
|
|
36
|
+
These variants retain their embedded SVG animations normally. Under `prefers-reduced-motion: reduce`, loader CSS substitutes a corresponding static mask. This fallback is part of focused loader, button, and components imports; it does not depend on the global reset. See [Accessibility](../accessibility.md).
|
|
40
37
|
|
|
41
38
|
Loader size modifiers:
|
|
42
39
|
|
|
@@ -46,27 +43,17 @@ Loader size modifiers:
|
|
|
46
43
|
| `.sm` | Small (`1.5rem`). |
|
|
47
44
|
| `.lg` | Large (`2.5rem`). |
|
|
48
45
|
|
|
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.
|
|
46
|
+
Alerts, badges, progress bars, skeletons, and loaders accept `.primary`, `.secondary`, `.success`, `.warning`, `.destructive`, `.danger`, `.error`, and `.info`. Without an intent, they use the text palette, except `.loader`, which keeps `currentColor` so it matches whatever content surrounds it.
|
|
53
47
|
|
|
54
|
-
Skeletons, loaders, progress bars, and dividers are indicators. They read
|
|
55
|
-
intent but ignore fill and edge [presentation](./composing.md#presentation).
|
|
48
|
+
Skeletons, loaders, progress bars, and dividers are indicators. They read intent but ignore fill and edge [presentation](./composing.md#presentation).
|
|
56
49
|
|
|
57
50
|
```html
|
|
58
|
-
<span class="loader success" aria-hidden="true"></span>
|
|
59
|
-
<span class="skeleton info"></span>
|
|
51
|
+
<span class="loader success" aria-hidden="true"></span> <span class="skeleton info"></span>
|
|
60
52
|
```
|
|
61
53
|
|
|
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.
|
|
54
|
+
`.icon` is a subclass of `.alert`. When applied as `.alert.icon`, it increases the left padding and adds an embedded SVG. Success, warning, and destructive intents use corresponding symbols; other intents use the information symbol.
|
|
66
55
|
|
|
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.
|
|
56
|
+
Alerts and badges read the shared [presentation](./composing.md#presentation) classes. Without one they use a tinted surface, intent-colored text, and a mixed intent border.
|
|
70
57
|
|
|
71
58
|
## Example
|
|
72
59
|
|
|
@@ -84,34 +71,9 @@ mixed intent border.
|
|
|
84
71
|
<span class="loader bars-wave" aria-hidden="true"></span>
|
|
85
72
|
<span class="loader pulse-ring sm" aria-hidden="true"></span>
|
|
86
73
|
<span class="loader dots-grow lg" aria-hidden="true"></span>
|
|
87
|
-
<div
|
|
88
|
-
|
|
89
|
-
|
|
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>
|
|
74
|
+
<div class="progress" role="progressbar" aria-label="Upload progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="64" style="--progress-value: 64%"></div>
|
|
75
|
+
<div class="progress secondary active" role="progressbar" aria-label="Upload progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="64" style="--progress-value: 64%"></div>
|
|
76
|
+
<div class="progress info indeterminate" role="progressbar" aria-label="Loading" aria-valuemin="0" aria-valuemax="100"></div>
|
|
112
77
|
```
|
|
113
78
|
|
|
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).
|
|
79
|
+
Add `role="status"` or `role="alert"` to alerts based on announcement urgency, mark decorative loading visuals with `aria-hidden="true"`, and use semantic progress elements or ARIA values when numeric progress must be announced; see [Accessibility](../accessibility.md).
|
package/docs/usage/forms.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Forms
|
|
3
3
|
description: Field, text control, and toggle class reference.
|
|
4
|
+
order: 6
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Forms
|
|
@@ -25,19 +26,11 @@ description: Field, text control, and toggle class reference.
|
|
|
25
26
|
|
|
26
27
|
## Icons
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
`background-image` — a `data:` URI, which cannot read `currentColor` or a
|
|
30
|
-
custom property, so every glyph shipped a light and a dark copy and a theme
|
|
31
|
-
selector chose between them. That put icon artwork, and the package's only
|
|
32
|
-
theme-by-selector branch, inside a CSS-only design system whose glyphs did
|
|
33
|
-
not fit every aesthetic. Icons are the consumer's to choose now.
|
|
29
|
+
No icon is shipped for text inputs — that's what this section covers. It used to paint one per input type as a `background-image` — a `data:` URI, which cannot read `currentColor` or a custom property, so every glyph shipped a light and a dark copy and a theme selector chose between them. That put icon artwork, and the package's only theme-by-selector branch, inside a CSS-only design system whose glyphs did not fit every aesthetic. Icons for `.input-group` are the consumer's to choose now.
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
and the control inside it goes flush, so the boundary is drawn once. Any
|
|
38
|
-
icon element works, placed before the control for a leading icon or after it
|
|
39
|
-
for a trailing one: an inline `<svg>`, an `<img>`, or a class from an icon
|
|
40
|
-
set such as `@codenhub/icons`.
|
|
31
|
+
This is separate from the toggle marks below and the alert icons in [Feedback](./feedback.md#example): those are small, fixed, built-in glyphs — not a per-input icon system — and aren't affected by this change.
|
|
32
|
+
|
|
33
|
+
`.input-group` is the wrapper for a control that carries one. It owns the field box — border, radius, fill, focus ring, invalid and disabled state — and the control inside it goes flush, so the boundary is drawn once. Any icon element works, placed before the control for a leading icon or after it for a trailing one: an inline `<svg>`, an `<img>`, or a class from an icon set such as `@codenhub/icons`.
|
|
41
34
|
|
|
42
35
|
```html
|
|
43
36
|
<label class="field">
|
|
@@ -59,22 +52,13 @@ set such as `@codenhub/icons`.
|
|
|
59
52
|
</label>
|
|
60
53
|
```
|
|
61
54
|
|
|
62
|
-
The group reads intent and both [presentation](./composing.md#presentation)
|
|
63
|
-
axes the same way a lone `.ipt` does — `.input-group.soft.edgeless` is the
|
|
64
|
-
sunk variant, `.input-group.primary` colors the boundary — and follows
|
|
65
|
-
whichever [aesthetic](./aesthetics.md) is in scope. `aria-invalid` or
|
|
66
|
-
`disabled` on the control inside propagates to the group; so does either on
|
|
67
|
-
the group itself. Focus is shown with `:focus-within`, so unlike a lone
|
|
68
|
-
field the ring also appears on a mouse click.
|
|
55
|
+
The group reads intent and both [presentation](./composing.md#presentation) axes the same way a lone `.ipt` does — `.input-group.soft.edgeless` is the sunk variant, `.input-group.primary` colors the boundary — and follows whichever [aesthetic](./aesthetics.md) is in scope. `aria-invalid` or `disabled` on the control inside propagates to the group; so does either on the group itself. Focus is shown with `:focus-within`, so unlike a lone field the ring also appears on a mouse click.
|
|
69
56
|
|
|
70
|
-
Non-icon input types keep the browser's native `date` and `datetime-local`
|
|
71
|
-
pickers. WebKit's native `search` decorations are still suppressed on
|
|
72
|
-
`.text-control` to keep them from overlapping the value.
|
|
57
|
+
Non-icon input types keep the browser's native `date` and `datetime-local` pickers. WebKit's native `search` decorations are still suppressed on `.text-control` to keep them from overlapping the value.
|
|
73
58
|
|
|
74
59
|
## Toggles
|
|
75
60
|
|
|
76
|
-
`.checkbox`, `.radio`, and `.switch` accept the same intent classes as
|
|
77
|
-
buttons to set the checked color:
|
|
61
|
+
`.checkbox`, `.radio`, and `.switch` accept the same intent classes as buttons to set the checked color:
|
|
78
62
|
|
|
79
63
|
| Class | Meaning |
|
|
80
64
|
| ----------------------------------- | ----------------------- |
|
|
@@ -86,39 +70,22 @@ buttons to set the checked color:
|
|
|
86
70
|
| `.destructive`, `.danger`, `.error` | Destructive color. |
|
|
87
71
|
| `.info` | Info color. |
|
|
88
72
|
|
|
89
|
-
All three toggles rest at `.solid`, and **`.ghost` is not supported on any of
|
|
90
|
-
them.** An unchecked ghost toggle is the silhouette every toggle already
|
|
91
|
-
has, and a checked one is a mark on nothing — a tick floating on the page, a
|
|
92
|
-
dot with no ring around it. A container that cascades `.ghost` onto a
|
|
93
|
-
toggle is floored rather than obeyed.
|
|
73
|
+
All three toggles rest at `.solid`, and **`.ghost` is not supported on any of them.** An unchecked ghost toggle is the silhouette every toggle already has, and a checked one is a mark on nothing — a tick floating on the page, a dot with no ring around it. A container that cascades `.ghost` onto a toggle is floored rather than obeyed.
|
|
94
74
|
|
|
95
|
-
Presentation decides the fill in both states. Being checked lifts the cap
|
|
96
|
-
rather than pinning a fill, so the class still chooses:
|
|
75
|
+
Presentation decides the fill in both states. Being checked lifts the cap rather than pinning a fill, so the class still chooses:
|
|
97
76
|
|
|
98
77
|
| Toggle | unchecked | checked |
|
|
99
78
|
| ----------------- | --------------- | ------------------------------- |
|
|
100
79
|
| `.solid`, default | 20%, switch 40% | 100%, mark in the contrast tone |
|
|
101
80
|
| `.soft` | 12% | 12%, mark in the strong tone |
|
|
102
81
|
|
|
103
|
-
A checked checkbox and a checked switch cut their mark out of that plate. A
|
|
104
|
-
checked radio thickens its ring to twice the resting line and takes the
|
|
105
|
-
intent whole on it, so `.radio.soft` is the classic ring-and-dot radio and
|
|
106
|
-
`.radio.solid` is a filled circle whose dot stays readable — the mark
|
|
107
|
-
follows the plate rather than being pinned to the intent color.
|
|
82
|
+
A checked checkbox and a checked switch cut their mark out of that plate. A checked radio thickens its ring to twice the resting line and takes the intent whole on it, so `.radio.soft` is the classic ring-and-dot radio and `.radio.solid` is a filled circle whose dot stays readable — the mark follows the plate rather than being pinned to the intent color.
|
|
108
83
|
|
|
109
84
|
## Text controls
|
|
110
85
|
|
|
111
|
-
Text controls also take intent, which colors the resting border and the
|
|
112
|
-
focus-visible border, and both [presentation](./composing.md#presentation)
|
|
113
|
-
axes. `.ghost` fills nothing, `.soft` takes `12%`, and `.solid` takes `20%`
|
|
114
|
-
— quiet enough that typed text still reads on it, and ordered so the louder
|
|
115
|
-
name draws the stronger tint. None of them touches the line.
|
|
86
|
+
Text controls also take intent, which colors the resting border and the focus-visible border, and both [presentation](./composing.md#presentation) axes. `.ghost` fills nothing, `.soft` takes `12%`, and `.solid` takes `20%` — quiet enough that typed text still reads on it, and ordered so the louder name draws the stronger tint. None of them touches the line.
|
|
116
87
|
|
|
117
|
-
The boundary is the edge axis's, and it splits the same way. A container's
|
|
118
|
-
`.edgeless` is floored, so a toolbar cannot leave a field with no mark of
|
|
119
|
-
where typing goes. `.edgeless` on the control itself is honoured, which is
|
|
120
|
-
how the borderless field is spelled — it does not meet WCAG 1.4.11 at rest,
|
|
121
|
-
so it is opt-in and never a default, and the focus ring still shows.
|
|
88
|
+
The boundary is the edge axis's, and it splits the same way. A container's `.edgeless` is floored, so a toolbar cannot leave a field with no mark of where typing goes. `.edgeless` on the control itself is honoured, which is how the borderless field is spelled — it does not meet WCAG 1.4.11 at rest, so it is opt-in and never a default, and the focus ring still shows.
|
|
122
89
|
|
|
123
90
|
```html
|
|
124
91
|
<input class="ipt success" placeholder="Valid" />
|
|
@@ -133,11 +100,7 @@ so it is opt-in and never a default, and the focus ring still shows.
|
|
|
133
100
|
</div>
|
|
134
101
|
```
|
|
135
102
|
|
|
136
|
-
`.surface` is a public low-level utility. It is the box every container in
|
|
137
|
-
the package composes: ghost, edged, surface radius, and the two slots only
|
|
138
|
-
a surface resolves — the backdrop filter and the complete surface shadow.
|
|
139
|
-
Use it to paint a container the package does not ship, under whichever
|
|
140
|
-
aesthetic is in scope. Prefer `.card` or `.panel` when they fit.
|
|
103
|
+
`.surface` is a public low-level utility. It is the box every container in the package composes: ghost, edged, surface radius, and the two slots only a surface resolves — the backdrop filter and the complete surface shadow. Use it to paint a container the package does not ship, under whichever aesthetic is in scope. Prefer `.card` or `.panel` when they fit.
|
|
141
104
|
|
|
142
105
|
```html
|
|
143
106
|
<div class="surface glass">Blurred, translucent, glass corners</div>
|
|
@@ -145,11 +108,7 @@ aesthetic is in scope. Prefer `.card` or `.panel` when they fit.
|
|
|
145
108
|
<div class="surface primary solid">Any intent, any presentation</div>
|
|
146
109
|
```
|
|
147
110
|
|
|
148
|
-
`.text-control` is a public low-level utility from the form entrypoint. It
|
|
149
|
-
provides the shared control dimensions, border, placeholder, focus-visible,
|
|
150
|
-
invalid, and disabled styles composed by `ipt`, `textarea`, and `select`.
|
|
151
|
-
Use it for custom text-like controls; prefer those higher-level utilities
|
|
152
|
-
when they fit.
|
|
111
|
+
`.text-control` is a public low-level utility from the form entrypoint. It provides the shared control dimensions, border, placeholder, focus-visible, invalid, and disabled styles composed by `ipt`, `textarea`, and `select`. Use it for custom text-like controls; prefer those higher-level utilities when they fit.
|
|
153
112
|
|
|
154
113
|
## Example
|
|
155
114
|
|
|
@@ -173,5 +132,4 @@ when they fit.
|
|
|
173
132
|
</label>
|
|
174
133
|
```
|
|
175
134
|
|
|
176
|
-
Use labels, `type`, validation logic, `aria-describedby`, and error message
|
|
177
|
-
relationships; see [Accessibility](../accessibility.md).
|
|
135
|
+
Use labels, `type`, validation logic, `aria-describedby`, and error message relationships; see [Accessibility](../accessibility.md).
|
package/docs/usage/index.md
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Overview
|
|
3
3
|
description: Guides for composing axes, theming, customizing, aesthetics, and each component family.
|
|
4
|
+
group: Usage
|
|
5
|
+
order: 3
|
|
4
6
|
---
|
|
5
7
|
|
|
6
8
|
# Usage
|
|
7
9
|
|
|
8
|
-
These guides assume the [Concepts](../concepts.md) mental model: intent,
|
|
9
|
-
presentation, and aesthetic as three independent axes, resolved through
|
|
10
|
-
tokens a component reads.
|
|
10
|
+
These guides assume the [Concepts](../concepts.md) mental model: intent, presentation, and aesthetic as three independent axes, resolved through tokens a component reads.
|
|
11
11
|
|
|
12
|
-
- [Composing](./composing.md): Combining the three axes on a component, the
|
|
13
|
-
axis-support matrix, and elevation modifiers.
|
|
12
|
+
- [Composing](./composing.md): Combining the three axes on a component, the axis-support matrix, and elevation modifiers.
|
|
14
13
|
- [Theming](./theming.md): The color, intent, and foundation token reference.
|
|
15
|
-
- [Customizing](./customizing.md): The presentation and material token
|
|
16
|
-
|
|
17
|
-
- [Aesthetics](./aesthetics.md): Each shipped aesthetic in depth, including
|
|
18
|
-
its documented exceptions.
|
|
14
|
+
- [Customizing](./customizing.md): The presentation and material token reference, aesthetic knobs, and defining a custom intent.
|
|
15
|
+
- [Aesthetics](./aesthetics.md): Each shipped aesthetic in depth, including its documented exceptions.
|
|
19
16
|
- [Buttons](./buttons.md)
|
|
20
17
|
- [Forms](./forms.md)
|
|
21
18
|
- [Feedback](./feedback.md)
|
|
22
19
|
- [Tooltips](./tooltips.md)
|
|
23
|
-
- [Content and layout](./content-and-layout.md): Layout helpers, tables,
|
|
24
|
-
quotes, code, surfaces, and typography utilities.
|
|
20
|
+
- [Content and layout](./content-and-layout.md): Layout helpers, tables, quotes, code, surfaces, and typography utilities.
|
|
25
21
|
|
|
26
22
|
## Supported surface
|
|
27
23
|
|
|
28
|
-
A class, component, and axis combination is supported when this documentation
|
|
29
|
-
describes it and the package playground demonstrates it. Undocumented and
|
|
30
|
-
undemonstrated combinations may still produce CSS, but are not maintained
|
|
31
|
-
behavior. Playground variant matrices are the exhaustive demonstrations; small
|
|
32
|
-
examples elsewhere illustrate usage without widening that contract.
|
|
24
|
+
A class, component, and axis combination is supported when this documentation describes it and the package playground demonstrates it. Undocumented and undemonstrated combinations may still produce CSS, but are not maintained behavior. Playground variant matrices are the exhaustive demonstrations; small examples elsewhere illustrate usage without widening that contract.
|
package/docs/usage/theming.md
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Theming
|
|
3
3
|
description: The color, intent, and foundation token reference.
|
|
4
|
+
order: 2
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Theming
|
|
7
8
|
|
|
8
|
-
Color tokens are how you restyle the palette; see
|
|
9
|
-
[Concepts → Theme selection](../concepts.md#theme-selection) for how a theme
|
|
10
|
-
is chosen. Intent tokens are how a component reads that palette once an
|
|
11
|
-
intent class is applied. Foundation tokens are the shared layout, shape, and
|
|
12
|
-
motion defaults underneath everything.
|
|
9
|
+
Color tokens are how you restyle the palette; see [Concepts → Theme selection](../concepts.md#theme-selection) for how a theme is chosen. Intent tokens are how a component reads that palette once an intent class is applied. Foundation tokens are the shared layout, shape, and motion defaults underneath everything.
|
|
13
10
|
|
|
14
11
|
## Color tokens
|
|
15
12
|
|
|
16
|
-
Each color token holds both of its theme values at once through
|
|
17
|
-
|
|
13
|
+
Each color token holds both of its theme values at once through `light-dark()`, and the element's `color-scheme` picks one.
|
|
14
|
+
|
|
15
|
+
Every row is an override point: set it on `:root` to retheme globally, or on any element to retheme that subtree. The `-hover`, `-subtle`, `-strong`, and `-contrast` rows are companion tones wired into the intent slots, so overriding a base color such as `--color-primary` on its own does not shift its companions — retheme the whole family. The `text` family has no `-subtle` row: the neutral intent draws its subtle tone from `--color-surface`.
|
|
18
16
|
|
|
19
17
|
```html
|
|
20
18
|
<section data-theme="dark">
|
|
@@ -44,7 +42,6 @@ Each color token holds both of its theme values at once through
|
|
|
44
42
|
| `--color-text-secondary` | Secondary text color. |
|
|
45
43
|
| `--color-text-contrast` | Readable color on top of a full fill of `--color-text`. A checked toggle prints it. |
|
|
46
44
|
| `--color-text-hover` | Text hover state. |
|
|
47
|
-
| `--color-text-subtle` | Low-emphasis companion tone for text. Use as soft surface or subtle background. |
|
|
48
45
|
| `--color-text-strong` | High-emphasis companion tone for text. Use as readable text, icon, or border on subtle surfaces. |
|
|
49
46
|
| `--color-tooltip` | Tooltip bubble plate with no intent. Chosen per theme rather than derived: near-white in light, mid grey in dark. |
|
|
50
47
|
| `--color-tooltip-contrast` | Ink on `--color-tooltip`. |
|
|
@@ -69,20 +66,11 @@ Each color token holds both of its theme values at once through
|
|
|
69
66
|
| `--color-info-subtle` | Low-emphasis companion tone for info. |
|
|
70
67
|
| `--color-info-strong` | High-emphasis companion tone for info. |
|
|
71
68
|
|
|
72
|
-
> **Intent token contract**: color intent tokens own meaning and tone
|
|
73
|
-
> variants. Intent classes map one family onto the shared intent slots below,
|
|
74
|
-
> and presentation classes decide how much of it a component shows. Theme
|
|
75
|
-
> changes belong in token values, not broad component-level theme checks.
|
|
76
|
-
> Component-level theme handling should exist only when a component has an
|
|
77
|
-
> internal structure that cannot be expressed through the token palette
|
|
78
|
-
> alone.
|
|
69
|
+
> **Intent token contract**: color intent tokens own meaning and tone variants. Intent classes map one family onto the shared intent slots below, and presentation classes decide how much of it a component shows. Theme changes belong in token values, not broad component-level theme checks. Component-level theme handling should exist only when a component has an internal structure that cannot be expressed through the token palette alone.
|
|
79
70
|
|
|
80
71
|
## Intent tokens
|
|
81
72
|
|
|
82
|
-
Intent classes set these seven slots; components read them. Because every
|
|
83
|
-
supporting component reads the same seven names, an intent works on every
|
|
84
|
-
component that supports intent, and a custom intent needs no component
|
|
85
|
-
changes.
|
|
73
|
+
Intent classes set these seven slots; components read them. Because every supporting component reads the same seven names, an intent works on every component that supports intent, and a custom intent needs no component changes.
|
|
86
74
|
|
|
87
75
|
| Token | Purpose |
|
|
88
76
|
| ------------------- | ------------------------------------------------------------------------------------- |
|
|
@@ -94,49 +82,19 @@ changes.
|
|
|
94
82
|
| `--intent-border` | Line color. Resolves to `--color-border` when no intent is set. |
|
|
95
83
|
| `--intent-fill-max` | How far a fill of this intent is allowed to go. `100%` for every intent but neutral. |
|
|
96
84
|
|
|
97
|
-
`--intent-color` and `--intent-strong` are two ends of the same family and not
|
|
98
|
-
|
|
99
|
-
tone is
|
|
100
|
-
|
|
101
|
-
rather than the
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
the
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`--intent-border` exists because a neutral border must stay the quiet border
|
|
112
|
-
gray rather than the text color. Everything that draws a line reads it:
|
|
113
|
-
control borders, table rules, dividers, key caps, and quote bars.
|
|
114
|
-
|
|
115
|
-
`--intent-fill-max` exists for the neutral intent, whose color is the page's
|
|
116
|
-
own ink. Every other intent is a hue, legible pale at 12% and saturated at
|
|
117
|
-
100%; a grey filled to 100% is a black or white slab, which is the loudest
|
|
118
|
-
thing on the page and the wrong look for the intent that means _nothing in
|
|
119
|
-
particular_. Neutral stops at `20%`, so `.solid` gives it a quiet plate that
|
|
120
|
-
still reads as a step past `.soft`. Hover adds its step on top of the cap, so
|
|
121
|
-
a capped fill still deepens under the pointer.
|
|
122
|
-
|
|
123
|
-
The foreground is gated by the plate rather than tied to the fill.
|
|
124
|
-
`--intent-contrast` is the ink for a _full_ fill, so printing it at full
|
|
125
|
-
strength on a fifth of one puts white on light grey. Contrast ink therefore
|
|
126
|
-
appears only once the fill is past halfway and reaches full at a full fill;
|
|
127
|
-
below that a component prints `--intent-strong`, the tone chosen to be read.
|
|
128
|
-
|
|
129
|
-
That means a capped neutral takes the strong tone whole rather than a
|
|
130
|
-
fraction of the way toward the page. Tying it to the fill instead cost a
|
|
131
|
-
neutral `.solid` button four points of contrast and a neutral tooltip nearly
|
|
132
|
-
ten. A state that lifts the cap on purpose — a checked checkbox is filled
|
|
133
|
-
with its own intent by definition — reaches a full fill and gets the contrast
|
|
134
|
-
whole.
|
|
135
|
-
|
|
136
|
-
Set them directly to define an intent this package does not ship. **State
|
|
137
|
-
every slot**, including `--intent-fill-max`: components reset all seven to
|
|
138
|
-
the neutral values, so a slot your intent leaves out keeps neutral's — and an
|
|
139
|
-
intent that omits the cap fills to 20% of its color instead of 100%.
|
|
85
|
+
`--intent-color` and `--intent-strong` are two ends of the same family and not interchangeable. The base is a ground, chosen to be filled with; the strong tone is chosen to be read against a page. A `.soft` or `.ghost` component prints the strong one, which is why an unfilled warning reads in amber-800 rather than the amber-600 its solid sibling is filled with.
|
|
86
|
+
|
|
87
|
+
The strong tone has to stay recognisably its own hue, not just readable. On a dark page the `-100` shade of every family is a pale tint that carries almost no chroma at small sizes: a soft success badge and a soft destructive one printed labels that both read white, and a soft radio's dot stopped matching the ring around it. The dark tones are `-300` for that reason, and the tinted grounds under them are `-900` so there is room — measured at 5.0:1 or better everywhere a partial fill prints text, and past 9:1 on the page.
|
|
88
|
+
|
|
89
|
+
`--intent-border` exists because a neutral border must stay the quiet border gray rather than the text color. Everything that draws a line reads it: control borders, table rules, dividers, key caps, and quote bars.
|
|
90
|
+
|
|
91
|
+
`--intent-fill-max` exists for the neutral intent, whose color is the page's own ink. Every other intent is a hue, legible pale at 12% and saturated at 100%; a grey filled to 100% is a black or white slab, which is the loudest thing on the page and the wrong look for the intent that means _nothing in particular_. Neutral stops at `20%`, so `.solid` gives it a quiet plate that still reads as a step past `.soft`. Hover adds its step on top of the cap, so a capped fill still deepens under the pointer.
|
|
92
|
+
|
|
93
|
+
The foreground is gated by the plate rather than tied to the fill. `--intent-contrast` is the ink for a _full_ fill, so printing it at full strength on a fifth of one puts white on light grey. Contrast ink therefore appears only once the fill is past halfway and reaches full at a full fill; below that a component prints `--intent-strong`, the tone chosen to be read.
|
|
94
|
+
|
|
95
|
+
That means a capped neutral takes the strong tone whole rather than a fraction of the way toward the page. Tying it to the fill instead cost a neutral `.solid` button four points of contrast and a neutral tooltip nearly ten. A state that lifts the cap on purpose — a checked checkbox is filled with its own intent by definition — reaches a full fill and gets the contrast whole.
|
|
96
|
+
|
|
97
|
+
Set them directly to define an intent this package does not ship. **State every slot**, including `--intent-fill-max`: components reset all seven to the neutral values, so a slot your intent leaves out keeps neutral's — and an intent that omits the cap fills to 20% of its color instead of 100%.
|
|
140
98
|
|
|
141
99
|
```css
|
|
142
100
|
.brand {
|
|
@@ -151,29 +109,16 @@ intent that omits the cap fills to 20% of its color instead of 100%.
|
|
|
151
109
|
```
|
|
152
110
|
|
|
153
111
|
```html
|
|
154
|
-
<button class="btn brand">Custom intent</button>
|
|
155
|
-
<span class="badge brand soft">Works everywhere</span>
|
|
112
|
+
<button class="btn brand">Custom intent</button> <span class="badge brand soft">Works everywhere</span>
|
|
156
113
|
```
|
|
157
114
|
|
|
158
|
-
> **Intent does not cascade.** Components reset these slots to the text
|
|
159
|
-
> palette at their own root, so a `.success` container never recolors a
|
|
160
|
-
> nested destructive button. Put the intent class on the element that shows
|
|
161
|
-
> the intent.
|
|
115
|
+
> **Intent does not cascade.** Components reset these slots to the text palette at their own root, so a `.success` container never recolors a nested destructive button. Put the intent class on the element that shows the intent.
|
|
162
116
|
|
|
163
117
|
## Foundation tokens
|
|
164
118
|
|
|
165
|
-
Foundation tokens are not aliases for one color. They define layout, shape,
|
|
166
|
-
motion, focus, depth, and layering behavior used by helper classes.
|
|
119
|
+
Foundation tokens are not aliases for one color. They define layout, shape, motion, focus, depth, and layering behavior used by helper classes.
|
|
167
120
|
|
|
168
|
-
The four `--elevation-*` values below are raw shadows for elements you style
|
|
169
|
-
yourself. They are a separate thing from `.elevation-none`/`.elevation-sm`/
|
|
170
|
-
`.elevation-md` (aliased as `.flat`/`.raised`/`.floating`), which scale a
|
|
171
|
-
_component's own_ shadow geometry and default to no shadow at all until an
|
|
172
|
-
aesthetic or one of those classes asks for depth — see
|
|
173
|
-
[Composing → Elevation](./composing.md#elevation) for that system. The two
|
|
174
|
-
share `none`/`sm`/`md`/`lg` naming for the same weight of depth, but one is a
|
|
175
|
-
fixed value and the other multiplies shadow parts, so they will not always
|
|
176
|
-
paint identically.
|
|
121
|
+
The four `--elevation-*` values below are raw shadows for elements you style yourself. They are a separate thing from `.elevation-none`/`.elevation-sm`/ `.elevation-md` (aliased as `.flat`/`.raised`/`.floating`), which scale a _component's own_ shadow geometry and default to no shadow at all until an aesthetic or one of those classes asks for depth — see [Composing → Elevation](./composing.md#elevation) for that system. The two share `none`/`sm`/`md`/`lg` naming for the same weight of depth, but one is a fixed value and the other multiplies shadow parts, so they will not always paint identically.
|
|
177
122
|
|
|
178
123
|
| Token | Purpose |
|
|
179
124
|
| -------------------------- | ----------------------------------------------------------------------- |
|
|
@@ -206,5 +151,4 @@ paint identically.
|
|
|
206
151
|
| `--breakpoint-xs` | Extra-small Tailwind responsive breakpoint. |
|
|
207
152
|
| `--breakpoint-2xl` | Extended large Tailwind responsive breakpoint. |
|
|
208
153
|
|
|
209
|
-
Next: [Customizing](./customizing.md) covers presentation and material
|
|
210
|
-
tokens — how much of an intent shows, and what a component is made of.
|
|
154
|
+
Next: [Customizing](./customizing.md) covers presentation and material tokens — how much of an intent shows, and what a component is made of.
|
package/docs/usage/tooltips.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Tooltips
|
|
3
3
|
description: Tooltip host classes and positioning attributes.
|
|
4
|
+
order: 8
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Tooltips
|
|
@@ -17,29 +18,22 @@ description: Tooltip host classes and positioning attributes.
|
|
|
17
18
|
| `[data-state="open"]` | Shows tooltip without hover. |
|
|
18
19
|
| `.tooltip.raised` / `.tooltip.floating` | Adds one or two units of depth. The bubble is flat by default. |
|
|
19
20
|
|
|
20
|
-
A tooltip bubble's fill, ground color, and floor behavior are covered in
|
|
21
|
-
[Composing → Presentation](./composing.md#presentation), and its material
|
|
22
|
-
follows whichever [aesthetic](./aesthetics.md) is in scope, including the
|
|
23
|
-
pseudo-element itself.
|
|
21
|
+
A tooltip bubble's fill, ground color, and floor behavior are covered in [Composing → Presentation](./composing.md#presentation), and its material follows whichever [aesthetic](./aesthetics.md) is in scope, including the pseudo-element itself.
|
|
24
22
|
|
|
25
|
-
The bubble rests flat. It draws no shadow of its own on a plain page, and
|
|
26
|
-
|
|
27
|
-
same way `.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
still reaches the bubble as it reaches any surface.
|
|
23
|
+
The bubble rests flat. It draws no shadow of its own on a plain page, and zeroes an aesthetic's part-based depth (such as `.neobrutalism`'s slab) the same way `.flat` does elsewhere. Add [`.raised` or `.floating`](./composing.md#elevation) to lift it — `.tooltip.floating` is the pre-0.1.0 look. An aesthetic whose shadow is a complete value, like `.glass`, still reaches the bubble as it reaches any surface.
|
|
24
|
+
|
|
25
|
+
Intent works on a tooltip the same way it works on a filled component: `.tooltip.primary` fills the bubble with the primary color, black text on a light page and white on a dark one; `.tooltip.destructive` is a red bubble with the same logic. With no intent, the bubble uses `--color-tooltip`, a plate chosen per theme rather than derived from an intent — near-white in light, mid-grey in dark; see [Composing → Presentation](./composing.md#presentation) for why.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
31
28
|
|
|
32
29
|
```html
|
|
33
|
-
<button
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
>
|
|
39
|
-
?
|
|
40
|
-
</button>
|
|
30
|
+
<button class="tooltip" data-tooltip="Saved 2 minutes ago">Status</button>
|
|
31
|
+
<button class="tooltip" data-tooltip="Opens in a new tab" data-tooltip-position="bottom">Docs</button>
|
|
32
|
+
<button class="tooltip primary raised" data-tooltip="Primary intent, lifted a step">Deploy</button>
|
|
33
|
+
<button class="tooltip" data-tooltip="Always visible, no hover needed" data-state="open">Pinned</button>
|
|
34
|
+
<button class="tooltip tooltip-icon" data-tooltip="More details" data-tooltip-position="right" aria-label="More details">?</button>
|
|
41
35
|
```
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
names/descriptions outside the CSS; see [Accessibility](../accessibility.md).
|
|
37
|
+
The first two show plain hosts with default (top) and explicit bottom placement. The third combines an intent with `.raised` to show they compose freely — the intent decides the bubble's fill, `.raised` decides whether it casts depth. The fourth uses `data-state="open"` to keep a tooltip visible without a hover or focus interaction, useful for a tooltip that should be demonstrated or tested without simulating pointer input. The fifth is the circular icon variant.
|
|
38
|
+
|
|
39
|
+
CSS pseudo-element tooltips are presentational. They are not a complete accessible tooltip implementation by themselves — provide accessible names/descriptions outside the CSS; see [Accessibility](../accessibility.md).
|