color
ring
Applies a focus ring already scoped to &:focus-visible, so it shows for keyboard and assistive-tech focus and a component can apply it directly.
import { ring } from "@sdxc/u/color";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.ring() | css({ "&:focus-visible": { outlineWidth: "2px", outlineStyle: "solid", outlineOffset: "2px", outlineColor: "var(--ui-ring, Highlight)" } }) |
u.ring("danger") | css({ "&:focus-visible": { outlineColor: "var(--ui-danger-ring)" } }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.ring()Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.ring())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.ring())Customizing the theme
The custom properties this utility reads, which a theme redefines.
| Variable |
|---|
--ui-danger-ring |
--ui-ring |
Signature
u.ring(value?: ColorValue | (string & {}))