Toggle

A two-state button that can be either on or off.

Default

The standard toggle button.

Outline

A toggle with an outline variant.

With Text

Combining icons and text within a toggle.

Sizes

Small and large size variations.

Small

Large

Cool Colors

Custom status colors using Tailwind utility classes.

Educational Examples

Use cases for toolbars and security settings.

Development Tools

Toggles are perfect for binary states in application toolbars or settings.

Security Preferences

Combine Spartan UI with Tailwind utility classes to create distinct active states.

Disabled

A disabled toggle button state.

Installation & Usage

Installation

Imports

Basic Usage

API Reference

Brain API

The Brain component provides the core logic and accessibility for the toggle.

DirectiveSelectorInputs
BrnTogglebrn-toggle
  • disabled: boolean
  • on: boolean

Helm API

The Helm component provides the spartan/ui styling for the toggle.

DirectiveSelectorInputs
HlmTogglebutton[hlmToggle]
  • variant: 'default' | 'outline'
  • size: 'default' | 'sm' | 'lg'