Command Palette

Search for a command to run...

Docs
Radio Group Card

Radio Group Card

A radio group with card-style items featuring icons, titles, descriptions, and animated selection indicator

Loading...

Installation

Usage

import { RadioGroup, RadioCard } from "@/components/ruixen/radio-group-card";
import { Laptop, SunMedium, Moon } from "lucide-react";
 
export default function App() {
  return (
    <RadioGroup defaultValue="system">
      <RadioCard
        value="light"
        title="Light Mode"
        description="Bright and clean layout with light backgrounds."
        icon={<SunMedium size={20} />}
      />
      <RadioCard
        value="dark"
        title="Dark Mode"
        description="Dimmed layout that's easy on the eyes at night."
        icon={<Moon size={20} />}
      />
      <RadioCard
        value="system"
        title="System"
        description="Automatically adapts to your device's settings."
        icon={<Laptop size={20} />}
      />
    </RadioGroup>
  );
}

Props

RadioGroup Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes
defaultValuestring-Default selected value
valuestring-Controlled selected value
onValueChange(value: string) => void-Callback when value changes

RadioCard Props

PropTypeDefaultDescription
valuestring-Unique value for this option
titlestring-Card title text
descriptionstring-Optional description text
iconReact.ReactNode-Optional icon element
classNamestring-Additional CSS classes

Features

  • Card Layout: Rich, visual radio button alternatives
  • Icon Support: Add icons to enhance visual communication
  • Animated Indicator: Glowing green dot with ping animation
  • Hover Effects: Subtle shadow and interaction feedback
  • Responsive Grid: Automatically adapts to screen size
  • Accessibility: Full keyboard and screen reader support

Selection Indicator

Each selected card shows an animated indicator in the top-right corner:

  • Ping Animation: Expanding circle effect
  • Glowing Effect: Green dot with shadow
  • Visual Feedback: Clear selection state

Use Cases

  • Settings Panels: Theme selection, preferences
  • Plan Selection: Pricing tiers, subscription options
  • Configuration: Setup wizards, option selection
  • Onboarding: Feature selection, user preferences