Banner
Alignment target:@astryxdesign/core v0.7.1 · Banner
Usage #
Use Banner for persistent messages that require attention or action.
<script setup lang="ts">
import { Banner } from '@astryx-vue/core/Banner'
</script>
<template>
<Banner
status="success"
title="Changes saved"
description="Your settings are up to date."
is-dismissable
/>
</template>Import the theme once in the application entry:
import '@astryx-vue/themes/neutral.css'Anatomy
| Element | Description |
|---|---|
| Banner frame | Outer frame that groups the status surface and optional content surface. It carries whole-banner elevation and, for elevated card banners, the radius that shapes that silhouette. |
| Status surface | The primary painted surface. It communicates status and contains the icon, title, description, actions, and controls. |
| Icon | Automatically set based on the status (info, warning, error, success). |
| Title | The main message. Always required. |
| Description | Additional detail below the title. |
| Action button | A button for the user to act on the message, like "Review" or "Retry". |
| Dismiss button | Lets the user close the banner. Enabled by setting isDismissable. |
| Content surface | Secondary surface for extra detail below the status surface, like a list of errors. Sits behind an expand/collapse toggle by default; set collapsible to false to keep it visible. |
Best practices #
| Guidance | Practices |
|---|---|
| Do | Pick a status that matches the message: info for updates, warning for caution, error for problems, success for confirmations. |
| Do | Use the card container inside page content and the section container for full-width messages that span the entire page. |
| Do | Make info and success banners dismissable. Keep error banners visible until the user fixes the issue. |
| Do | Keep titles short and scannable: "Payment failed" not "There was a problem processing your most recent payment." |
| Don't | Use Banner for short-lived messages that disappear on their own; use Toast instead. |
| Don't | Stack multiple banners with the same status; combine related messages into one banner. |
Examples #
Banner — Collapsible
One banner with an action, a dismiss control, and details that start open. The details go in the default slot.
Banner — Dismiss
isDismissable lets the user close the banner after reading it.
Banner — Floating
elevation med lifts the banner off the page, so it reads as a floating notice.
Banner — Full width
With container set to section, the banner runs edge to edge without a rounded corner, for a notice at the top of the page.
Banner — Statuses
Info, success, warning, and error, for an update, a confirmation, a caution, and a problem.
Banner — Action
A button in the end slot lets the user act on the message.
Usage guidance #
The status prop sets the tone of a banner, and picking the wrong one makes readers misjudge how urgent the message is. The list below covers which status fits which kind of message, plus two usages that are easy to overlook.
- Use
infofor general information and updates. - Use
successfor the result of a successful action. - Use
warningfor situations that call for caution. - Use
errorfor problems that block progress. - Set
:collapsible="false"for details that users must read, so those details stay visible and no click is needed to open them. Keep the default toggle when the detail is long enough to bury the banner's own message. - Announce an async outcome from the transition that produced it, with
useAnnounce.
status controls color and icon only. It does not create a live region. Add role="status" only when the visible banner should stay a persistent semantic mirror, and reserve role="alert" for genuinely urgent content that should interrupt current speech. Content already on the page at first render is not guaranteed to be announced again.
For a single field validation message, use FieldStatus.