mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-16 20:49:23 +00:00
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { ComponentProps } from "react";
|
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
|
|
import { cn } from "@/lib/style";
|
|
|
|
const ToggleGroup = ({ className, ...props }: ComponentProps<typeof ToggleGroupPrimitive.Root>) => (
|
|
<ToggleGroupPrimitive.Root className={cn("flex items-center gap-2.5", className)} {...props} />
|
|
);
|
|
|
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
|
|
const ToggleGroupItem = ({
|
|
className,
|
|
children,
|
|
...props
|
|
}: ComponentProps<typeof ToggleGroupPrimitive.Item>) => (
|
|
<ToggleGroupPrimitive.Item
|
|
className={cn(
|
|
"focus-visible:ring-ring inline-flex h-10 items-center justify-center rounded-md bg-accent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-sky-600 data-[state=on]:text-white",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</ToggleGroupPrimitive.Item>
|
|
);
|
|
|
|
export { ToggleGroup, ToggleGroupItem };
|