OpChan/src/components/ui/toggle.tsx

23 lines
683 B
TypeScript
Raw Normal View History

2025-08-30 18:34:50 +05:30
import * as React from 'react';
import * as TogglePrimitive from '@radix-ui/react-toggle';
import { type VariantProps } from 'class-variance-authority';
2025-04-15 16:28:03 +05:30
2025-08-30 18:34:50 +05:30
import { cn } from '@/lib/utils';
import { toggleVariants } from './toggle-variants';
2025-04-15 16:28:03 +05:30
const Toggle = React.forwardRef<
React.ElementRef<typeof TogglePrimitive.Root>,
React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
VariantProps<typeof toggleVariants>
>(({ className, variant, size, ...props }, ref) => (
<TogglePrimitive.Root
ref={ref}
className={cn(toggleVariants({ variant, size, className }))}
{...props}
/>
2025-08-30 18:34:50 +05:30
));
2025-04-15 16:28:03 +05:30
2025-08-30 18:34:50 +05:30
Toggle.displayName = TogglePrimitive.Root.displayName;
2025-04-15 16:28:03 +05:30
2025-08-30 18:34:50 +05:30
export { Toggle };