A flex word is a display line of up to three words that widens and narrows on Anybody's width axis as it crosses the view. Its box is reserved at its widest, so nothing around it moves.
Example#
Built to last
Usage#
Use a flex word for one display word that breathes with the scroll: its width axis stretches as it crosses the viewport, then rests. It is one per view, on a heading people read once.
- Scroll-driven. It runs on
view()timelines where the browser has them and rests elsewhere. - Reserved width. The word's slot is reserved, so nothing around it reflows.
Layer and volume#
Display type, one per view. Quiet: still. Studio: up to 20 width units. Press: 40. Rave: 60. Only where scroll timelines exist; elsewhere it rests.
Anatomy#
Built to last
- SlotReserved at the widest width.
.mk-flex-word - WordThe width axis follows the scroll.
.mk-flex-word-text
Volume#
Quiet
Built to lastStudio
Built to lastPress
Built to lastRave
Built to last
Content#
- One to three words of display type.
Do and don't#
Do
Built to last
Don't
Every heading on the page stretching as you scroll.
Accessibility#
- The words are read once; the reserving copy is
aria-hidden. - Reduced motion: still.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
children required | string | none | At most 3 words, one line. |
as | ElementType | span | The element (default `span`); a section title passes `h2`. |
typeRole | "display" | "head-section" | display | The type role class (default `display`). |
Tokens#
System tokens (5)
Its own properties (1)
--mk-flex-range
Changelog#
Arrived in 0.9.0.
PageWipe(link activation at Press and Rave, theflipvoice) andFlexWord(the width axis on a view timeline), and the SFX width flex at Press and Rave. Read the whole entry