# Split Flap

> Split-flap display that flips each character through the alphabet like a departure board, with a column ripple, tones, sizes and reduced motion support.

- Kind: Component (Motion)
- Docs: https://ui.minidev.pro/docs/split-flap
- Source (registry JSON with the full file): https://ui.minidev.pro/r/split-flap.json
- License: MIT. One file, yours to edit after install.

## When to use

Top half falls over the bottom with a staggered start per column. Screen readers get the final text once; the flipping is decoration.

The board is always dark (it scopes the dark tokens to itself). Supported characters: A-Z, 0-9, space and : . - ' / ·; anything else shows blank. Use it for a headline status or a launch moment; for a changing number in a dashboard use NumberRoll, which is quieter.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/split-flap
```

Writes `components/ui/split-flap.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/split-flap.json`.

### npm package

```bash
npm i minidev-ui-kit motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { SplitFlap } from "@/components/ui/split-flap"
```

From the npm package:

```tsx
import { SplitFlap } from "minidev-ui-kit/ui/split-flap"
```

## Usage

```tsx
import { SplitFlap } from "@/components/ui/split-flap"

export function Example() {
  return (
    <SplitFlap />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | `string` | `"NOW BOARDING"` | no | Text to flip to. Change it to flip again from the current characters. |
| `length` | `number` | - | no | Pad or cut to this many cells. |
| `speed` | `number` | `70` | no | Milliseconds per single flip. |
| `stagger` | `number` | `28` | no | Extra delay per column, for the ripple. |
| `size` | `"sm" \| "default" \| "lg"` | `"default"` | no | Cell size: 24px, 32px or 48px tall. |
| `tone` | `"default" \| "accent" \| "success" \| "warning" \| "danger"` | `"default"` | no | Colour of the characters. |
| `className` | `string` | - | no |  |

## Examples

### Status that changes

Change value and each cell flips forward from its current letter; a fixed length keeps the board width steady.

```tsx
const STATUSES = [
  { value: "ON TIME", tone: "success" },
  { value: "DELAYED", tone: "warning" },
  { value: "BOARDING", tone: "accent" },
] as const

function DepartureStatus() {
  const [i, setI] = React.useState(0)
  const s = STATUSES[i]
  return (
    <div className="flex flex-col items-center gap-4">
      <div className="flex items-center gap-3">
        <SplitFlap value="GATE B12" length={8} size="sm" />
        <SplitFlap value={s.value} length={8} size="sm" tone={s.tone} />
      </div>
      <Button variant="outline" size="sm" onClick={() => setI((n) => (n + 1) % STATUSES.length)}>
        Next status
      </Button>
    </div>
  )
}
```

### Launch headline

A large board for one moment on a launch page; speed and stagger set how fast the ripple crosses the row.

```tsx
<SplitFlap value="LUMEN 3.0 IS LIVE" size="lg" tone="accent" speed={50} stagger={40} />
```

## Accessibility

- Screen readers get `value` once from an `sr-only` span; every cell is `aria-hidden`.
- It is not a live region, so a new `value` is not announced. Add your own `aria-live` text if the change matters.
- Under reduced motion each cell shows its target character at once.

## FAQ

### How long does a SplitFlap take to settle?

Each cell flips forward through the character set one step at a time, `speed` milliseconds per step (70 by default), and columns start `stagger` ms apart. A cell going from blank to `Z` takes 26 steps, about two seconds. Flaps never go backwards, so changing `B` to `A` goes all the way round.

### Which characters can SplitFlap show?

A to Z, 0 to 9, space and `: . - ' / ·`. Lowercase is converted to uppercase, and anything else shows as a blank cell. `length` pads or cuts the text to a fixed number of cells so the board width never changes.

### Why is the board dark in light mode?

It adds the `dark` class to itself, so the dark tokens apply inside it in both themes, like a real departure board. `tone` colours the characters.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `motion`

## Related

- [Number Roll](https://ui.minidev.pro/docs/number-roll/md): An odometer style animated number where each digit rolls on a spring and only changed digits move. Supports Intl formatting, trend tint and reduced motion.
- [Light Provider](https://ui.minidev.pro/docs/light-provider/md): A page wide light source that follows the pointer and drifts when idle, driving shadows via CSS variables, plus a hairline, glass, metal and paper switcher.
- [Marquee](https://ui.minidev.pro/docs/marquee/md): An infinitely scrolling Tailwind strip that loops its children horizontally, duplicated for a gapless cycle, and stops when users prefer reduced motion.
- [Morph Panel](https://ui.minidev.pro/docs/morph-panel/md): A React button that morphs into the panel it opens on a spring, blurring the label out and the form in. Ships with a feedback form and closes on Escape.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
