mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-07 14:13:58 -05:00
36 lines
571 B
TypeScript
36 lines
571 B
TypeScript
import type { MattrixwvButtonSwitchProps } from "$/types/Input";
|
|
import { Switch } from "@headlessui/react";
|
|
|
|
|
|
export default function ButtonSwitch({
|
|
id,
|
|
className,
|
|
name,
|
|
value,
|
|
defaultChecked,
|
|
checked,
|
|
onChange,
|
|
disabled,
|
|
onNode,
|
|
offNode
|
|
}: MattrixwvButtonSwitchProps){
|
|
return (
|
|
<Switch
|
|
id={id}
|
|
className={className}
|
|
name={name}
|
|
value={value}
|
|
defaultChecked={defaultChecked}
|
|
checked={checked}
|
|
onChange={onChange}
|
|
disabled={disabled}
|
|
>
|
|
{({ checked }) => (
|
|
<>
|
|
{checked ? onNode : offNode}
|
|
</>
|
|
)}
|
|
</Switch>
|
|
);
|
|
}
|