Panel - warning
Overview
There are three different types of warning panels:
- standard warning panel
- warning with session expiry timeout
- branded warning panel
To highlight important text to users, use the information panel.
To deliver a message that is not related to the content of a page, use the announcement panel.
To inform the user of an error, use the error details and error summary components.
Standard warning panel
Use the standard warning panel when you need to warn users about something important, such as legal consequences.
Warning panel with session expiry timeout
Use a warning panel with session expiry timeout when a service sets a session expiry time to protect the user’s information.
How this component works
When the session expiry timer reaches zero, the countdownExpiredText message will be displayed and the browser will redirect to the URL set for a session timed out error page.
The content of the warning panel is set using the parameters shown in the Nunjucks macro options table.
You will also need to set the parameters:
- sessionExpiresAt with the current expiry time in ISO format on page load
- serverSessionExpiryEndpoint with a relative URL to the server’s API endpoint for the component to send requests to
- redirectUrl with a URL so that when the session has timed out the user is directed to the session timed out error page
If the current URL is set, the page will reload.
Server requirements
The timeout panel requires an API endpoint that handles GET
request methods and returns a JSON object containing the key expires_at
with a value for the session expiry time in ISO format.
A request for the current expiry time
When a request using a GET
method is received, the response should contain the current expiry time.
The request is made to check if the same session is being interacted with in another tab.
A request to get the current expiry time will be sent:
- at 20-second intervals after the page loads
- before the page starts to redirect
Failure responses from the server
If the response status does not have a successful 200
code, the component will handle the response as a session expiry and redirect the user to the URL set in the redirectUrl
parameter.
Help improve this page
Let us know how we could improve this page, or share your user research findings. Discuss the ‘Panel’ component on GitHub (opens in a new tab)