M Majid DS mds
GitHub

Flux components

Toggle

A button that holds an on/off state.

Where a switch is a form control, a toggle is a button that stays pressed — a bold button in an editor, a favorite star, a filter pill.

Bold
<flux:toggle label="Bold" icon="bold" />

Checked and icons

Bold
Italic
Underline
<div class="flex items-center gap-2">
    <flux:toggle icon="bold" label="Bold" checked />
    <flux:toggle icon="italic" label="Italic" />
    <flux:toggle icon="underline" label="Underline" />
</div>

On and off states

Give each state its own label or icon.

Save
<flux:toggle on-icon="heart" off-icon="heart" on-label="Saved" off-label="Save" color="rose" />

Sizes

Small
Base
<div class="flex items-center gap-2">
    <flux:toggle size="sm" label="Small" icon="star" />
    <flux:toggle label="Base" icon="star" />
</div>

Reference

flux:toggle

PropDescription
labelButton text.
iconIcon name.
checkedPressed state.
on-labelLabel used while on.
off-labelLabel used while off.
on-iconIcon used while on.
off-iconIcon used while off.
variantOptions: outline, ghost, subtle, filled. Default: outline.
sizeOptions: sm, base. Default: base.
colorAny Tailwind color for the pressed state.
nameSubmitted field name.
wire:modelBinds to a Livewire property.

Related