"use client";
import { ToggleButton } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
icon | ReactNode | — | Leading icon (the only content with iconOnly). |
label | string | — | Accessible name. Required with iconOnly. Keep it constant — the pressed state is conveyed by aria-pressed, not by the label. |
onPressedChange | (pressed: boolean) => void | — | Called with the new pressed state. |
pressed | boolean | — | Pressed state (controlled), exposed as aria-pressed. |
tone | ButtonTone | neutral / outline (ghost icon-only) / md | Color role. Default "neutral". |
variant | ButtonVariant | "secondary" | Emphasis. Defaults to "secondary" for the neutral tone and "solid" for colored tones, so <Button> is a secondary button and <Button tone="primary"> the primary call to action. |
asChild | boolean | — | Render the single child element instead, with this component's props, classes, handlers and ref merged in. |
defaultPressed | boolean | — | Initial pressed state when uncontrolled. |
fullWidth | boolean | — | Stretch to the container's inline size. |
iconOnly | boolean | — | Square icon button; label is its accessible name. |
pressedIcon | ReactNode | icon | Icon while pressed (e.g. a filled star); defaults to icon. |
size | ButtonSize | neutral / outline (ghost icon-only) / md | Control height: xs 24, sm 32, md 40 (default), lg 48 px. |
trailing | ReactNode | — | Icon or element after the label. |
iconReactNode
Leading icon (the only content with iconOnly).
labelstring
Accessible name. Required with iconOnly. Keep it constant — the pressed state is conveyed by aria-pressed, not by the label.
onPressedChange(pressed: boolean) => void
Called with the new pressed state.
pressedboolean
Pressed state (controlled), exposed as aria-pressed.
tonedefault neutral / outline (ghost icon-only) / mdButtonTone
Color role. Default "neutral".
variantdefault "secondary"ButtonVariant
Emphasis. Defaults to "secondary" for the neutral tone and "solid" for colored tones, so <Button> is a secondary button and <Button tone="primary"> the primary call to action.
asChildboolean
Render the single child element instead, with this component's props, classes, handlers and ref merged in.
defaultPressedboolean
Initial pressed state when uncontrolled.
fullWidthboolean
Stretch to the container's inline size.
iconOnlyboolean
Square icon button; label is its accessible name.
pressedIcondefault iconReactNode
Icon while pressed (e.g. a filled star); defaults to icon.
sizedefault neutral / outline (ghost icon-only) / mdButtonSize
Control height: xs 24, sm 32, md 40 (default), lg 48 px.
trailingReactNode
Icon or element after the label.
Complex object props use fixed fixtures. Primitive props stay editable.
<ToggleButton variant="outline">Bold</ToggleButton>const [favourite, setFavourite] = useState(false);
<ToggleButton iconOnly label="Favourite" icon={<StarIcon />} pressed={favourite} onPressedChange={setFavourite} tone="warning" />const [favourite, setFavourite] = useState(false);
<ToggleButton variant="outline">Bold</ToggleButton>