Alert

A banner in the flow of a page: a tinted box with a 16 px icon centred on 12 px text, in five kinds, with an optional title, link and dismiss. Each kind has its own icon, so colour is never the only signal.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { Alert } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Conflict check needed

Run a check before you convert this opportunity.

Props

kind
title
children
action
onDismiss

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoUse it for a condition on the page that stays until it's resolved, like a mailbox that isn't connected, and put the fix in action as a TextLink.
DoAdd role="alert" or role="status" only when it appears in response to something, like a sync that just failed, so a banner that was there on load isn't announced.
DoUse neutral for a fact that needs no action, like matters created before 2024 not showing billing totals.
DoWrite an error as what happens next or what to do, like "We couldn't reach LEAP. Changes will sync when it's back."
Don'tRely on colour alone to tell a warning from an error. Say which it is in the title or the text, so it reads the same to someone who can't see the colour.
Don'tUse it to confirm something the person just did, like saving a contact. Use toast.

Props

Also takes every prop of a <div>. Add role="alert" or role="status" only when it appears in response to something, so a static banner isn't announced.

PropTypeDefaultDescription
kind"info" | "success" | "warning" | "error" | "neutral""info"Info (navy tint), success, warning, error or neutral.
titleReactNode—An optional bold first line.
actionReactNode—A link on the right that resolves it, like a TextLink "Connect".
onDismiss() => void—Shows a × on the right and runs when it's pressed.
dismissLabelstring"Dismiss"Names the × when "Dismiss" isn't enough.

Code

What the playground shows, ready to copy.

import { Alert } from "@leap-crm/design-system";

<Alert
  title="Conflict check needed"
>
  Run a check before you convert this opportunity.
</Alert>

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
EnterSpaceDismisses it, with focus on its close button.