mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
Radio Button and Checkbox Created
This commit is contained in:
44
lib/component/input/radio/RadioButton.tsx
Normal file
44
lib/component/input/radio/RadioButton.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user