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