Skip to content

Official government website An official website of the Federal Government of Nigeria

How you know
Federal Ministry of Communications, Innovation & Digital Economy Nigerian Design Standards

Toggle

Changes a setting immediately, like turning on email updates in account settings. The change is saved straight away, so there is no submit button.

Updated

Live example

Toggle
Controls
Property Control What it does
Default, active or disabled
On
Switches the setting on
The setting, in a few words

Overview

Use a toggle when a setting should take effect as soon as someone flips it — account preferences, notifications, and similar controls.

Use a toggle for

  • Settings that take effect straight away
  • Turning one feature on or off
  • Account preferences, like email updates

Don’t use a toggle for

  • Anything in a form with a submit button (use a checkbox)
  • More than two options (use radios)
  • Agreeing to terms (use a checkbox)

States

The toggle’s states. On and Off are always shown in words next to the track. When a setting is disabled, say why next to it on the page—not only in the status word.

Off

A 40 × 24 track in text/muted, with “Off” in words.

On

action/primary/default track, knob to the right, with “On”.

Active

2px border/dark around the track. Not the keyboard focus ring.

Disabled

Can’t be changed. Say why next to it.

Specifications

The properties of the toggle. The same in HTML, WordPress and React.

Toggle properties
Property Type Possible values Description
label string any text The setting’s name. It is the switch’s accessible name.
on boolean
  • false default
  • true
Whether the setting is on.
disabled boolean
  • false default
  • true
Avoid where you can: explain why an option isn’t available instead.

In code, use a <button> with role="switch" and aria-checked, named by the visible label with aria-labelledby. Save the change straight away, then announce the result with a status message.

Tokens

Toggle tokens and contrast
Part Token Contrast on the page
Track spacing/500 × spacing/300 (40 × 24px) · radius/200 —
Off track text/muted 6.6:1
On track action/primary/default 5.8:1
Active border/dark, 2px 14.3:1
Knob size/icon/md (20px) · surface/canvas —
Label Body/medium · text/primary 17.6:1
Spacing spacing/100 (8px) between track and On or Off text —

Use cases

Do

Use a toggle for a setting that saves straight away, and show On or Off in words.

Don’t

Don’t use a toggle inside a form with a submit button. Use a checkbox.

Layout

How toggles are laid out.

Name first
Put the setting’s name before the toggle, on the same row.
One setting per row
Stack settings, one per line.
40 × 24 track
Then “On” or “Off” in words, 8px after the track.
Saves straight away
No submit button. The change is saved immediately.
Show the result
Announce the change in a status message, for example “Email updates turned on”.

Copywriting

How to name the setting and confirm the change.

Name the setting
“Email updates”, not “Do you want email updates?”
Say On and Off
The words beside the track, not only the colour.
Describe the outcome

A hint like “We’ll email you when your application changes”.

No double negatives
“Email updates”, not “Disable email updates”.
Confirm the change
“Email updates turned on”.
Same words everywhere
Use the same setting name on every page.

Examples

Toggle copywriting examples
Write Don’t write Why
Email updates Do you want to receive email updates? A short name for the setting.
Email updates turned on Settings saved successfully! Says what changed.
Show my phone number Hide my phone number: Off No double negatives.
On · Off Yes · No Matches a switch.
We’ll email you when your application changes Toggle to receive notifications Says what happens.

Accessibility

A button with role=“switch”, labelled by the setting name, with On or Off shown in words.

Keyboard interaction for toggles
Key What it does
Tab Moves focus to the switch.
Shift+Tab Moves focus back to the previous element.
Space or Enter Switches the setting on or off straight away.
  • The switch is a button with role="switch" and aria-checked, named by the visible label (WCAG 4.1.2).
  • On or Off is shown in words beside the track, not by colour alone (WCAG 1.4.1).
  • When the setting changes, announce the result in a status message (WCAG 4.1.3).
  • The off track is 6.6:1 and the on track 5.9:1 against the page (WCAG 1.4.11).
  • Active shows a 2px border/dark focus ring around the track (WCAG 2.4.7).

For developers

Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.

For designers

Use Form/Toggle from 01 Library – Foundations. Set On, State and the Label. Don’t detach it.

References

Feedback

Report a problem with this page