Twitter0

Toggle

A two-state button that can be either on or off.

Installation

ng g @spartan-ng/cli:ui toggle

Usage

import { HlmToggleImports } from '@spartan-ng/helm/toggle';
<button hlmToggle>Toggle</button>

Examples

Outline

With Text

Small

Large

Disabled

Brain API

BrnToggle

Selector: button[brnToggle]

Inputs

PropTypeDefaultDescription
id unknown `brn-toggle-${++BrnToggle._uniqueId}` The id of the toggle.
value T - The value this toggle represents.
disabled boolean false Whether the toggle is disabled.
type 'button' | 'submit' | 'reset' button The type of the button.
aria-label string | null null Accessibility label for screen readers. Use when no visible label exists.
state 'on' | 'off' off The current state of the toggle when not used in a group.

Outputs

PropTypeDefaultDescription
stateChanged 'on' | 'off' off The current state of the toggle when not used in a group.

Helm API

HlmToggle

Selector: button[hlmToggle]

Inputs

PropTypeDefaultDescription
variant ToggleVariants['variant'] default -
size ToggleVariants['size'] default -
class ClassValue --
Toggle Group Textarea