Loading preview
Blur Text
Text animationsText whose words rise out of a blur one after another.
An airport departures-board display whose letters flip through to new text.
npx shadcn@latest add @venusui/split-flapRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/split-flap.tsxThe code behind the preview above.
split-flap-demo.tsx
"use client"
import * as React from "react"
import { SplitFlap } from "@/components/ui/split-flap"
// A departures board that updates every few seconds. Flights are made up.
const BOARDS = [
[
["TOKYO", "09:40", "BOARDING"],
["LISBON", "10:15", "ON TIME"],
["NAIROBI", "10:55", "DELAYED"],
],
[
["SEOUL", "11:20", "GATE 14"],
["REYKJAVIK", "11:45", "ON TIME"],
["SYDNEY", "12:30", "BOARDING"],
],
]
export default function SplitFlapDemo() {
const [board, setBoard] = React.useState(0)
React.useEffect(() => {
const id = setInterval(() => setBoard((b) => (b + 1) % BOARDS.length), 5000)
return () => clearInterval(id)
}, [])
return (
<div tabIndex={0} role="region" aria-label="Departures board" className="w-full max-w-2xl overflow-x-auto rounded-2xl bg-neutral-950 p-4 shadow-xl sm:p-6 outline-none focus-visible:ring-3 focus-visible:ring-ring/50">
<div className="mb-3 flex gap-6 font-mono text-[10px] tracking-[0.2em] text-amber-400/80 uppercase sm:text-xs">
<span className="w-[9.6em] sm:w-[12em]">Destination</span>
<span className="w-[5.3em] sm:w-[6.5em]">Time</span>
<span>Status</span>
</div>
<div className="flex flex-col gap-2">
{BOARDS[board].map(([city, time, status], row) => (
<div key={row} className="flex gap-3 sm:gap-4">
<SplitFlap value={city} length={9} className="text-sm sm:text-xl" />
<SplitFlap value={time} length={5} className="text-sm sm:text-xl" />
<SplitFlap value={status} length={8} className="text-sm text-amber-300 sm:text-xl" />
</div>
))}
</div>
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Text to show; padded or cut to length. Unknown characters show as spaces. |
| length | number | — | Number of flaps. Defaults to the value's length; set it so the board doesn't change size. |
| speed | number | 70 | Milliseconds per flip. |
| charset | string | — | Characters each flap flips through, in order. Defaults to space, A–Z, 0–9 and :.-/!?. |
All <div> props except children; set the size with a text class, e.g. text-xl.
split-flap-top and split-flap-bottom keyframes to your CSS.charset (e.g. digits only) makes counters snappier.split-flap-* keyframes are in your CSS; the CLI adds them.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Text whose words rise out of a blur one after another.
Text filled with a slowly moving gradient: a subtle sheen by default, or your own colors.
Counts up to a number when it scrolls into view, with locale-aware formatting.