This commit is contained in:
jjbrunton committed 2025-12-30 15:55:57 +00:00
1 parent 5b97bc6f56
commit 5a7e62a578
104 files changed
+2986

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import * as React from "react";
import { cn } from "@/lib/utils";
import { Check } from "lucide-react";
export interface CheckboxProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> {
checked?: boolean;
onCheckedChange?: (checked: boolean) => void;
}
const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
({ className, checked, onCheckedChange, ...props }, ref) => {
return (
<button
type="button"
role="checkbox"
aria-checked={checked}
className={cn(
"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",
checked ? "bg-primary text-primary-foreground" : "bg-background",
className
)}
onClick={() => onCheckedChange?.(!checked)}
{...props}
>
{checked && (
<Check className="h-3 w-3 mx-auto" strokeWidth={3} />
)}
</button>
);
}
);
Checkbox.displayName = "Checkbox";
export { Checkbox };