Preview
Install
bunx shadcn@latest add https://ui.trypacked.dev/r/checkbox.json
Source
components/ui/checkbox.tsx
"use client";
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
import { CheckIcon } from "lucide-react";
import { cn } from "@/registry/lib/utils";
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
return (
<CheckboxPrimitive.Root
data-slot="checkbox"
className={cn(
"peer relative flex size-5 shrink-0 items-center justify-center rounded-xs border-[1.5px] border-strong bg-card outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-brand focus-visible:ring-[3px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 data-checked:border-brand data-checked:bg-brand data-checked:text-on-brand",
className,
)}
{...props}
>
<CheckboxPrimitive.Indicator
data-slot="checkbox-indicator"
className="grid place-content-center text-current transition-none"
>
<CheckIcon className="size-3.5" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
);
}
export { Checkbox };
npm dependencies
@base-ui/react, lucide-react
Registry dependencies
- @packed/utils
Files
- registry/ui/checkbox.tsx → components/ui/checkbox.tsx