switch

A control that allows the user to toggle between checked and unchecked.

PreviousNext

Installation

1

Run the CLI

Use the CLI to add the component to your project.

npx @ngzard/ui@latest add switch

Examples

default

destructive

size

disabled

API

[z-switch] Component

z-switch is a component that brings you a customizable switch with minimal configuration

To get a customized switch, just pass the following props to the component.

Property Description Type Default
[class] Additional CSS classes ClassValue ''
[(zChecked)] switch state (two-way binding) boolean true
[zDisabled] switch disabled state boolean false
[zId] switch id string
[zType] switch type default | destructive default
[zSize] switch size default | sm | lg default

Note: Component uses fallback content (also called default content), Angular 18+ feature.