typography
font-family
Combines text's font-size/line-height pair with the base sans font family, always opinionating the style to sans.
import { type } from "@sdxc/u/typography";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.type("lg") | css({ fontFamily: "var(--ui-font-sans, ui-sans-serif, system-ui, sans-serif)", fontSize: "var(--ui-text-lg, 1.125rem)", lineHeight: "var(--ui-leading-lg, 1.5)" }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.type("lg")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.type("lg"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.type("lg"))Customizing the theme
The custom properties this utility reads, which a theme redefines.
| Variable |
|---|
--ui-font-sans |
--ui-leading-lg |
--ui-text-lg |
Signature
u.type(name: TextSizeName | (string & {}))