Exit this page
Give users a way to quickly and safely exit a service, website or application.
Once JavaScript runs, the button, a SkipLink, or pressing Shift 3 times hides the page and
goes to the button's href, as in govuk-frontend.
Read the Design System guidance for exit this page
Import
import * as ExitThisPage from 'govuk-react/exit-this-page';Examples
Default
Code
<ExitThisPage.Composite />With skip link
Code
<>
<ExitThisPage.SkipLink>Exit this page</ExitThisPage.SkipLink>
<Body>Press Tab to show the skip link, which exits the page too.</Body>
<ExitThisPage.Composite {...args} />
</>Shift pressed once
Code
<>
<Body>Shift has been pressed once in this example. This is for visual regression testing.</Body>
<ExitThisPage.Composite {...args} />
<PressShiftOnce />
</>API reference
ExitThisPage.Root
Give users a way to quickly and safely exit a service, website or application.
Once JavaScript runs, the button, a SkipLink, or pressing Shift 3 times hides the page and
goes to the button's href, as in govuk-frontend.
| Prop | Type |
|---|---|
activatedTextText announced by screen readers when Exit this Page has been activated via the keyboard shortcut. Defaults to | string |
timedOutTextText announced by screen readers when the keyboard shortcut has timed out without successful activation. Defaults to | string |
pressTwoMoreTimesTextText announced by screen readers when the user must press <kbd>Shift</kbd> two more times to activate the button. Defaults to | string |
pressOneMoreTimeTextText announced by screen readers when the user must press <kbd>Shift</kbd> one more time to activate the button. Defaults to | string |
ExitThisPage.Button
The link to a safe page. Shows how many times Shift has been pressed.
| Prop | Type |
|---|---|
className | string |
as | undefined |
preventDoubleClickPrevent accidental double clicks on submit buttons from submitting forms multiple times. This has no effect if | boolean |
href | string |
ExitThisPage.Composite
Give users a way to quickly and safely exit a service, website or application.
Once JavaScript runs, the button, a SkipLink, or pressing Shift 3 times hides the page and
goes to the button's href, as in govuk-frontend.
| Prop | Type |
|---|---|
activatedTextText announced by screen readers when Exit this Page has been activated via the keyboard shortcut. Defaults to | string |
timedOutTextText announced by screen readers when the keyboard shortcut has timed out without successful activation. Defaults to | string |
pressTwoMoreTimesTextText announced by screen readers when the user must press <kbd>Shift</kbd> two more times to activate the button. Defaults to | string |
pressOneMoreTimeTextText announced by screen readers when the user must press <kbd>Shift</kbd> one more time to activate the button. Defaults to | string |
href | string |
ExitThisPage.Indicator
Shows how many times Shift has been pressed. Button renders it.
No props of its own. Other props are passed to the element it renders.
ExitThisPage.SkipLink
A skip link that exits the page too, for the top of the page.
No props of its own. Other props are passed to the element it renders.
ExitThisPage.Status
Tells screen readers how many more presses are needed. Root renders it.
No props of its own. Other props are passed to the element it renders.