Componentform0.72 KB gzipZero dependencies
Switch Card
Switch card combining title, description and toggle.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add switch-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SwitchCard } from "@/components/ui/switch-card"; <SwitchCard />Source code
switch-card.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| title | string | Primary heading or title text. |
| description | string | Descriptive helper or subtitle text. |
| checked | boolean | Controlled checked state. |
| defaultChecked | boolean | Initial checked state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | Callback invoked on checked change. |
| disabled | boolean | Disables interaction and applies disabled styling. |