"use client";
import React, { useState } from "react";
import Switch from "../components/Switch";
export default function FormsPlayground() {
const [switchStates, setSwitchStates] = useState({
switch1: false,
switch2: true,
switch3: false,
switch4: true,
});
const handleSwitchChange = (switchName) => {
setSwitchStates((prev) => ({
...prev,
[switchName]: !prev[switchName],
}));
};
return (
Forms Playground
Switch Examples
Switch States
handleSwitchChange("switch1")}
label="Switch label"
/>
handleSwitchChange("switch2")}
label="Switch label"
/>
handleSwitchChange("switch3")}
state="focus"
label="Switch label"
/>
handleSwitchChange("switch4")}
state="focus"
label="Switch label"
/>
Interactive Example
handleSwitchChange("switch1")}
label="Enable notifications"
/>
handleSwitchChange("switch2")}
label="Auto-save documents"
/>
handleSwitchChange("switch3")}
label="Dark mode"
/>
handleSwitchChange("switch4")}
label="Email updates"
/>
);
}