noora
Sign in

Alert

Communicates a status or message. Secondary alerts sit inline with the content they concern; primary alerts are raised toasts that appear in a corner of the screen.

Inline

Secondary alerts sit in the page, next to the content they describe. The status sets the icon and color.

Your workspace was updated
A new version of the CLI is available
Your email address is confirmed
Your plan's build minutes are almost used up
This email is already registered
<.alert type="secondary" status="default" title="Your workspace was updated" />
<.alert type="secondary" status="information" title="A new version of the CLI is available" />
<.alert type="secondary" status="success" title="Your email address is confirmed" />
<.alert type="secondary" status="warning" title="Your plan's build minutes are almost used up" />
<.alert type="secondary" status="error" title="This email is already registered" />

Inline sizes

Small and medium show a single line. Large adds a description.

Small alert
Medium alert
Large alert Large alerts have room for a description that explains what happened and what to do next.
<.alert type="secondary" status="information" size="small" title="Small alert" />
<.alert type="secondary" status="information" size="medium" title="Medium alert" />
<.alert
  type="secondary"
  status="information"
  size="large"
  title="Large alert"
  description="Large alerts have room for a description that explains what happened and what to do next."
/>

Inline with actions

One or two actions follow the title.

Your token expires in 3 days
The build failed
Two targets failed to compile. Check the logs for details.
<.alert type="secondary" status="warning" title="Your token expires in 3 days">
  <:action><.link_button size="medium" variant="secondary" label="Rotate token" /></:action>
</.alert>
<.alert
  type="secondary"
  status="error"
  size="large"
  title="The build failed"
  description="Two targets failed to compile. Check the logs for details."
>
  <:action><.link_button size="large" variant="secondary" label="View logs" /></:action>
  <:action><.link_button size="large" variant="secondary" label="Retry" /></:action>
</.alert>

Toast

<.alert id="alert-toast-default" status="success" title="Project created" dismissible />

Toast warning

<.alert
  id="alert-toast-warning"
  status="warning"
  title="Your plan's build minutes are almost used up"
  dismissible
/>

Toast error

<.alert
  id="alert-toast-error"
  status="error"
  title="The preview could not be uploaded"
  dismissible
/>

Toast with action

<.alert id="alert-toast-action" status="information" title="Token copied" dismissible>
  <:action><.link_button size="medium" variant="secondary" label="View tokens" /></:action>
</.alert>

Toast with description

<.alert
  id="alert-toast-large"
  status="information"
  size="large"
  title="Selective testing is on"
  description="Tuist now skips tests whose dependencies did not change."
  dismissible
/>

Toast with description and action

<.alert
  id="alert-toast-large-action"
  status="error"
  size="large"
  title="The build failed"
  description="Two targets failed to compile. Check the logs for details."
  dismissible
>
  <:action><.link_button size="large" variant="secondary" label="View logs" /></:action>
</.alert>

Preserved toast

<.alert
  id="alert-toast-preserved"
  status="warning"
  size="large"
  title="Your session is about to expire"
  description="You'll be signed out in 5 minutes."
  dismissible
>
  <:action><.link_button size="large" variant="secondary" label="Stay signed in" /></:action>
</.alert>

Guidelines

  • Use secondary alerts inline, next to the content they describe, such as a form error on a sign-up page or a notice in settings.
  • Use primary alerts as toasts: brief confirmations of something the person just did, such as Project created or Token copied, shown in a corner of the screen.
  • Lead with what happened in the title, and use the description for what to do next.
  • Match the status to the outcome: success confirms, warning asks for attention, error reports a failure that blocks progress.
  • Don't rely on a toast alone for failures that need follow-up; keep an inline alert or a status on the page as well.
  • Give dismissible alerts an id . Dismissing hides the element with that id.

API reference

<.alert>

Attribute Type Default Description
description
string
nil
The description of the alert. Only shown if size is large.
dismissible
boolean
false
Whether the alert can be dismissed.
id
string
nil
show_icon
boolean
true
Whether to show the status icon.
size
string
"medium"
The size of the alert. "small""medium""large"
status Required
string
–
The status of the alert. "default""information""warning""error""success"
title Required
string
–
The title of the alert.
type
string
"primary"
The type of alert. "primary""secondary"

Also accepts global attributes.

Slot Description
:action
inner_block
Rich HTML description. Takes precedence over the description attribute when provided.