Primitives
Toggle a button on and off.
Import the Toggle primitives from ng-primitives/toggle
.
import { NgpToggle } from 'ng-primitives/toggle';
Assemble the toggle directives in your template.
<button ngpToggle [(ngpToggleSelected)]="selected">Toggle</button>
The following directives are available to import from the ng-primitives/toggle
package:
Apply the ngpToggle
directive to an element to manage the toggle state. This must be applied to a button
element.
[ngpToggle]
ngpToggle
The following data attributes are applied to the ngpToggle
directive:
Attribute | Description |
---|---|
data-selected |
Applied when the toggle is selected. |
data-disabled |
Applied when the toggle is disabled. |
Copyright © 2024 Angular Primitives