Skip to content

Messaging

InPageBanner

Beta

A rounded banner that sits in the page content, available on web (React) and native (React Native).

Feedback tones

Error, warning, success and information

Feedback tones carry the meaning of the message through their colour and their default glyph. The tone is always repeated in the title, so colour is never the only signal.

We could not update your profile

Your certificate has expired

Your right to work is confirmed

Your check is in progress

<InPageBanner tone="error" title="We could not update your profile" />
<InPageBanner tone="warning" title="Your certificate has expired" />
<InPageBanner tone="success" title="Your right to work is confirmed" />
<InPageBanner tone="information" title="Your check is in progress" />

AI tone

Suggested by AI

Use the ai tone when the content is generated or suggested by AI. It paints the AI gradient surface. The gradient is light in light mode and dark in dark mode. The glyph and title use the ai ink; the body, action buttons and dismiss use their standard inks.

Three jobs match your skills

These suggestions are based on the work you did last month.

<InPageBanner
tone="ai"
title="Three jobs match your skills"
body="These suggestions are based on the work you did last month."
/>

Neutral tone

No status to report

Use the neutral tone for information that is not a success, warning or error, such as a notice about a change to your account.

Your contact details have changed

We will use your new phone number from today.

<InPageBanner
tone="neutral"
title="Your contact details have changed"
body="We will use your new phone number from today."
/>

Bordered

A full border

bordered draws a full border around the banner, which helps it stand apart from a card of the same colour.

Your check is in progress

We will email you when it is complete.

<InPageBanner
tone="information"
bordered
title="Your check is in progress"
body="We will email you when it is complete."
/>

Long copy

Actions beside the copy or below it

There is no layout prop. Actions sit beside the copy when they fit and wrap below it when they do not.

We need to speak to you

We could not finish your right to work check because the document photo was unclear. Request a call back and we will help you complete it over the phone.

<InPageBanner
tone="warning"
title="We need to speak to you"
body="We could not finish your right to work check because the document photo was unclear. Request a call back and we will help you complete it over the phone."
primaryAction={{ label: 'Request call back', onClick: requestCallBack }}
secondaryAction={{ label: 'Remind me later', onClick: remindLater }}
onDismiss={dismiss}
dismissLabel="Dismiss banner"
/>

When to use

  • The message sits in the content, next to the thing it is about, such as a card, a panel or a form section.
  • The reader needs a title, a body and up to two Buttons.

Which banner

Use InPageBanner when…Use GlobalBanner when…Use InlineBanner when…
The message sits in the content next to the thing it is about.The message is about the page or the app as a whole.The message is one short line in a dense layout.
It sits inside a card, panel or form section.It sits at the top of a screen, edge to edge.It sits inside a list row, table cell or form field.
The reader needs a title, a body and Buttons.The reader needs an unmissable statement plus Buttons.The reader needs one sentence and at most two actions.

When not to use

Layout

InPageBanner is full width, rounded and at least 44px tall. It lays out one wrapping content row and a dismiss pinned to the top-right corner.

  • The glyph sits inline at the start of the title line, top-aligned, with a nudge of half the difference between the title line height and the 24px glyph (1.5px at the base size), so the glyph centres on the first title line. The content row is indented by the glyph width plus 8px, with the glyph pulled back by the same amount, so the title, the body and any stacked actions all start at the same x.
  • The dismiss slot is pinned to the top-right, inset by the padding, plus the same nudge as the glyph. Its 24px circle sits at the slot top-right, so it centres on the first title line and its right edge sits on the padding edge. The right padding reserves the slot itself only when a dismiss renders; without one it is the normal 16px and the content and actions use the full width. One exception: when one line of text sits beside a taller button, the row centres that text on the button while the dismiss stays pinned, so the circle sits 7 to 8.5px above the text’s centre (it tracks the responsive title size).
  • The layout adapts on its own. Actions sit beside the copy when they fit and wrap below it when they do not, with a 64px gap beside and a 12px gap when stacked. There is no layout prop.
  • bordered colours a full border. Its width is always reserved and its colour is transparent when off, so toggling it never shifts the content or the dismiss.

Props

Prop Type Default Description
tone * 'error' | 'warning' | 'success' | 'information' | 'ai' | 'brand' | 'neutral' - Sets the colours and the default glyph. Required: the tone carries meaning, so there is no default.
title * string - Rendered as a heading at the level set by titleLevel.
body string - Supporting text under the title. An empty string renders nothing.
titleLevel 2 | 3 | 4 | 5 | 6 3 Heading level of the title.
icon ComponentType | IconAsset - Only on brand and neutral, where it is optional; with no icon no glyph renders. Not accepted on the fixed-glyph tones. Web: a component from @checkatrade/icons/react. Native: a raw .svg asset from @checkatrade/icons/svg/*.
bordered boolean false Draws a full border around the banner.
primaryAction { label, onClick } | { label, href, external? } - Secondary button. Web: onClick or href, never both. Native: pass { label, onPress }.
secondaryAction Same as primaryAction - Tertiary button. Only allowed alongside primaryAction.
onDismiss () => void - Shows a dismiss button pinned to the top-right corner. Must be passed with dismissLabel.
dismissLabel string - Accessible name for the dismiss button. Required with onDismiss.
aria-live 'off' | 'polite' | 'assertive' - Web: passes through to the root. There is no live region by default. To announce a banner shown after an action, keep a live region mounted on a persistent wrapper and render the banner inside it. See the Accessibility tab.
accessibilityLiveRegion 'none' | 'polite' | 'assertive' - Native: passes through to the root. It works on Android only, so on iOS call AccessibilityInfo.announceForAccessibility instead. See the Accessibility tab.
data-testid string - Web: passed to the root. Parts get '<testid>-title', '<testid>-body' and so on.
testID string - Native: passed to the root for test targeting.

Import

Web

import { InPageBanner } from '@checkatrade/components-web';

Native

import { InPageBanner } from '@checkatrade/components-native';

Basic usage

<InPageBanner
  tone="warning"
  title="We need to speak to you"
  body="We need to check your right to work in the UK before you can take on new jobs."
  primaryAction={{ label: 'Request call back', onClick: requestCallBack }}
  secondaryAction={{ label: 'Remind me later', onClick: remindLater }}
  onDismiss={dismiss}
  dismissLabel="Dismiss banner"
/>

Platform status

Platform / AreaStatus
Web (React) Beta
Native (React Native) Beta
iOS (Swift) Planned
Android (Kotlin) Planned
Accessibility audit Planned

Accessibility

  • There is no live region by default. To announce a banner shown in response to an action, keep a live region mounted on a wrapper that stays on the page and render the banner inside it. On web, put aria-live="polite" on that wrapper. On native this works on Android only, so on iOS also call AccessibilityInfo.announceForAccessibility with the title. Adding a live region together with its content is often not announced.
  • The title renders as a real heading at titleLevel. Pick a level that fits the surrounding page.
  • The icon is decorative and hidden from assistive tech. The tone is carried by the title text, never by colour alone.
  • Focus order matches visual order.
  • After onDismiss, move focus to a sensible element. The component does not manage it.

No releases yet.

Select a brand to demo:
Active brand: checkatrade