Highlight
The Highlight text component: a faint blue tint with square corners, whose side padding repeats on every line it wraps across.
Highlight marks a run of text with a tinted background, like a highlighter pen. It lives in src/components/typography.tsx and renders a <mark>.
Using it
import { Highlight } from "@/components/typography";
<Paragraph>
Some text with <Highlight>a highlighted part</Highlight> in the middle.
</Paragraph>What it looks like
A faint blue tint behind the text, which is a step brighter than the body text, with a little padding at the sides. The corners are square.
What it does
- Wrapped text keeps its padding on every line. The background repeats its side padding at each line break, so a highlight that wraps looks like a highlighter drawn over each line, not one box cut into pieces. This is
box-decoration-break: clone, the same setting inline code uses. - Takes a
className, like every typography component, for a one-off change.
How it was chosen
Six designs were compared on the Highlights tab of the UI stress test: rounded or sharp corners, with the padding cut at line breaks or repeated. Sharp and repeated looked most like a real highlight. Rounded corners were also lost at each break unless the padding repeated.
Related
- Muted text
Muted text styles and color nudges for intros, descriptions and meta lines, each shown in a realistic page sample.
- Body text
Candidate body text grays, from light grays to purple-grays, each shown with a heading, muted intro and paragraphs.
- Text colors
Every text color token with its value and where it's used, plus before-and-after comparisons for consolidating them.
- Link hovers
Nine inline link hover styles side by side, from solid fill to borders and underlines, for choosing the site's link look.