Toggle#

Toggle switch component for boolean on/off states with model binding support.

Import#

TSX
import { Toggle, Row, Col, Text, Heading } from '@sigx/daisyui';

Basic Usage#

Use model for two-way binding:

TSX
Loading preview...

Sizes#

TSX
Loading preview...

Colors#

TSX
Loading preview...

Without Label#

TSX
Loading preview...

Settings Panel Example#

TSX
Loading preview...

Disabled State#

TSX
Loading preview...

Toggle vs Checkbox#

Use Toggle for settings that take effect immediately. Use Checkbox for selections that are submitted with a form.

TSX
Loading preview...

Props#

PropTypeDefaultDescription
model() => signal.property-Model binding for boolean value
namestring-Toggle name for form submission
labelstring-Label text displayed next to toggle
size'xs' | 'sm' | 'md' | 'lg''md'Toggle size
color'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'-Toggle color when on
disabledbooleanfalseDisable the toggle
classstring-Additional CSS classes

Events#

EventTypeDescription
onChange(checked: boolean) => voidFired when toggle state changes