toggle.tsx raw
1 import * as React from "react";
2 import { type VariantProps } from "class-variance-authority";
3 import { Toggle as TogglePrimitive } from "radix-ui";
4
5 import { cn } from "src/lib/utils";
6 import { toggleVariants } from "src/components/ui/toggleVariants";
7
8 function Toggle({
9 className,
10 variant,
11 size,
12 ...props
13 }: React.ComponentProps<typeof TogglePrimitive.Root> &
14 VariantProps<typeof toggleVariants>) {
15 return (
16 <TogglePrimitive.Root
17 data-slot="toggle"
18 className={cn(toggleVariants({ variant, size, className }))}
19 {...props}
20 />
21 );
22 }
23
24 export { Toggle };
25