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>
	);
}
