43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
|
import { Circle } from 'lucide-react'
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
function RadioGroup({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
return (
|
|
<RadioGroupPrimitive.Root
|
|
data-slot="radio-group"
|
|
className={cn("grid gap-2", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function RadioGroupItem({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
return (
|
|
<RadioGroupPrimitive.Item
|
|
data-slot="radio-group-item"
|
|
className={cn(
|
|
"aspect-square size-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
<Circle className="size-3.5 fill-current text-current" />
|
|
</RadioGroupPrimitive.Indicator>
|
|
</RadioGroupPrimitive.Item>
|
|
)
|
|
}
|
|
|
|
export { RadioGroup, RadioGroupItem }
|