summaryrefslogtreecommitdiff
path: root/apps/web/src/components/ui/checkbox.tsx
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-06-22 10:02:50 +0200
committerMaze Winther <mazewinther@gmail.com>2025-06-22 10:02:50 +0200
commit87a83a5604b20550430ef4eefbcd573d309694e2 (patch)
tree7ed86f00b8414cb6543f5c5ac98ea6e9abd2e10f /apps/web/src/components/ui/checkbox.tsx
downloadopencut-87a83a5604b20550430ef4eefbcd573d309694e2.tar.gz
Initial commit
Diffstat (limited to 'apps/web/src/components/ui/checkbox.tsx')
-rw-r--r--apps/web/src/components/ui/checkbox.tsx30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/web/src/components/ui/checkbox.tsx b/apps/web/src/components/ui/checkbox.tsx
new file mode 100644
index 00000000..bedc253e
--- /dev/null
+++ b/apps/web/src/components/ui/checkbox.tsx
@@ -0,0 +1,30 @@
+"use client";
+
+import * as React from "react";
+import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
+import { Check } from "lucide-react";
+
+import { cn } from "../../lib/utils";
+
+const Checkbox = React.forwardRef<
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
+>(({ className, ...props }, ref) => (
+ <CheckboxPrimitive.Root
+ ref={ref}
+ className={cn(
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
+ className
+ )}
+ {...props}
+ >
+ <CheckboxPrimitive.Indicator
+ className={cn("flex items-center justify-center text-current")}
+ >
+ <Check className="h-4 w-4" />
+ </CheckboxPrimitive.Indicator>
+ </CheckboxPrimitive.Root>
+));
+Checkbox.displayName = CheckboxPrimitive.Root.displayName;
+
+export { Checkbox };