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 body text, so colour is never the only signal.
<InlineBanner tone="error" body="We could not update your profile." />
<InlineBanner tone="warning" body="Your profile is missing a business address." />
<InlineBanner tone="success" body="Your right to work is confirmed." />
<InlineBanner tone="information" body="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 uses the ai ink; the body, action buttons and dismiss use their standard inks.
<InlineBanner
tone="ai"
body="Three jobs match your skills. Review the suggestions."
primaryAction={{ label: 'Review', onClick: review }}
/>Neutral and brand tones
No status to report
Use the neutral and brand tones for information that is not a success, warning or error, such as a small notice. They take an optional icon; with none, no glyph renders.
<InlineBanner tone="neutral" body="Your phone number was updated today." />
<InlineBanner tone="brand" body="You have a new message from Checkatrade." />Bordered
A border
bordered adds a border, which helps the banner stand out from the surface behind it.
<InlineBanner
tone="information"
body="Your profile is 80% complete."
bordered
/>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 don't.
<InlineBanner
tone="warning"
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: 'Learn more', href: '#help' }}
onDismiss={dismiss}
dismissLabel="Dismiss banner"
/>When to use
- The message is one short sentence in a dense layout, such as a list row, a table cell or a form field.
- The reader needs at most two actions and no heading.
Which banner
| Use InlineBanner when… | Use InPageBanner when… | Use GlobalBanner when… |
|---|---|---|
| The message is one short sentence in a dense layout. | The message sits in the content next to its subject. | The message is about the page or the app as a whole. |
| It sits inside a list row, table cell or form field. | It sits inside a card, panel or form section. | It sits at the top of a screen, edge to edge. |
| The reader needs at most two actions, no title. | The reader needs a title, a body and Buttons. | The reader needs an unmissable statement plus Buttons. |
When not to use
- A message with a heading and shared context: use InPageBanner.
- A message about the whole page or app: use GlobalBanner.
- More than two actions, or a title and body: use InPageBanner or GlobalBanner.
Layout
InlineBanner is full width and rounded, with its root top-aligned and the dismiss pinned to the first line. Its row centres items on each line, so a one-line message sits level with a taller button beside it. The glyph and the message share one title line, with the glyph centred on the first line of the message.
- The layout adapts on its own. Actions sit beside the copy when they fit and wrap below it when they do not, and there is no layout prop.
- The glyph and the message share a top-aligned title line, so on multi-line copy the glyph sits beside the first line. The body line and the glyph are both 24px, so no nudge is needed.
- When a glyph renders, the content row is indented by the glyph width plus
spacing2, and the glyph is pulled back by the same amount, so the message and any stacked actions start at the same x. Abrandorneutralbanner with no glyph has no indent. - 32px (
spacing8) between the message and the actions side by side, 8px (spacing2) when they wrap below. - The dismiss is a 44px slot pinned to the top-right corner, inset 8px from the top and 16px from the right. The 24px hover circle and glyph sit at the slot top-right, so the circle centre lines up with the first text line and its right edge sits on the padding edge. The right padding reserves the slot itself only when a dismiss renders, and the empty left part of the slot supplies the visible gap; without one it is the normal 16px and the message 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 about 5px above the text’s centre.
- The root keeps its 44px minimum height, so on a one-line banner the slot overhangs the bottom edge by 8px. Nothing clips it, and the banner does not grow to fit it.
borderedcolours 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.- The actions are xxs rounded Buttons (secondary and tertiary), so the banner stays compact. The body copy is 16px (
body-md).
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. |
| body * | string | - | The banner's only text. There is no title. An empty string renders nothing. |
| 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 | Adds a border. |
| primaryAction | { label, onClick } | { label, href, external? } | - | Renders an xxs secondary Button. Web: onClick or href, never both. Native: pass { label, onPress }. |
| secondaryAction | Same as primaryAction | - | Renders an xxs tertiary Button. Only allowed alongside primaryAction. |
| onDismiss | () => void | - | Shows a dismiss button. 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>-body' and so on. |
| testID | string | - | Native: passed to the root for test targeting. |
Import
Web
import { InlineBanner } from '@checkatrade/components-web';Native
import { InlineBanner } from '@checkatrade/components-native';Basic usage
<InlineBanner
tone="warning"
body="Your profile is missing a business address."
primaryAction={{ label: 'Add address', onClick: addAddress }}
secondaryAction={{ label: 'Learn more', href: '/help' }}
onDismiss={dismiss}
dismissLabel="Dismiss banner"
/> Platform status
| Platform / Area | Status |
|---|---|
| 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 callAccessibilityInfo.announceForAccessibilitywith the body. Adding a live region together with its content is often not announced. - There is no heading. The body is plain text, so do not rely on the banner for page structure.
- The icon is decorative and hidden from assistive tech. The tone is carried by the body 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.