terra vidhal

Flashcard Deck

Component

About

A flashcard study session with deck tabs, an animated card flip, optional hints, keyboard shortcuts for flipping, navigating and rating, again-hard-good buttons that advance the session, a progress bar, and a completion summary with review-missed and restart actions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Flashcard Deck to your project and fits it to your theme.

Code

How Flashcard Deck is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { FlashcardDeck, type Flashcard } from "@/components/ui/flashcard-deck";

const CARDS: Flashcard[] = [
  {
    id: "tokens",
    deck: "Design systems",
    front: "What is the difference between a design token and a CSS variable?",
    back: "A token is the named decision, such as surface or spacing-md. A CSS variable is one way to store and expose that decision in code.",
    hint: "Think about the decision versus the implementation.",
  },
  {
    id: "component-api",
    deck: "Design systems",
    front: "When should a component expose a variant instead of a new prop?",
    back: "When the change is a recognised visual or behavioural mode of the same component, so consumers pick a known option rather than compose ad hoc styles.",
    hint: "Variants describe modes; props describe data.",
  },
  {
    id: "empty-state",
    deck: "Design systems",
    front: "What makes an empty state useful rather than decorative?",
    back: "It names what is missing, explains why it matters and offers the single next action that fills the space.",
    hint: "Missing, meaning, next action.",
  },
  {
    id: "motion-tokens",
    deck: "Design systems",
    front: "Why should motion durations live in tokens?",
    back: "So every surface shares the same rhythm, reduced-motion rules are applied once and long durations are not invented per screen.",
  },
  {
    id: "focus-order",
    deck: "Accessibility",
    front: "What does a logical focus order protect?",
    back: "It keeps keyboard and assistive technology users moving through the page in the same reading order as the visual layout.",
  },
  {
    id: "contrast",
    deck: "Accessibility",
    front: "Which two pieces of text most often lose contrast?",
    back: "Placeholder text and secondary labels on tinted cards, especially when opacity is used instead of a dedicated muted colour.",
    hint: "Look at muted text, not just headings.",
  },
  {
    id: "live-regions",
    deck: "Accessibility",
    front: "When is an aria-live region appropriate?",
    back: "For short, meaningful updates that happen without a page change, such as a save confirmation or the result of a background action.",
  },
  {
    id: "reduced-motion",
    deck: "Accessibility",
    front: "What is the right response to prefers-reduced-motion?",
    back: "Remove large travel, parallax and looping motion, keep the state change clear and never remove the functionality itself.",
    hint: "Reduce the movement, keep the meaning.",
  },
];

export default function FlashcardDeckDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-background px-4 py-12 sm:px-6">
      <FlashcardDeck
        cards={CARDS}
        title="Study session"
        description="A short spaced-review round on design systems and accessibility. Rate each card honestly so the next pass can focus on weak spots."
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Gravity Stars Background

    Gravity Stars Background

    16
  • Audio Waveform

    Audio Waveform

    13
  • Topographic Lines

    Topographic Lines

    12
  • Notification Center

    Notification Center

    11
  • Booking Calendar

    Booking Calendar

    11
  • Spotlight Card

    Spotlight Card

    11
  • Command Palette

    Command Palette

    9
  • Kpi Counter

    Kpi Counter

    9

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.