Skip to main content

Notification

Notifications give users short feedback about an action or a change in the system, without interrupting what they are doing.

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

Usage​

variant
icon
withCloseButton
React
<Notification variant="info" title="Ny versjon tilgjengelig">
Oppdater siden for å ta i bruk endringene.
</Notification>

To show notifications as toasts, render Notifications from @mantine/notifications once in the app and call notifications.show(). The theme places them top-right. Import @mantine/notifications/styles.css alongside the design system's stylesheet.

Variants​

React
<Notification variant="neutral" title="Utkast lagret">Du kan fortsette senere.</Notification>
<Notification variant="info" title="Ny versjon tilgjengelig">Oppdater siden for å ta i bruk endringene.</Notification>
<Notification variant="success" title="Lagret">Endringene er lagret.</Notification>
<Notification variant="warning" title="Kontroller innholdet">Ett felt mangler verdi.</Notification>
<Notification variant="error" title="Noe gikk galt">Prøv igjen om litt.</Notification>

The variant colours the left accent line and the icon; the background stays on the surface colour. Supplying an icon hides the left accent line and tints the icon to match — one shade darker for warning, and the default icon colour for neutral. The icon renders at 32px.

Size​

Notification has no size prop and fills its container. We recommend a minimum width of 320px and a maximum width of 512px. Set them with CSS min-width and max-width — through the miw and maw props, or a class of your own.

For toasts, set the width once with containerWidth on Notifications.

Props​

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

PropertyTypeAllowed valuesDefaultDescription
variantstringneutral · info · success · warning · error—Selects the status colour. Not in Mantine's typed props.
iconReactNode——Leading icon, tinted to match variant. Supplying one hides the left accent line.
radiusMantineRadius—mdRounds the corners to 8px. The theme's global default is sm (5px).
withBorderboolean—trueDraws a 1px border. Mantine's own default is off.

Accessibility​

  • The root element carries role="alert" by default, same as Alert.
  • withCloseButton defaults to true on this component, so a close button renders unless you turn it off. Mantine's own guidance: give it an aria-label (or title) through closeButtonProps, or it ships silent to a screen reader — neither Mantine nor the theme supplies one for you.