II Type

Star on GitHubFeedback
II TypeNative HTML and a hookot-waterfall

Waterfall

A type specimen waterfall: one sentence at every dynamic, loudest first, each line filled to the measure with as many whole words as the size holds.

Report an issue with Waterfall

Example

Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence.
Strike one note and let it ring. It is loudest the instant it begins, and from then on it only falls away, a little quieter with every breath, until you are no longer sure whether you are hearing the note or remembering it.
Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence.
Voice
Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence.
Italic
Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence.
Decay
Strike one note and let it ring. It is loudest the instant it begins, and from then on it only falls away, a little quieter with every breath, until you are no longer sure whether you are hearing the note or remembering it.
Decay, italic
Strike one note and let it ring. It is loudest the instant it begins, and from then on it only falls away, a little quieter with every breath, until you are no longer sure whether you are hearing the note or remembering it.
Solo, at rest
Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence.

Install

Run it in a project that has the shadcn CLI set up. It brings the 0nlyType base along.

npx shadcn@latest add https://thedirectors.agency/ui/r/waterfall.json

Usage

waterfall-example.tsx
import { Waterfall } from "@/components/ui/waterfall"const words = "Hush, the whole hall is listening. Nothing is louder than a room that has just gone quiet, and every sound after it is measured against that silence."const fading ="Strike one note and let it ring. It is loudest the instant it begins, and from then on it only falls away, a little quieter with every breath, until you are no longer sure whether you are hearing the note or remembering it."export default function Example() {return (<div className="grid gap-y-16"><Waterfall className="max-w-[56rem]">{words}</Waterfall><Waterfall variant="decay" from="fff" className="max-w-[56rem]">{fading}</Waterfall><Waterfall variant="solo" from="ff" className="max-w-[56rem]">{words}</Waterfall></div>)}

Contract

  • Underneath: native, plus a hook that lays the lines out with pretext.
  • Anatomy: <div class="ot-waterfall"> holding the text for readers once (.ot-sr) and, per dynamic, an aria-hidden .ot-waterfall-row: .ot-waterfall-mark (the dynamic, in the expression italic, pencil), .ot-waterfall-text (the line) and .ot-waterfall-px (its size).
  • A type specimen waterfall: the same words at every dynamic from from (ffff) to to (pp), loudest first. Each line takes as many whole words as the measure holds at its size (pretext counts them) and never wraps or ellipsises (white-space: nowrap; overflow-x: clip is only a safety). Its tracking then opens by up to a twentieth of an em to reach the edge, unless the line already holds all the words. A first word wider than the line sets that line smaller instead of breaking; a quieter line is never set louder than the one above it.
  • Pointing at a line shows its size in pixels in pencil at its end; on a narrow container the size takes the mark's place. italic sets the specimen in the expression face. It lays out again when its width changes or <html> changes face; before that each line is the plain text, clipped.
  • variant (data-variant; none for the default, specimen): decay or solo.
  • decay: a note after its attack. The sentence is read once instead of repeated: each line takes up where the one above stopped, a dynamic quieter, filled and tracked to the measure the same way; the quietest line says the rest and wraps as a paragraph does. A line with nothing left to say is hidden. It is still: the fall is in the sizes, not in time.
  • solo: the mixing desk's solo button. Pointing at a line keeps it in ink and sends every other line back to a rule (--ot-rule-strong), its dynamic's mark inked and its size shown, so you hear one size alone; the colour eases (--ot-andante). Leaving brings every line back. A pointer aid only: the rows are aria-hidden and the text is read once.

Props

Props of Waterfall
PropTypeDefaultWhat it does
childrenstringThe words, as plain text: pretext measures how many each size holds. Begin with a short word so the loudest line has one to show.
from"pp" | "p" | "mp" | "mf" | "f" | "ff" | "fff" | "ffff""ffff"The loudest dynamic to show.
to"pp" | "p" | "mp" | "mf" | "f" | "ff" | "fff" | "ffff""pp"The quietest dynamic to show.
italicbooleanfalseSet the specimen in the expression italic.
variant"specimen" | "decay" | "solo""specimen"How the lines relate. specimen: the same words at every size, as a foundry's specimen shows a face. decay: the sentence is read once and falls away as it goes, as a note does after its attack; each line takes up where the one above stopped, a dynamic quieter, and the quietest says the rest and wraps. solo: the mixing desk's solo button; pointing at a line keeps it in ink and sends the others back to a rule, so you hear one size alone.

Craft

Where its move comes from

Where its move comes from
ComponentReferenceMove
WaterfallThe foundry's specimen waterfall; the score's dynamicsOne sentence at every dynamic, each line filled to the measure
Decay waterfallA note's decay after its attack; "It has to be design." scale contrastThe sentence read once, falling a dynamic every line
Solo waterfallThe mixing desk's solo buttonPoint at one size and the others fall back to a rule

How it moves

How it moves
ComponentArticulationWhat moves
Solo waterfallMuteThe lines you are not pointing at ease back to a rule