Toggle
Example
Section titled “Example”Import
Section titled “Import”import '@sbddesign/bui-ui/toggle.js'import { BuiToggleReact as BuiToggle } from '@sbddesign/bui-ui/react'<bui-toggle></bui-toggle><BuiToggle></BuiToggle>Properties
Section titled “Properties”| Property | Attribute | Type | Required | Reflected | Description |
|---|---|---|---|---|---|
active | active | boolean | No | Yes | Whether the toggle is active/on |
size | size | string | No | No | Toggle size: “big”, “small” |
disabled | disabled | boolean | No | Yes | Whether the toggle is disabled |
Valid Values
Section titled “Valid Values”Toggle Sizes
Section titled “Toggle Sizes”big- Large toggle sizesmall- Small toggle size
Behavior
Section titled “Behavior”- Active State: The
activeproperty controls whether the toggle is on or off - Size Control: The
sizeproperty determines the visual size of the toggle - Disabled State: When
disabledis true, the toggle becomes non-interactive - State Management: The
activeanddisabledproperties are reflected for reactive updates - User Interaction: Users can click to toggle between active/inactive states
- Validation: The component includes validation rules for proper state management
Events
Section titled “Events”The toggle component emits a click event when toggled:
- Click Event: Emitted when the toggle is clicked (unless disabled)
- State Change: The
activeproperty updates when the toggle is clicked - Disabled State: No events are emitted when disabled