Angular playground

Nova v3.37.0

Preview

Angular

Toggle

nv-toggle

A switch that turns a single setting on or off immediately.

Live demo

Label Placement

Use a toggle for a setting that takes effect as soon as it changes, such as notifications or dark mode. If a change only applies after saving, or people choose several options from a list, use a checkbox instead.

Anatomy

A toggle with three callouts: 1 marks the label Label, 2 the description below it, and 3 the switch to the right, shown off.

The parts of a toggle, with the label before the switch.
  1. Label names the setting.
  2. Description (optional) explains the effect, such as "You will receive email updates for new messages."
  3. Switch shows whether the setting is on or off. Space toggles it from the keyboard.

States and placement

A toggle is on (checked) or off. Set labelPlacement to before to put the label first, as the design guidelines recommend, so people read the setting before they reach the switch. A disabled toggle cannot be used, and a read-only one shows its state without allowing changes. Hover and keyboard focus provide feedback on an enabled switch. labelPlacement="after" puts the label on the other side when the layout needs it. error and success change its colour; pair them with text that explains why.

off
checked
disabled
labelPlacement="before"
error
success

Themes

The design includes Spark and Ocean appearances. Use the page's theme and mode controls to compare the live examples; retain the same labels, states and validation messages in each theme.

Guidelines

  • Use a short label that names the setting, such as "Email notifications".
  • Apply the change immediately; don't wait for a save button.
  • Match the default to what people expect: opt-in settings start off.
  • Keep the label close to its switch.
DoApply the setting as soon as the toggle changes.
Don'tAvoid toggles that only apply after saving; use a checkbox.

Sources