gitscope
← marzneshin / v0.7.1 / dashboard/src/common/components/ui/checkbox.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/common/components/ui/checkbox.tsx · TypeScript
Blame Raw
 1import * as React from "react"
 2import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
 3import { Check } from "lucide-react"
 4
 5import { cn } from "@marzneshin/common/utils"
 6
 7const Checkbox = React.forwardRef<
 8    React.ElementRef<typeof CheckboxPrimitive.Root>,
 9    React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10>(({ className, ...props }, ref) => (
11    <CheckboxPrimitive.Root
12        ref={ref}
13        className={cn(
14            "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15            className
16        )}
17        {...props}
18    >
19        <CheckboxPrimitive.Indicator
20            className={cn("flex items-center justify-center text-current")}
21        >
22            <Check className="h-4 w-4" />
23        </CheckboxPrimitive.Indicator>
24    </CheckboxPrimitive.Root>
25))
26Checkbox.displayName = CheckboxPrimitive.Root.displayName
27
28export { Checkbox }