Veil UI
Components

Banner

A page-level message with an icon, body, actions and dismissal.

Installation

$ npx veil-ui@latest add banner

Usage

import {
  Banner,
  BannerContent,
  BannerTitle,
  BannerDescription,
} from "@/components/ui/banner";

<Banner>
  <BannerContent>
    <BannerTitle>Update available</BannerTitle>
    <BannerDescription>Reload to apply it.</BannerDescription>
  </BannerContent>
</Banner>;

Examples

Basic

New registry build

Components are now generated from a single source of truth.

With action

Your trial ends in 3 days

Add a payment method to keep deployments running.

Dismissible

Invite your teammates

Collaboration is free for the first five seats.

Destructive

Use role="alert" for failures that interrupt the flow, and the default role="status" for informational messages.

API reference

PropTypeDefaultDescription
variant"default" | "muted" | "destructive""default"Tone of the banner surface.
role"status" | "alert""status"Live-region politeness. Use alert for errors.
...propsReact.ComponentProps<"div">—All native div attributes.

Subcomponents

  • BannerIcon — leading icon slot.
  • BannerContent, BannerTitle, BannerDescription — text layout.
  • BannerActions — row of buttons below the copy.
  • BannerClose — pre-labelled dismiss button.

Accessibility

  • Defaults to a polite status region; pass role="alert" for failures.
  • BannerClose is named “Dismiss banner” by default and accepts a label override.
  • Actions are real buttons, not clickable spans.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add banner --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { computed } from "vue";

import { cn } from "@/lib/utils";

import { bannerVariants, type BannerVariants } from "./variants";

const props = withDefaults(
  defineProps<{
    variant?: BannerVariants["variant"];
    role?: string;
    class?: string;
  }>(),
  { role: "status" },
);

const classes = computed(() =>
  cn(bannerVariants({ variant: props.variant }), props.class),
);
</script>

<template>
  <div
    data-slot="banner"
    :data-variant="variant ?? 'default'"
    :role="role"
    :class="classes"
  >
    <slot />
  </div>
</template>

On this page