Skip to main content

These components are for prototyping the GOV.UK app, not for use in production.

<govuk-app-toggle>

Toggle

Switches something on or off straight away, such as sharing app usage statistics.

Native component

In a grouped list

A grouped list’s toggle row draws one of these, with the row’s title as its name. Use the row for a setting in a list, as on Settings, and the toggle on its own anywhere else.

Naming it

Give it a label, its name for screen readers. Or put it in a <label> with the text beside it, which names it, and lets that text be pressed to switch it too:

<label>
  Share app usage statistics
  <govuk-app-toggle name="statistics" checked></govuk-app-toggle>
</label>

Known differences from the app

  • It’s iOS’s switch as the app’s snapshots draw it, 51pt by 31pt. iOS 26 on a phone draws a wider one, in Liquid Glass.
  • Android draws Material’s switch, in the app’s colours, which this doesn’t.
  • It can only be pressed, not dragged from one side to the other.

Examples

On

HTML

<govuk-app-toggle name="statistics" label="Share app usage statistics" checked></govuk-app-toggle>

Off

HTML

<govuk-app-toggle name="statistics" label="Share app usage statistics"></govuk-app-toggle>

Inputs

Attributes
Attribute Type Default Description
checked boolean false Whether it is on.
label string Its name for screen readers, such as Share app usage statistics. Leave it off inside a <label> that names it already.
name string Its name, to tell it apart in its change event or in a form.
value string Its value, sent with a form when it is on.

Content

None.

Outputs

  • change: From its checkbox, with its name and value, when it is switched. Read event.target.checked for whether it is on.

Rules

  • Use a toggle for something that takes effect as soon as it is switched, not for a choice confirmed with a button.
  • For a setting in a list, use a grouped list's toggle row, as the app does on Settings. Use a toggle on its own only where there's no list for it.
  • Always give it a name: a label, or a <label> around it and the text beside it.
  • Name it for what it turns on, such as Share app usage statistics, not On or Off.

When not to use it

When Use instead
For a setting in a list, as on Settings govuk-app-grouped-list-row type="toggle"
For a choice the user confirms with a button govuk-app-grouped-list-row type="selectable"
To switch between views of the same thing govuk-app-segmented-control

Sources

The iOS, Android and Figma sources it was built from
  • iOS: ToggleRowView in govuk-once/govuk-mobile-ios-gov-kit/GovKit/Sources/SwiftUIViews/GroupedList/GroupedListRowView.swift at 8a7641e
  • iOS: surfaceToggleSelected in govuk-once/govuk-mobile-ios-gov-kit/GovKitUI/Sources/Colors/GOVUKColors+Fills.swift at 8a7641e
  • Android: ToggleSwitch in govuk-once/govuk-mobile-android-app/design/src/main/kotlin/uk/gov/govuk/design/ui/component/Switch.kt at 16621861
  • Figma: none linked yet
  • Apple Human Interface Guidelines: Toggles

In the app

Screenshots of the app's own component, to compare the examples with

iOS

iOS app: On, in a grouped list's toggle row (Row title 4), in light mode
On, in a grouped list's toggle row (Row title 4), in light mode
iOS app: The same, in dark mode
The same, in dark mode

Android

Android app: On
On