- iOS:
present(_:animated:)in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Coordinators/BaseCoordinator.swift at 1e520fc1 - iOS:
startSignOutin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Coordinators/SettingsCoordinator.swift at 1e520fc1 - Figma: none linked yet
- Apple Human Interface Guidelines: Sheets
- The app prototyping system's viewer, whose sheet this follows (app-prototyping-system, exploration-2/viewer/css/app.css)
Sheet
Presents a screen over the one the user was on, for a task they finish or cancel before going back, such as signing out, finding their local council or choosing a country. The screen it was presented from is set back behind it.
Native component
Presenting it
A sheet is a page of its own. To present one from a screen, link to that page, and give the sheet present there, so it comes up from the bottom when the page loads:
<govuk-app>
<govuk-app-sheet present>
<govuk-app-screen slot="behind">
…the screen it was presented from…
</govuk-app-screen>
<govuk-app-screen background="modal">
…the sheet's screen…
</govuk-app-screen>
</govuk-app-sheet>
</govuk-app>
Its later screens are pages with the same sheet, without present.
A page that draws screens itself, such as a prototype viewer, can add a sheet with present at any time, and it comes up from the bottom when it’s added.
Every screen in a sheet starts with a navigation bar with a close action, so it can always be dismissed, even if it has Cancel too. The sheet leaves room above the bar for it. To close the sheet, link the close action back to the screen it was presented from:
<govuk-app-nav-bar>
<govuk-app-nav-bar-item icon="close" href="settings.html">Close</govuk-app-nav-bar-item>
</govuk-app-nav-bar>
Known differences from the app
- The gap above the sheet, its corners and how far the screen behind is set back are the system’s, which the app’s snapshots don’t show, so they’re approximate.
- Closing it goes straight to the page behind: it doesn’t slide down first.
- It can’t be pulled down to close it, as the app’s sheets can unless they ask not to be.
- The status bar doesn’t turn white over the black behind the sheet, as iOS’s does in light mode.
Examples
Over the screen it was presented from
HTML
<govuk-app-sheet>
<govuk-app-screen slot="behind">
<govuk-app-nav-bar title="Settings" large-title></govuk-app-nav-bar>
<govuk-app-grouped-list>
<govuk-app-grouped-list-row type="detail" destructive>Sign out</govuk-app-grouped-list-row>
</govuk-app-grouped-list>
</govuk-app-screen>
<govuk-app-screen background="modal">
<govuk-app-nav-bar>
<govuk-app-nav-bar-item icon="close" name="close">Close</govuk-app-nav-bar-item>
</govuk-app-nav-bar>
<govuk-app-heading level="1" size="title-1">Are you sure you want to sign out?</govuk-app-heading>
<govuk-app-text>If you’re using Face ID or Touch ID to unlock the app, this will be turned off.</govuk-app-text>
<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>
</govuk-app-sheet>
With a navigation bar and close action
HTML
<govuk-app-sheet>
<govuk-app-screen background="modal">
<govuk-app-nav-bar title="Select a country">
<govuk-app-nav-bar-item icon="close" name="close">Close</govuk-app-nav-bar-item>
</govuk-app-nav-bar>
<govuk-app-text>Get travel alerts for the countries you choose.</govuk-app-text>
</govuk-app-screen>
</govuk-app-sheet>
Inputs
| Attribute | Type | Default | Description |
|---|---|---|---|
present |
boolean |
false |
Brings the sheet up from the bottom when the page loads, or when it's added to the page, as UIKit presents it. Give it to the first screen of a modal journey, and not to the screens after it, which are already in the sheet. |
label |
string |
The sheet's name for screen readers, such as Sign out. Leave it off if its screen has a heading or a navigation bar title. |
Content
The sheet's screen, a <govuk-app-screen>, usually with background="modal", starting with a <govuk-app-nav-bar> that has a close action. Optionally, the screen it was presented from, with slot="behind", which is drawn set back behind it and can't be used.
Outputs
None.
Rules
- Put a sheet directly in a <govuk-app>, in place of a screen. Give the root a size, as for a screen.
- Use a sheet for a task the user finishes or cancels before going back, as the app does: signing out, finding their local council, choosing a country, linking an account.
- Always give the sheet's screen a navigation bar with a close action, so it can be dismissed, even if it has Cancel in a button stack too. The sheet leaves room above the bar for it.
- Draw the screen it was presented from behind it, with slot="behind", so the user can see where they'll go back to.
- Give present only to the first screen of the modal journey. Later screens of the same journey are already in the sheet.
When not to use it
| When | Use instead |
|---|---|
| For a journey that takes over the app until it's done, such as adding a driver and vehicles account | govuk-app-full-screen-cover |
| For the next screen of a journey, pushed on top of the last | A govuk-app-screen of its own, with a back button in its navigation bar. |
| For a few things to do with something on a card | govuk-app-menu-button |
| For something the user should know, that they needn't act on | govuk-app-banner |