Toggle
Two-state pressed buttons — icon-only (`IconToggle`) or labeled (`Toggle`) with optional start/end icons.
Show codeHide code
Installation
import { IconToggle, Toggle } from "@makeplane/propel/components/toggle";Usage
import { Icon } from "@makeplane/propel/components/icon";
import { IconToggle } from "@makeplane/propel/components/toggle";
import { Star } from "lucide-react";
import { useState } from "react";
export default function BasicDemo() {
const [pressed, setPressed] = useState(false);
return (
<IconToggle
size="md"
aria-label="Favorite"
pressed={pressed}
onPressedChange={setPressed}
icon={<Icon icon={<Star fill={pressed ? "currentColor" : "none"} />} />}
/>
);
}Examples
IconToggle sizes and variants
IconToggle is the icon-only specialization. The size axis is xs·sm·md (20/24/28px).
variant is secondary (raised bordered, default) or ghost (transparent).
Show codeHide code
IconToggle states
Start pressed via defaultPressed; a disabled toggle does not respond to clicks.
Show codeHide code
Controlled IconToggle
Own the state with pressed and onPressedChange to derive the glyph from it.
Show codeHide code
Text Toggle
Toggle is the labeled form — optional startIcon / endIcon, a required label, and the same
xs·sm·md size ladder. Labels truncate past 120px.
Show codeHide code
API Reference
IconToggle
The ready-made icon-only toggle: grafts Base UI's `Toggle` behavior onto the styled `IconToggle` button (behavior outer, the styled button as the render target).
Toggle
The ready-made label toggle: grafts Base UI's `Toggle` behavior onto the styled `Toggle` button (behavior outer, the styled button as the render target), with an optional leading node, the `ToggleLabel`, and an optional trailing node. The selected look is the container's pressed state.