Skip to main content

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

<govuk-app-button-stack>

Button stack

Holds a screen's main action, and any way out of it, at the bottom of the screen under a divider, where they stay as the content scrolls. Used on screens that ask the user to do something, such as confirm, agree or continue.

GOV.UK app component

Known differences from the app

  • In landscape the app puts the buttons side by side. This always stacks them.
  • The app’s UIKit screens use their own footer, StickyFooterView, whose buttons are 4pt apart rather than 8pt. This draws the SwiftUI one everywhere.
  • With nothing below the screen, such as a home indicator, the app puts its last button at the very bottom. This keeps 16pt under it, so its shadow isn’t cut off.

Examples

An action and a way out

Allow notifications Not now Allow notifications Not now

HTML

<govuk-app-button-stack>
  <govuk-app-button name="allow">Allow notifications</govuk-app-button>
  <govuk-app-button variant="grouped-secondary" name="not-now">Not now</govuk-app-button>
</govuk-app-button-stack>

A destructive action

Sign out Cancel Sign out Cancel

HTML

<govuk-app-button-stack>
  <govuk-app-button variant="destructive" name="sign-out">Sign out</govuk-app-button>
  <govuk-app-button variant="grouped-secondary" name="cancel">Cancel</govuk-app-button>
</govuk-app-button-stack>

One button

Continue Continue

HTML

<govuk-app-button-stack>
  <govuk-app-button name="continue">Continue</govuk-app-button>
</govuk-app-button-stack>

At the bottom of a screen

If you’re using Face ID or Touch ID to unlock the app, this will be turned off. You can turn it on again the next time you sign in.

Sign out Cancel

If you’re using Face ID or Touch ID to unlock the app, this will be turned off. You can turn it on again the next time you sign in.

Sign out Cancel

HTML

<govuk-app-screen background="modal">
  <p>If you’re using Face ID or Touch ID to unlock the app, this will be turned off. You can turn it on again the next time you sign in.</p>
  <govuk-app-button-stack slot="footer">
    <govuk-app-button variant="destructive" name="sign-out">Sign out</govuk-app-button>
    <govuk-app-button variant="grouped-secondary" name="cancel">Cancel</govuk-app-button>
  </govuk-app-button-stack>
</govuk-app-screen>

Inputs

It takes no attributes.

Content

One or two <govuk-app-button> elements, top to bottom: the main action, as a primary or destructive button, then any way out of it as a grouped secondary button. Give the stack slot="footer" to pin it to the bottom of a <govuk-app-screen>.

Outputs

None.

Rules

  • Put it in a <govuk-app-screen> with slot="footer", so it stays at the bottom as the content scrolls.
  • Put the main action first, as a primary button, or a destructive one if it deletes or removes something. Put any way out of it second, as a grouped secondary button, such as Cancel or Not now.
  • Use no more than two buttons.
  • Don't use it on a screen with a tab bar: the app hides the tab bar on screens that ask the user to act.

When not to use it

When Use instead
For a lighter action within the content, such as on a card govuk-app-button variant="compact"
For an action on the whole screen that doesn't move the journey on, such as Edit govuk-app-nav-bar-item
On a top-level screen, with a tab bar Put the action on a screen of its own, pushed on top, without the tab bar, and put the button stack there.
For more than two choices govuk-app-grouped-list-row type="navigation"

Sources

The iOS, Android and Figma sources it was built from
  • iOS: ButtonStackView in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/SwiftUIViews/ButtonStackView.swift at 1e520fc1
  • iOS: PrimaryButtonView in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/SwiftUIViews/PrimaryButtonView.swift at 1e520fc1
  • iOS: StickyFooterView in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Extensions/Views/StickyFooterView.swift at 1e520fc1
  • iOS: strokes.fixedContainer in govuk-once/govuk-mobile-ios-gov-kit/GovKitUI/Sources/Colors/GOVUKColors+Strokes.swift at 8a7641e
  • Figma: none linked yet

In the app

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

iOS

iOS app: Sign out and Cancel, on the sign-out confirmation, in light mode
Sign out and Cancel, on the sign-out confirmation, in light mode
iOS app: Sign out and Cancel, in dark mode
Sign out and Cancel, in dark mode
iOS app: Share statistics and Not now, on analytics consent
Share statistics and Not now, on analytics consent