Skip to content
TopClass UI

Alert

A message that belongs to the page, in six tones. Info, success, warning and danger each draw their own icon, so it reads without colour.

server - 0 KB

Alert

server - 0 KB

A message that belongs to the page, in six tones. Info, success, warning and danger each draw their own icon, so it reads without colour.

Install

Your trial ends in three days

Deploys pause when it does. Adding a payment method turns them back on.

Try it

variant
tone

The code

alert.tsx
import { Alert } from 'topclassui/alert'

<Alert title="Your trial ends in three days">
  Deploys pause when it does. Adding a payment method turns them back on.
</Alert>

Not a live region: it is page content. Pass role="alert" when it appears after load, or announce the event with Toast.

Every state

13 states

Soft

A tint of the tone.

Solid

The full fill.

Outline

A line in the tone colour.

Primary

A new version is ready.

Neutral

Nothing has changed since Monday.

Success

The invoice was paid.

Warning

The trial ends in three days.

Danger

The last deploy failed.

Info

Maintenance starts at 22:00.

Title only

Description only, with no title above it.

No icon

The icon is left out.

With actions

Actions sit in a row under the description.

Import from the package

topclassui/alert
import { Alert } from 'topclassui/alert'

Install once:npm i topclassui@beta zod

Examples

  • For a message that belongs to the page: a trial about to end, a failed deploy, a saved form. For something that has just happened, use a Toast; for a bar above the whole page, use a Banner.
  • primary and neutral take the info icon. Pass your own icon to replace it, or icon={null} for none.
  • children is the description, so it can hold several paragraphs or a list. actions puts buttons or links in a row under it.
  • Keep actions on the soft variant: an unfilled Button on a solid fill falls below 4.5:1.
  • A long title, description or URL wraps inside the box instead of truncating.
basic

Your trial ends in three days

Deploys pause when it does. Projects stay readable, and adding a payment method turns deploys back on.
tones

Primary

A new version is ready.

Neutral

Nothing has changed since Monday.

Success

The invoice was paid.

Warning

The trial ends in three days.

Danger

The last deploy failed.

Info

Maintenance starts at 22:00.

Primary

A new version is ready.

Neutral

Nothing has changed since Monday.

Success

The invoice was paid.

Warning

The trial ends in three days.

Danger

The last deploy failed.

Info

Maintenance starts at 22:00.

Primary

A new version is ready.

Neutral

Nothing has changed since Monday.

Success

The invoice was paid.

Warning

The trial ends in three days.

Danger

The last deploy failed.

Info

Maintenance starts at 22:00.
variants

Soft

A tint of the tone, for most messages.

Solid

The full fill, for the one message that must not be missed.

Outline

A line in the tone colour, on the page background.
with-actions

Your trial ends in three days

Deploys pause when it does. Projects stay readable.
Add a payment method

The last deploy failed

The build stopped at step 4 of 6. The site still serves the previous version.
Read the log

Two people are editing this page

minimal

Saved

Changes are saved as you type.
rich-content

The import finished

All 1,204 rows were read. Three were skipped:

  • Row 18 has no email address.
  • Row 311 repeats row 310.
  • Row 902 has a date in the future.

Fix them in the file and import it again.

custom-icon

Reminders are on

You will hear about every comment on this page.

No icon

The text carries the meaning on its own.
live-region
long-text

The deploy failed while uploading the static assets to the edge network

The full log is at https://example.com/projects/topclassui/deployments/2026-10-07/logs/build-step-four-of-six.txt, and it stays there for thirty days.

https://example.com/projects/topclassui/deployments/2026-10-07/logs/build-step-four-of-six.txt

In Arabic, right to left

تم الدفع

وصلت الدفعة وأُرسل الإيصال إلى بريدك.

تنتهي الفترة التجريبية بعد ثلاثة أيام

تتوقف عمليات النشر عندها، وتبقى المشاريع قابلة للقراءة.

فشل النشر الأخير

يعرض الموقع النسخة السابقة.

Props

The props of Alert
PropTypeDefaultLimitsDescription
actionsReactNode--Buttons or links, in a row under the description.
childrenReactNode--The description: a sentence, several paragraphs or a list.
iconReactNode--Shown before the text. Leave it out for the tone's own icon, or pass null for none.
titleReactNode--The heading of the message, in bold above the description.
toneprimary | neutral | success | warning | danger | info"info"-What the message means, which picks its colour ramp and its default icon.
variantsoft | solid | outline"soft"-How much weight the alert carries on the page: a tint, a fill or an outline.

Keyboard and accessibility

Nothing to operate: it is not interactive on its own.

  • Alert has no role: it is page content, read in place, not a live region.
  • A screen reader does not read out an alert that is already in the first HTML. Pass role="alert" only when it is inserted after the page has loaded and must be announced.
  • The tone never carries the meaning alone: each of the four meaningful tones draws its own icon. Alert itself takes no focus; only the caller's actions do.

Right to left

The icon sits at the inline start and the text and actions follow it; every spacing class is logical, so nothing is mirrored by hand.

Server and client

Renders on the server and ships no JavaScript.

Files: index.tsx.

On the chip: server - 0 KB.