Skip to content

Switch

ztui switches: Wi-Fi on, Bluetooth off

<Switch> is a boolean toggle styled as a sliding switch — the same data as a Checkbox, a more “settings” look.

import { useState } from "react";
import { Switch } from "@huyz0/ztui/react";
function WifiToggle() {
const [on, setOn] = useState(true);
return <Switch active={on} onChange={setOn} label="Wi-Fi" />;
}
  • active / onChange — controlled boolean.
  • label — text beside the switch.
  • validators / validateOn / onValidate — validation hooks.

Full demo →