Skip to main content

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

<govuk-app-stack>

Stack

Lays out a few components in a row or a column, lined up and spaced as a screen needs, where no other component already does: such as a vehicle's number plate and menu button side by side on the right of its card, as the future driving designs show them.

Native component

Examples

A heading and a number plate, at either end

Lamborghini LH09 PZ2 Lamborghini LH09 PZ2

HTML

<govuk-app-stack direction="horizontal" distribute="between">
  <govuk-app-heading level="2" size="title-2">Lamborghini</govuk-app-heading>
  <govuk-app-number-plate>LH09 PZ2</govuk-app-number-plate>
</govuk-app-stack>

Two buttons side by side

No Yes No Yes

HTML

<govuk-app-stack direction="horizontal" gap="medium">
  <govuk-app-button variant="secondary" name="no">No</govuk-app-button>
  <govuk-app-button name="yes">Yes</govuk-app-button>
</govuk-app-stack>

A column, centred

You’ve signed out You need to sign in again to use the app You’ve signed out You need to sign in again to use the app

HTML

<govuk-app-stack>
  <govuk-app-heading level="2" size="title-2" align="center">You’ve signed out</govuk-app-heading>
  <govuk-app-text align="center">You need to sign in again to use the app</govuk-app-text>
</govuk-app-stack>

Inputs

Attributes
Attribute Type Default Description
direction "vertical" | "horizontal" vertical vertical, a column, as a VStack; horizontal, a row, as an HStack.
align "start" | "center" | "end" center How its items line up across it: in a row, top, middle or bottom; in a column, left, centre or right.
distribute "start" | "end" | "between" start Where its items go along it: at its start, at its end, or the first at the start and the last at the end, as with a Spacer between them.
gap "none" | "extra-small" | "small" | "medium" | "large" small The space between its items, from the spacing scale: 0, 4, 8, 16 or 24pt.

Content

The components it lays out, in order.

Outputs

None.

Rules

  • Use it only where no other component already lays things out: a screen, a section, a grouped list's content row and summary columns all space what they hold.
  • Keep a row to a few short items, so they fit side by side on a phone.
  • Leave gap at small, SwiftUI's own spacing, unless the design asks for another.

When not to use it

When Use instead
To space a screen's parts apart govuk-app-section
For a few short facts side by side, with dividers between them govuk-app-summary-columns
For buttons at the bottom of a screen govuk-app-button-stack
For rows on a card govuk-app-grouped-list

Sources

The iOS, Android and Figma sources it was built from