- iOS:
ButtonStackViewin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/SwiftUIViews/ButtonStackView.swift at 1e520fc1 - iOS:
PrimaryButtonViewin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/SwiftUIViews/PrimaryButtonView.swift at 1e520fc1 - iOS:
StickyFooterViewin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Extensions/Views/StickyFooterView.swift at 1e520fc1 - iOS:
strokes.fixedContainerin govuk-once/govuk-mobile-ios-gov-kit/GovKitUI/Sources/Colors/GOVUKColors+Strokes.swift at 8a7641e - Figma: none linked yet
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
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
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
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.
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.
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" |
iOS