Skip to content
TallCraftUI

Toggle

On/off switch for boolean settings.

Basic usage

Blade
<x-toggle />
<x-toggle label="Label" />
<x-toggle label="Label *" />

Text left New

Blade
<x-toggle label="Label" text-left />

Size variants New

Blade
<x-toggle checked sm />
<x-toggle checked md /> {{-- default --}}
<x-toggle checked lg />

Color variants New

Blade
<x-toggle checked />
<x-toggle checked secondary />
<x-toggle checked slate />
<x-toggle checked zinc />
<x-toggle checked gray />
<x-toggle checked neutral />
<x-toggle checked stone />
<x-toggle checked red />
<x-toggle checked orange />
<x-toggle checked amber />
<x-toggle checked yellow />
<x-toggle checked lime />
<x-toggle checked green />
<x-toggle checked emerald />
<x-toggle checked teal />
<x-toggle checked cyan />
<x-toggle checked sky />
<x-toggle checked blue />
<x-toggle checked indigo />
<x-toggle checked violet />
<x-toggle checked purple />
<x-toggle checked fuchsia />
<x-toggle checked pink />
<x-toggle checked rose />
<x-toggle checked black />
<x-toggle checked white />

Customize toggle New

You can easily customize any toggle using standard css classes.
Blade
<x-toggle class="peer-focus:ring-4 ring-offset-0" checked />
<x-toggle class="w-16 h-8 after:h-7 after:w-7 after:start-[4px] peer-focus:ring-0 ring-offset-0 peer-focus:ring-blue-600 dark:peer-focus:ring-blue-600 peer-checked:bg-blue-600" checked />

API reference

Props are read from the component classes in TallCraftUI 3.0.0-beta.1. Write them in kebab-case and pass booleans as bare attributes, for example <x-button outline />. Other attributes, such as class or wire:model, are passed to the component's element.

<x-toggle>

View source
Prop Type Default
label string null
text-left bool false
required bool false
Colors
primary secondary black white slate gray zinc neutral stone red orange amber yellow lime green emerald teal cyan sky blue indigo violet purple fuchsia pink rose
Config
toggle.border-radius = rounded-sm Change defaults