mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
45 lines
809 B
TypeScript
45 lines
809 B
TypeScript
import type { RadioButtonProps } from "$/types/Input";
|
|
import { Radio } from "@headlessui/react";
|
|
import clsx from "clsx";
|
|
|
|
|
|
export default function RadioButton({
|
|
id,
|
|
className,
|
|
labelClassName,
|
|
size = "sm",
|
|
value,
|
|
children
|
|
}: RadioButtonProps){
|
|
return (
|
|
<Radio
|
|
id={id}
|
|
value={value}
|
|
className="group flex flex-row items-center justify-center gap-x-2 cursor-pointer"
|
|
>
|
|
<div
|
|
className={clsx(
|
|
"rounded-full not-group-data-checked:border",
|
|
className,
|
|
{
|
|
"": size === "none",
|
|
"size-3": size === "xs",
|
|
"size-4": size === "sm",
|
|
"size-5": size === "md",
|
|
"size-6": size === "lg",
|
|
"size-7": size === "xl"
|
|
}
|
|
)}
|
|
/>
|
|
{
|
|
children &&
|
|
<div
|
|
className={labelClassName}
|
|
>
|
|
{children}
|
|
</div>
|
|
}
|
|
</Radio>
|
|
);
|
|
}
|