返回 oh-my-ppt
ToggleGroup.tsx
根目录 / src / renderer / src / components / ui / ToggleGroup.tsx
1 import * as React from 'react'
2 import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'
3 import { cn } from '@renderer/lib/utils'
4
5 export const ToggleGroup = ToggleGroupPrimitive.Root
6
7 export const ToggleGroupItem = React.forwardRef<
8 React.ElementRef<typeof ToggleGroupPrimitive.Item>,
9 React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>
10 >(({ className, ...props }, ref) => (
11 <ToggleGroupPrimitive.Item
12 ref={ref}
13 className={cn(
14 'inline-flex h-8 w-8 shrink-0 items-center justify-center text-[#6a745a] transition-colors',
15 'focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#8fbc8f]',
16 'disabled:pointer-events-none disabled:opacity-45',
17 'data-[state=on]:bg-[#5d6b4d] data-[state=on]:text-white data-[state=on]:shadow-[0_5px_12px_rgba(93,107,77,0.18)]',
18 'data-[state=off]:hover:bg-[#d4e4c1]/72',
19 className
20 )}
21 {...props}
22 />
23 ))
24 ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
25
26
26 lines Plain Text