Skip to content

Your web browser is out of date

Your web browser (the software you use to access the internet) is out of date. You need to update it or use a different web browser to ensure you can complete this form.

Cookies disabled

Cookies are currently not enabled in your web browser. You need to enable cookies to ensure you can complete this form.

Leave site

The leave button gives users a way to quickly and safely exit a service, website or application and keep users safe by helping them to protect their privacy.

<a class="asp-leave-site" href="https://www.google.co.uk" data-keys="Escape,Esc">
  <span class="sr-only" style="display:none">To quickly exit this site, press the Escape key or use this </span>
  Leave site
</a>
Nunjucks macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Name Type Description
{% from "components/leave-site/macro.njk" import aspLeaveSite %}

{{ aspLeaveSite({

}) }}

Twig macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Name Type Description
{% from "components/leave-site/macro.njk" import aspLeaveSite %}

{{ aspLeaveSite({

}) }}

When to use this component

Use the component on pages with sensitive information that could:

  • put someone at risk of abuse or retaliation
  • reveal someone’s plans to avoid or escape from harm

For example, when a potential victim is using a service to help them leave a domestic abuser.

You can use this component on either:

  • all the pages in a service
  • parts of the journey with sensitive information

You can also use this component for standalone content pages, such as dashboards and guidance.

When not to use this component

Do not use this component if the service or content is unlikely to put a user at risk.

Keep in mind that seeing this component might discourage certain users from using your service. If the user does not identify themselves as being at risk, they might see the button on a service and decide it’s not relevant to them.

How it works

If the component is present, it should be the first component within the order of the page.

When activated, the component by default will take the user to a Google search page.

If JavaScript is enabled, the function can be activated by pressing the escape/esc key and an additional tab will open, taking the user to the homepage of BBC Weather. The page when the button is clicked will be removed from the browser history.

You can change this if there’s a more appropriate site for your users.

Avoid websites that might show personalised pages (such as frequently visited, last visited or suggested links), as this content could put the user at risk.

Status of development

The below criteria all need to be met for a component to be considered as fully developed for use within the ASP Digital Design System.

Development criteria Status
WCAG 2.2 compliant Not started
WCAG 2.1 compliant Completed
HTML / Nunjucks version Completed
Figma version Not started
M365 versions Not started
Documentation In progress

Make a change to the Design System

Suggest an edit to this system, or any of the components in it, by submitting a Design System change request.


Published 3 May 2024
Last updated 24 October 2025