Skip to content
Eskais UI

Forms

Toggle

UI SDK Toggle: a button that stays pressed, with variants and sizes.

Example

Installation

npx shadcn@latest add @eskais/toggle
Brings alongtooltip
npm packagesclass-variance-authority@0.7.1

Usage

Import
import { createToggleController, Toggle, ToggleIcon, toggleVariants } from "@/components/ui/toggle"

API reference

Toggle

PropTypeDefault
variant"default" | "outline""default"
tooltipAn icon toggle shows its `aria-label` in a tooltip; `false` turns it off, text or `{ content, side }` replaces it.ControlTooltipOption–
size"sm" | "default" | "lg" | "icon"–
aria-labelstring–

Also takes every prop of UI SDK Toggle except aria-label.

Other exports

createToggleControllertoggleVariantstype TogglePropstype ToggleControllertype TogglePressedChangeReasontype ToggleState

Accessibility

  • A button that stays pressed, with aria-pressed. Pressed is a full primary fill for 3:1.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.