Skip to content

Commit ae4ebc6

Browse files
committed
feat: add Checkbox component
1 parent d8235dd commit ae4ebc6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
5+
import { Check } from "lucide-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 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",
18+
className
19+
)}
20+
{...props}
21+
>
22+
<CheckboxPrimitive.Indicator
23+
data-slot="checkbox-indicator"
24+
className={cn("flex items-center justify-center text-current")}
25+
>
26+
<Check className="h-4 w-4" />
27+
</CheckboxPrimitive.Indicator>
28+
</CheckboxPrimitive.Root>
29+
)
30+
}
31+
32+
export { Checkbox }

0 commit comments

Comments
 (0)