Toggle
A two-state button that can be either on or off.
Preview
A preview of the Toggle component with interactive controls.
Interactive
Installation
Add the Toggle component to your project.
ng g @ng-cn/core:c toggleUsage
Import and use the Toggle component in your Angular application.
<Toggle aria-label="Toggle bold">
<lucide-icon name="bold" class="h-4 w-4" />
</Toggle>Examples
Explore different variations and use cases for the Toggle component.
Basic
Interactive
With Text
Interactive
Outline
Interactive
API Reference
Props | Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'outline' | 'default' | The visual style of the toggle. |
size | 'default' | 'sm' | 'lg' | 'default' | The size of the toggle. |
pressed | boolean | false | Whether the toggle is pressed. |