22 lines
638 B
TypeScript
22 lines
638 B
TypeScript
import * as React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
onCheckedChange?: (checked: boolean) => void;
|
|
}
|
|
|
|
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
({ className, onCheckedChange, ...props }, ref) => (
|
|
<input
|
|
ref={ref}
|
|
type="checkbox"
|
|
onChange={(e) => onCheckedChange?.(e.target.checked)}
|
|
className={cn("h-4 w-4 rounded border-slate-300 accent-indigo-600", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
);
|
|
Checkbox.displayName = "Checkbox";
|
|
|
|
export default Checkbox;
|