Componentform0.72 KB gzipZero dependencies

Switch Card

Switch card combining title, description and toggle.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add switch-card

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { SwitchCard } from "@/components/ui/switch-card"; <SwitchCard />

Source code

switch-card.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxswitch-card.tsx54 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface SwitchCardProps extends React.HTMLAttributes<HTMLLabelElement> {  title: string;  description?: string;  checked?: boolean;  defaultChecked?: boolean;  onCheckedChange?: (checked: boolean) => void;  disabled?: boolean;} /** Card-style toggle switch: title + description + switch control. */export function SwitchCard({ title, description, checked, defaultChecked, onCheckedChange, disabled, className, ...props }: SwitchCardProps) {  const [internal, setInternal] = React.useState(defaultChecked ?? false);  const isOn = checked ?? internal;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { SwitchCard } from "@/components/ui/switch-card"; <SwitchCard />
PropTypeDescription
titlestringPrimary heading or title text.
descriptionstringDescriptive helper or subtitle text.
checkedbooleanControlled checked state.
defaultCheckedbooleanInitial checked state when uncontrolled.
onCheckedChange(checked: boolean) => voidCallback invoked on checked change.
disabledbooleanDisables interaction and applies disabled styling.