agent-ecosystem/src/renderer/components/ui/checkbox.tsx
2026-02-22 23:36:11 +02:00

29 lines
1.1 KiB
TypeScript

import * as React from 'react';
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { cn } from '@renderer/lib/utils';
import { Check } from 'lucide-react';
const Checkbox = React.forwardRef<
React.ComponentRef<typeof CheckboxPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
>(({ className, ...props }, ref) => (
<CheckboxPrimitive.Root
ref={ref}
className={cn(
'peer size-4 shrink-0 rounded border border-[var(--color-border-emphasis)] bg-transparent',
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-accent)]',
'disabled:cursor-not-allowed disabled:opacity-50',
'data-[state=checked]:border-[var(--color-accent)] data-[state=checked]:bg-[var(--color-accent)] data-[state=checked]:text-white',
className
)}
{...props}
>
<CheckboxPrimitive.Indicator className="flex items-center justify-center text-current">
<Check className="size-3" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
));
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
export { Checkbox };