Skip to content
VenusUI
Get started

Split-Flap Display

An airport departures-board display whose letters flip through to new text.

Preview

Installation

npx shadcn@latest add @venusui/split-flap

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/split-flap.tsx

Usage

The 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>
  )
}

API reference

PropTypeDefaultDescription
valuestring—Text to show; padded or cut to length. Unknown characters show as spaces.
lengthnumber—Number of flaps. Defaults to the value's length; set it so the board doesn't change size.
speednumber70Milliseconds per flip.
charsetstring—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.

Requirements

  • React 19 and Tailwind CSS v4. The CLI adds the split-flap-top and split-flap-bottom keyframes to your CSS.

Customization

  • Each flap flips through the charset in order, so changing “A” to “Z” takes longer than “A” to “B”. A shorter charset (e.g. digits only) makes counters snappier.

Accessibility

  • Screen readers get the text itself, not the flaps.
  • With reduced motion the text changes without flipping.

Troubleshooting

Flaps don't animate.
Check that the split-flap-* keyframes are in your CSS; the CLI adds them.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (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 found
Run npx shadcn@latest init in your project first.
Loading preview

Blur Text

Text animations

Text whose words rise out of a blur one after another.

Loading preview

Gradient Text

Text animations

Text filled with a slowly moving gradient: a subtle sheen by default, or your own colors.

Loading preview

Number Ticker

Text animations

Counts up to a number when it scrolls into view, with locale-aware formatting.