| 1 | "use client"; |
| 2 | |
| 3 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; |
| 4 | import { CheckIcon } from "lucide-react"; |
| 5 | import type * as React from "react"; |
| 6 | |
| 7 | import { cn } from "@/lib/utils"; |
| 8 | |
| 9 | function Checkbox({ |
| 10 | className, |
| 11 | ...props |
| 12 | }: React.ComponentProps<typeof CheckboxPrimitive.Root>) { |
| 13 | return ( |
| 14 | <CheckboxPrimitive.Root |
| 15 | data-slot="checkbox" |
| 16 | className={cn( |
| 17 | "peer size-4 shrink-0 rounded-lg border border-input shadow-2xs outline-hidden transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary", |
| 18 | className, |
| 19 | )} |
| 20 | {...props} |
| 21 | > |
| 22 | <CheckboxPrimitive.Indicator |
| 23 | data-slot="checkbox-indicator" |
| 24 | className="flex items-center justify-center text-current transition-none" |
| 25 | > |
| 26 | <CheckIcon className="size-3.5" /> |
| 27 | </CheckboxPrimitive.Indicator> |
| 28 | </CheckboxPrimitive.Root> |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | export { Checkbox }; |
| 33 |