Toggle
Enhanced two-state button component with smooth animations, multiple variants, and improved accessibility. Perfect for toggling options, settings, and formatting tools.
Pro Features
Unlock advanced capabilities with the Pro version
9 Color Variants
Primary, secondary, success, warning, danger, and gradient options
6 Size Options
From extra small to extra large for any use case
4 Shape Variants
Default, square, rounded, and pill shapes
Loading States
Built-in loading spinner for async operations
Badge Support
Display counts or labels with customizable badges
Dynamic Icons
Switch between icons based on toggle state
Installation
Install via CLI
moonui add toggle
Usage
Basic Usage
Pro Usage
Examples
Basic Toggle
Simple toggle with icon
Sizes
Different toggle sizes
Variants
Different visual styles
Controlled
Controlled toggle with state
Audio Toggle
Toggle with dynamic icons
Formatting Toolbar
Multiple toggles for text formatting
Color Variants
Multiple color options for different use cases
Size Variants
Six size options from XS to XL
Shape & Badge
Different shapes with badge support
Icons & Loading
Dynamic icons with loading states