Skip to main content

Alert

Inform users about important changes or conditions in the interface in a prominent way.

Base
Mantine + override
Mantine
Import
{ Alert } from '@mantine/core'
Source
src/themes/component-overrides/feedback.ts
src/themes/style-overrides/alert.module.css

Usage​

variant
Text Alignment (TA)
title
withCloseButton
React
<Alert variant="info">
Endringene er lagret.
</Alert>

Variants​

The theme adds four status variants.

React
<Alert variant="neutral">Nøytral melding.</Alert>
<Alert variant="info">Informasjon til brukeren.</Alert>
<Alert variant="warning">Sjekk input før du fortsetter.</Alert>
<Alert variant="error">Noe gikk galt.</Alert>

Mantine's own variants (filled, light, outline, default, transparent, white) still resolve normally — the four above are additions, not replacements.

Props​

Only what this design system changes. Everything else is Mantine's — read the full props table there.

PropertyTypeAllowed valuesDefaultDescription
variantstringneutral · info · warning · errorlightSelects the status treatment. The four values are additions to Mantine's variants. The theme sets no default.
radiusMantineRadius | number—xsRounds the corners to 3px, overriding the theme's own global default of sm (5px).
taCSSProperties['textAlign']center · leftcenterAligns the title and the message together. Mantine's own style prop; the theme changes its default from left to centred.
titleReactNode——Heading shown above the message. Omit it for a message-only alert.
childrenReactNode——The message body. Padded spacing.xl inline; the title carries the same inline padding.
iconReactNode——Leading icon. No icon is shown by default, and the theme does not tint a supplied one by variant.

Accessibility​

  • The root element carries role="alert" by default — an assertive live region. Screen readers announce the content as soon as it mounts, with no need for focus. Reserve it for messages that genuinely need that interruption.
  • aria-describedby points at the message body, and aria-labelledby at the title when one is set — both wired automatically by Mantine.
  • withCloseButton has no default label. Set closeButtonLabel whenever you turn it on, as the Usage demo above does.

See Accessibility for the theme-wide rules.