Split Flap

An airport departures board: every letter rattles through the alphabet to land.

no dependenciesMIT · free

Now boarding

JAKARTA
GATE 12

Installation

npx shadcn@latest add https://ombakui.com/r/split-flap.json

Usage

import { SplitFlap } from "@/components/split-flap";

// change `text` and the board flips to it
<SplitFlap text={city} length={8} className="text-5xl" />
<SplitFlap text="GATE 12" cellClassName="bg-amber-400 text-zinc-900" />

Props

PropTypeDefaultDescription
text*string–Text to show. Change it and the board flips to the new value.
lengthnumber–Number of cells. Defaults to the text length. Shorter text is padded with spaces.
charsstring" A–Z 0–9 . - :"Characters each cell cycles through, in order.
flipSpeednumber45Milliseconds per flip.
staggernumber40Milliseconds between neighbouring cells starting.
onViewbooleantrueStart flipping when scrolled into view (true) or straight away (false).
classNamestring–
cellClassNamestring–Classes for each cell, e.g. colors.