From 478a2407c870c98b404172f0c68cae15dc53691b Mon Sep 17 00:00:00 2001 From: jyswee Date: Thu, 23 Jul 2026 22:15:14 +0000 Subject: [PATCH] Seed: product-management template (23 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;