Skip to main content
Components

Notification banner

Use a notification banner to tell the user about something they need to know about, but that’s not directly related to the page content.

Read the Design System guidance for notification banner

Import

import * as NotificationBanner from 'govuk-react/notification-banner';

Examples

Default

Code
<NotificationBanner.Root>
  <NotificationBanner.Header>
    <NotificationBanner.Title />
  </NotificationBanner.Header>
  <NotificationBanner.Content>
    <NotificationBanner.Heading>
      You have 7 days left to send your application.{' '}
      <NotificationBanner.Link href="#">View application</NotificationBanner.Link>.
    </NotificationBanner.Heading>
  </NotificationBanner.Content>
</NotificationBanner.Root>

Success

Code
<NotificationBanner.Root success disableAutoFocus={viewMode === 'docs'}>
  <NotificationBanner.Header>
    <NotificationBanner.Title>Success</NotificationBanner.Title>
  </NotificationBanner.Header>
  <NotificationBanner.Content>
    <NotificationBanner.Heading>Training outcome recorded and trainee withdrawn</NotificationBanner.Heading>
    <Body>
      Contact <NotificationBanner.Link href="#">example@department.gov.uk</NotificationBanner.Link> if you think
      there’s a problem.
    </Body>
  </NotificationBanner.Content>
</NotificationBanner.Root>

API reference

NotificationBanner.Root

Use a notification banner to tell the user about something they need to know about, but that’s not directly related to the page content.

PropType
success

Use to tell the user about the outcome of something they’ve just done. The notification banner sets role to "alert".

boolean
disableAutoFocus

If you set success, or role to "alert", JavaScript moves the keyboard focus to the notification banner when the page loads. To disable this behaviour, set disableAutoFocus to true.

boolean

NotificationBanner.Composite

Use a notification banner to tell the user about something they need to know about, but that’s not directly related to the page content.

PropType
success

Use to tell the user about the outcome of something they’ve just done. The notification banner sets role to "alert".

boolean
disableAutoFocus

If you set success, or role to "alert", JavaScript moves the keyboard focus to the notification banner when the page loads. To disable this behaviour, set disableAutoFocus to true.

boolean
title

The title that displays in the notification banner. Defaults to "Important", or "Success" if you set success.

ReactNode
titleId

The id for the banner title, and the aria-labelledby attribute in the banner. Defaults to "govuk-notification-banner-title".

string
titleHeadingLevel

Sets heading level for the title only. You can only use values between 1 and 6 with this option. The default is 2.

1 | 2 | 3 | 4 | 5 | 6
headingReactNode

NotificationBanner.Content

No props of its own. Other props are passed to the element it renders.

NotificationBanner.Header

No props of its own. Other props are passed to the element it renders.

NotificationBanner.Heading

No props of its own. Other props are passed to the element it renders.

PropType
asChild

Render the only child (such as a router's link) instead of an a, with the link classes merged onto it.

boolean

NotificationBanner.Title

PropType
headingLevel

Sets heading level for the title only. You can only use values between 1 and 6 with this option. The default is 2.

1 | 2 | 3 | 4 | 5 | 6