SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

text-wrap

Balances line lengths across a wrapped block, best suited to short text such as headings, since browsers cap balancing to a small number of lines.

tsx
import { balance } from "@sdxc/u/typography";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.balance()css({ textWrap: "balance" })

Examples

Basic example

Use balance() to distribute the text evenly across each line of a heading:

balance()

City council approves a riverside bike lane after two years of heated debate

default wrapping

City council approves a riverside bike lane after two years of heated debate

tsx
<div mix={[maxIs(80), ...]}>
	<div>
		<p mix={[...]}>balance()</p>
		<h3 mix={[balance(), text("2xl"), weight("bold")]}>
			City council approves a riverside bike lane after two years of heated debate
		</h3>
	</div>
	<div>
		<p mix={[...]}>default wrapping</p>
		<h3 mix={[text("2xl"), weight("bold")]}>
			City council approves a riverside bike lane after two years of heated debate
		</h3>
	</div>
</div>

Applying on a state

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

typescript
u.hover(u.balance())

Responsive design

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

typescript
u.at("md", u.balance())

Signature

typescript
u.balance()
@sdxc/u

Can’t find it? Contact us