sdxc

Type to search, or start from one of these:

typography

font-size

Applies font-size and its paired line-height from the named text scale through matching var(--ui-text-*) / var(--ui-leading-*) properties, so an extended name inherits a sensible default leading before defining one.

import { text } from "@sdxc/u/typography";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.text("lg")css({ fontSize: "var(--ui-text-lg, 1.125rem)", lineHeight: "var(--ui-leading-lg, calc(1.75 / 1.125))" })

Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

u.text("lg")

Applying on a state

Wrap the call in a state utility to scope it to one selector.

u.hover(u.text("lg"))

Responsive design

Wrap the call in a container query to scope it to one width.

u.at("md", u.text("lg"))

Customizing the theme

The custom properties this utility reads, which a theme redefines.

Variable
--ui-leading-
--ui-leading-lg
--ui-text-
--ui-text-lg

Signature

u.text(name: TextSizeName | (string & {}))