Components
A split-flap display that animates text with mechanical flip transitions, inspired by Vestaboard message boards.
Loading preview...
"use client";
import { TextFlippingBoard } from "@/components/ui/text-flipping-board";
import React, { useCallback, useEffect, useState } from "react";
const MESSAGES: string[] = [
"STAY HUNGRY \nSTAY IN BED \n- STEVE JOBS",
"What did you get done this week?",
"I burned $20 \nfor this shit.",
"DONT WORRY \nBE HAPPY FFS.",
"LADIES AND GENTLEMEN \nWELCOME TO F#!@# C!@$",
];
export default function TextFlippingBoardDemo() {
const [msgIdx, setMsgIdx] = useState(0);
const next = useCallback(
() => setMsgIdx((i) => (i + 1) % MESSAGES.length),
[],
);
useEffect(() => {
const id = setInterval(next, 6000);
return () => clearInterval(id);
}, [next]);
return (
<div className="flex w-full flex-col items-center justify-center gap-8 py-20">
<TextFlippingBoard text={MESSAGES[msgIdx]} />
</div>
);
}