Skip to content

Toggle Button

ztui toggle buttons: a bold/italic/underline toolbar with Bold active

<ToggleButton> is a button with a sticky on/off state — ideal for toolbar toggles (bold, italic, …) where the control reflects whether it’s engaged.

import { useState } from "react";
import { ToggleButton } from "@huyz0/ztui/react";
function BoldToggle() {
const [bold, setBold] = useState(false);
return <ToggleButton active={bold} onChange={setBold} label="B" />;
}
  • active / onChange — controlled pressed state.
  • label — button text.
  • onClick — also fired on activation, if you need the raw event.

Full demo →