返回 oh-my-ppt
Checkbox.tsx
根目录 / src / renderer / src / components / ui / Checkbox.tsx
1 import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
2 import { Check } from 'lucide-react'
3 import React from 'react'
4 import { cn } from '@renderer/lib/utils'
5
6 export const Checkbox = React.forwardRef<
7 React.ElementRef<typeof CheckboxPrimitive.Root>,
8 React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
9 >(({ className, ...props }, ref) => (
10 <CheckboxPrimitive.Root
11 ref={ref}
12 className={cn(
13 'peer flex h-4 w-4 shrink-0 items-center justify-center rounded border border-[#9daf8a] bg-[#fffaf1] text-white shadow-sm transition-colors',
14 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#8eaa70]/45',
15 'data-[state=checked]:border-[#5d6b4d] data-[state=checked]:bg-[#5d6b4d]',
16 'disabled:cursor-not-allowed disabled:opacity-50',
17 className
18 )}
19 {...props}
20 >
21 <CheckboxPrimitive.Indicator className="flex items-center justify-center">
22 <Check className="h-3 w-3" strokeWidth={3} />
23 </CheckboxPrimitive.Indicator>
24 </CheckboxPrimitive.Root>
25 ))
26 Checkbox.displayName = CheckboxPrimitive.Root.displayName
27
27 lines Plain Text