Toggle

Actions

A button that stays pressed until pressed again (bind:pressed), announced as pressed or not. variant (default, outline) and size (sm, default, lg) as for buttons.

import { Toggle } from '@limerdev/zest';
Toggle for AI tools (llms.txt)
Use for
One on/off formatting or view option in a toolbar: bold, show grid, pin.
Don't
A setting in a form or settings page: use Switch or Checkbox. Several related toggles: use ToggleGroup. A toggle without a name: label icon-only ones with aria-label.

Examples

Basic

Toggles stay pressed. Name icon-only ones with aria-label.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Toggle

Prop Type Default Description
disabled null | false | true false Whether the toggle is disabled or not.
onPressedChange OnChangeFn<boolean> – A callback function called when the toggle is pressed.
pressed bindable boolean false Whether the toggle is pressed or not.
size "default" | "sm" | "lg" 'default' The height and padding, from the theme's field size.
variant "outline" | "default" 'default' default is plain until pressed; outline has a border.