Skip to content
Kappa
Banner
@dicehub/kappav0.4.2

Banner

Displays contextual inline messages with optional accent-aware actions.

Installation

Barrel

import { Banner, BannerAction } from "@dicehub/kappa";

Granular

import { Banner, BannerAction } from "@dicehub/kappa/components/banner";

Usage

Banner is a neutral container. Add role="status" when a routine update should be announced after the page loads.

Composition

Typical part hierarchy
Banner
├── #icon
├── #default
├── #description
└── #action
    └── Banner.Action

Banner uses named slots for its icon, primary message, description, and action area. Place Banner.Action in the action slot when the message needs a native button that inherits the banner accent and density.

Examples

Variants

Select a treatment that matches the message—not its live-region urgency. Theme tokens keep each variant consistent in light and dark modes.

With Icon

Use icon for a reusable component or the icon slot for inline SVG. Banner treats its leading icon as decorative.

With Action

Place Banner.Action in the action slot. It inherits the parent accent and density while remaining a native button.

Multiple Actions

Use one clear primary action. A secondary action can defer or dismiss the message.

Compact

Use size="sm" for concise, single-line notices in dense application layouts. Composed actions inherit the extra-small density and remain at the logical inline end.

Custom Description

The description slot supports inline emphasis and links without replacing the layout.

Right-to-left

Logical alignment keeps the icon, content, and actions ordered correctly in RTL layouts.

Accessibility

  • Banner does not add a role or live-region behavior by default.
  • Use role="status" for routine, non-urgent updates inserted after page load.
  • Reserve role="alert" for urgent errors inserted or updated after page load.
  • Do not choose a role from the visual variant alone. Static page content usually needs no role.
  • An alert announces content but never moves focus. Use a dialog when an immediate response is required.
  • Keep icon meaning redundant with visible copy; the leading icon is decorative.
  • Use concise action labels and preserve a visible keyboard focus indicator.

See the WAI-ARIA Alert Patternfor live-region behavior and focus guidance.

<script setup>
import { Banner } from "@dicehub/kappa/components/banner";
</script>

<template>
  <Banner
    role="status"
    title="Export complete"
    description="The report is ready to download."
  />

  <Banner
    role="alert"
    variant="error"
    title="Connection lost"
    description="Changes are no longer being saved."
  />
</template>

API Reference

Forwards remaining native attributes, ARIA properties, listeners, and data attributes.

PropTypeDefaultDescription
variant"default" | "alert" | "error" | "secondary""default"Selects the semantic visual treatment.
size"base" | "sm""base"Sets the banner density and the size of composed actions.
iconComponent-Vue component rendered before the banner copy.
iconPropsRecord<string, unknown>{}Props forwarded to the icon component.
titlestring-Primary text for structured content.
descriptionstring-Supporting text for structured content.
textstring-Fallback text when structured content is omitted.
SlotDescription
defaultSimple content used when title and description are omitted.
iconCustom leading icon markup.
descriptionRich supporting content for structured banners.
actionOne or more actions placed after the banner copy.

Forwards native button attributes and events to its <button>.

PropTypeDefaultDescription
variant"primary" | "secondary" | "ghost""primary"Sets the action treatment while retaining the parent banner accent.
disabledbooleanfalseDisables the native button.
type"button" | "submit" | "reset""button"Sets the native button type.
Kappa's native action intentionally omits icon,iconProps, loading, and shape. Compose icon markup in the default slot and manage pending state with visible text plus disabled.
ExportDescription
BannerRoot banner with structured and slotted content APIs.
BannerActionNative button action, also available as Banner.Action.
BannerRootUnaugmented root component.
BANNER_VARIANTSReadonly map of supported banner variants.
BANNER_SIZESReadonly map of supported banner sizes.
BANNER_DEFAULT_VARIANTDefault banner variant.
BANNER_DEFAULT_SIZEDefault banner size.
BANNER_ACTION_VARIANTSReadonly list of action variants.
BANNER_ACTION_TYPESReadonly list of native button types.
BANNER_ACTION_DEFAULT_VARIANTDefault action variant.
BANNER_ACTION_DEFAULT_TYPEDefault native button type.
BANNER_ACTION_DEFAULT_SIZEFallback action size outside Banner.
BANNER_ACTION_SIZE_BY_BANNERMaps banner density to action density.
isBannerVariantRuntime banner-variant type guard.
isBannerSizeRuntime banner-size type guard.
isBannerActionVariantRuntime action-variant type guard.
isBannerActionTypeRuntime action-type guard.
resolveBannerVariantResolves unknown input to a banner variant.
resolveBannerSizeResolves unknown input to a banner size.
resolveBannerActionVariantResolves unknown input to an action variant.
resolveBannerActionTypeResolves unknown input to a native button type.
BannerPropsPublic root props.
BannerSlotsPublic root slot contract.
BannerVariantSupported banner-variant union.
BannerSizeSupported banner-size union.
BannerActionPropsPublic action props.
BannerActionSlotsPublic action slot contract.
BannerActionVariantSupported action-variant union.
BannerActionTypeSupported native button-type union.
BannerActionSizeContextual action-size union.