Custom CSS
State attributes
Attributes that say how the Look tab is set, and what a part is, so your CSS can apply only some of the time.
The root says how the Look tab is set, so your CSS can apply only to some settings.
/* Dashed buttons, but only while the button style is Outline. */
:root[data-style="outline"] [data-part="link"] {
border-style: dashed;
}
On the root
| Attribute | Values | Set by |
|---|---|---|
data-linker-page |
1, the version of the contract |
Always there |
data-style |
solid, outline, ghost |
Button style |
data-hover |
none, lift, grow, press, slide, tilt, glow, ring, fill, shine |
Hover effect |
data-text-backdrop |
true, false |
Text background |
data-layout |
stack, grid, compact |
Always stack; grids are a part of their own |
Write it on :root, with no space
/* Matches. */
:root[data-style="outline"] [data-part="link"] { … }
/* Never matches. */
[data-style="outline"] [data-part="link"] { … }
Without :root, the selector looks inside the root, where the attribute
never is.
On parts
| Attribute | On | Values | What it says |
|---|---|---|---|
data-spotlight |
link |
true |
You put this link in the spotlight. Only buttons in a links list carry it |
data-w |
tile |
1 to 4 |
How many cells wide the tile is |
data-h |
tile |
1 to 4 |
How many cells tall the tile is |
data-cards |
carousel |
square, portrait, landscape |
The shape of the carousel’s cards |
data-demo |
link |
(no value) | Only in the dashboard’s preview: the button the Look tab is showing a hover on |
/* Your spotlit link, in your text colour. */
[data-part="link"][data-spotlight] {
border-color: var(--linker-text);
}
/* Big tiles get a bigger caption. */
[data-part="tile"][data-w="4"] [data-part="caption"] {
font-size: 1.25rem;
}
See also the badge recipe,
and why hovers need [data-demo].
Following a hover effect
Only while the hover effect is Lift:
:root[data-hover="lift"]
:is([data-part="link"], [data-part="social"]):is(:hover, :focus-visible, [data-demo]) {
border-color: var(--linker-text);
}
To replace the hover outright, set transform and box-shadow on the hover
states yourself.