toggle

Toggle

A button that stays pressed until pressed again, such as saving to a wishlist; plain or outlined, with square icon sizes.

States: Default, Hover, Focus, Checked, Disabled, Invalid

Parts

PartFileDoes
ToggleToggle.vueLets the user switch an option on or off with a button.

Styling

PartRecipe
Toggletoggle

Install

Writes 2 files into components/ui/toggle/. For agents, npx @frontic/ui docs toggle prints this reference as markdown; the MCP server serves the same.

npm packages
@vueuse/core
class-variance-authority
reka-ui

API reference

Toggle Toggle.vue

Lets the user switch an option on or off with a button. Renders a <button>.

PropTypeDefault
defaultValuebooleanfalse
modelValueboolean | null—
disabledbooleanfalse
asChildbooleanfalse
asAsTag | Component'button'
namestring—
requiredbooleanfalse
classClassValue—
variant'default' | 'outline''default'
size'md' | 'sm' | 'lg' | 'icon-sm' | 'icon-md' | 'icon-lg''md'
EventPayload
update:modelValuevalue: boolean
SlotSlot props
default{ modelValue: boolean; state: DataState; pressed: boolean; disabled: boolean; }
Data attributeValues
data-disabled—
data-state'on' | 'off'
Recipe toggleSets
base: toggle 17 properties
variant: defaultdefault 1 property
variant: outline 5 properties
size: mddefault 5 properties
size: sm 5 properties
size: lg 5 properties
size: icon-sm 1 property
size: icon-md 1 property
size: icon-lg 1 property
focus-ringshared state 3 properties
disabledshared state 1 property
Example
State