Scoped Styling
Confining a set of style decisions to a subtree so the same component can look different in different contexts.
Scoped styling confines a set of design decisions to a region of the document — typically by declaring CSS Custom Property values under an attribute selector, so any element inside that region resolves tokens differently from elements outside it.
It is what makes one component library serve two visual languages at once: an editing interface with its own chrome tokens rendered around content styled by a tenant's own tokens, or a dark toolbar floating over a light page.
The rules that make it work are unforgiving. A utility that references a scoped token must itself be inside the scope. Putting the scope marker on an inner element while the outer element carries the tokenised utilities produces an outer element whose radius, shadow, and colour resolve to nothing — and it fails silently, in ways a pixel comparison hides in the antialiasing. Portalled content leaves the scope, so an overlay rendered at the document body must re-declare the marker itself. And the theme mapping must substitute at point of use, or the token resolves at the root where the scope does not exist.
The corresponding test discipline is to assert computed values — the actual resolved radius and colour — not merely that a class is present. A class that resolves to nothing is present.
See also7
Hand-picked in the note itself — the neighbours worth reading next.
CSS Custom Property
A user-defined CSS property that participates in the cascade and inherits down the tree.
Design & Interface9 connections
Design Token
Named design decisions — colour, spacing, radius, type — stored as data so they can be shared and re-themed.
Design & Interface14 connections
Portal
Rendering an element into a different part of the document than its logical parent.
Web Platform14 connections
Dark Mode
Serving an alternate palette for low-light preference, and the three states that implies.
Design & Interface10 connections
Silent Failure
A failure that produces no signal, so the absence of an error reads as success.
Method44 connections
Utility-First CSS
Composing styles from many small single-purpose classes rather than authoring semantic rules.
Design & Interface11 connections
Cascade
The algorithm deciding which declaration wins when several apply to the same element.
Design & Interface9 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from7
Notes elsewhere in the wiki that reach for this one.
- CascadeDesign & Interface
The algorithm deciding which declaration wins when several apply to the same element.
- CSS Custom PropertyDesign & Interface
A user-defined CSS property that participates in the cascade and inherits down the tree.
- Dark ModeDesign & Interface
Serving an alternate palette for low-light preference, and the three states that implies.
- Design TokenDesign & Interface
Named design decisions — colour, spacing, radius, type — stored as data so they can be shared and re-themed.
- OKLCHDesign & Interface
A perceptually uniform colour space that makes lightness and chroma behave predictably.
- PortalWeb Platform
Rendering an element into a different part of the document than its logical parent.
- Utility-First CSSDesign & Interface
Composing styles from many small single-purpose classes rather than authoring semantic rules.