From 8729093c71973a276fe308272a2e1733684c01f0 Mon Sep 17 00:00:00 2001 From: jyswee Date: Thu, 23 Jul 2026 22:10:52 +0000 Subject: [PATCH] Seed: dashboard template (24 files) --- src/components/ui/switch.tsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/components/ui/switch.tsx diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx new file mode 100644 index 0000000..4c02678 --- /dev/null +++ b/src/components/ui/switch.tsx @@ -0,0 +1,31 @@ +import * as React from "react"; +import { cn } from "@/lib/utils"; + +export interface SwitchProps extends Omit, "onChange"> { + checked?: boolean; + defaultChecked?: boolean; + onCheckedChange?: (checked: boolean) => void; +} + +export const Switch = ({ className, checked: controlled, defaultChecked, onCheckedChange, ...props }: SwitchProps) => { + const [internal, setInternal] = React.useState(!!defaultChecked); + const checked = controlled ?? internal; + return ( + + ); +}; + +export default Switch;