Feedback

Alert

Inline status message with assertive role for surfacing time-sensitive feedback about a nearby action or region.

import { Alert } from '@lostgradient/cinder';
feedbacknotice
01

Overview

Reference usage

A status message that communicates contextual feedback and can optionally be dismissed.

Usage

svelte
<script lang="ts">
  import { Alert } from '@lostgradient/cinder';
</script>

<Alert variant="success">Saved successfully.</Alert>

Keep controls out of an alert

An alert states a result or a condition and carries at most the buttons that act on it (actions). Do not wrap a form control or an inline choice, such as a SegmentedControl, in a tinted alert: the tint reads as a warning about the control, the control stretches to fill a box it was not drawn for, and its own colours clash with the status colour. Put the control in the page flow with a plain label, such as a FormField or a heading and the control beneath it, and keep the alert for a message about it.

Live preview

Dismissible alert

02

When to use

Use when
  • Surfacing the result of a just-completed action such as a save failure or success.
  • Calling out a transient condition the user must notice immediately within a specific region.
Avoid when
  • Communicating a page- or app-wide notice that persists across views — use a banner instead.
  • Providing supplemental commentary or guidance inline with content — use a callout instead.
  • Wrapping a form control or an inline choice, such as a segmented-control — place it in the page flow with a plain label instead.
03

Examples

Dismissible alert

An alert with a close button that fires onDismiss.

Alert variants

Info, success, warning, and danger alerts.

Alert with icon

Custom icon slot alongside the alert message.

04

Props

Props for alert
Name
Type
Default
Description
variant 'info''success''neutral''warning''danger''error' 'info'
dismissible boolean false
onDismiss () => void
heading text A bold first line in the status colour. With a heading, the alert draws its variant's glyph when no icon is given, and children read in the default text colour as the body.
children required snippet
icon snippet
actions snippet Buttons or links that act on the message, such as "Export again" after a failed export. They sit at the alert's trailing edge beside the message, and drop under it where the alert is too narrow for both. Give them the secondary or ghost variant: an alert states a problem, and the page's one primary action stays elsewhere.