Usage

Assemble the switch directives in your template.

<button ngpSwitch [(ngpSwitchChecked)]="checked">
  <span ngpSwitchThumb></span>
</button>

API Reference

The following directives are available to import from the @ng-primitives/ng-primitives/switch package:

NgpSwitchDirective

ngpSwitchChecked
boolean
default: "false"

Define the checked state.

ngpSwitchDisabled
boolean
default: "false"

Define the disabled state.

ngpSwitchCheckedChange
boolean

Event emitted when the state changes.

NgpSwitchThumbDirective

There are no inputs or outputs for this directive.

Schematics

You can use our schematic to generate a new switch component.

Options

name
string

The name of the component.

project
string

The name of the project to add the component to.

path
string

The path to create the component.