Back to Tuist

Toggle

noora/docs/components/toggle.md

4.204.01.8 KB
Original Source
<!-- Generated by scripts/generate-web-components.js. Do not edit directly. -->

Toggle

Turns a setting on or off.

html
<noora-toggle label="Notifications" name="notifications"></noora-toggle>

Attributes

AttributeType or allowed valuesDefaultDescription
labelstringNoneSets the visible label.
descriptionstringNoneSets supporting text.
checkedbooleanfalseControls the checked state.
disabledbooleanfalseDisables interaction.
namestring""Sets the submitted field name.
valuestring"on"Sets the submitted field value.

Read-only properties

PropertyTypeDescription
controlHTMLInputElement | nullThe native checkbox input.
formHTMLFormElement | nullThe associated form.

Events

EventTypeDescription
inputInputEventEmitted while the checked state changes.
changeEventEmitted after the checked state changes.

Styling parts

PartDescription
rootThe toggle label.
controlThe visual switch.
labelThe label text.

The component emits standard input and change events.

Basic states

Compare off and on settings.

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

Disabled states

Show disabled settings in both states.

html
<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.

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