Toggle

Turns a setting on or off.

Toggle web component

Turns a setting on or off.

Setup

import "@tuist/noora/tokens.css";
import "@tuist/noora/web-components";

Basic states

Compare off and on settings.

<noora-toggle label="Enable notifications"></noora-toggle>
<noora-toggle label="Email alerts" checked></noora-toggle>

Disabled states

Show disabled settings in both states.

<noora-toggle label="Disabled off" disabled></noora-toggle>
<noora-toggle label="Disabled on" checked disabled></noora-toggle>

With description

Explain the setting below its label.

<noora-toggle label="Marketing emails" description="Receive updates about new features and promotions"></noora-toggle>

Attributes

Attribute Type or allowed values Default Description
label string None Sets the visible label.
description string None Sets supporting text.
checked boolean false Controls the checked state.
disabled boolean false Disables interaction.
name string "" Sets the submitted field name.
value string "on" Sets the submitted field value.

Events

Event Type Description
input InputEvent Emitted while the checked state changes.
change Event Emitted after the checked state changes.

Styling parts

Name Description
root The toggle label.
control The visual switch.
label The label text.

Behavior

The component emits standard input and change events.