Skip to content

Banner

CSS

A banner is an inline alert for something that just happened: a failed save, a confirmed purchase, an update in the page flow. Put role="alert" on the element. If the message should float over the page instead, wrap banners in a toast.

Start with <div class="k-banner">. A variant paints the fill. Soft, outline, or dash lightens that fill. Layout modifiers flip the grid: --vertical stacks, --horizontal is a row, --sm-horizontal becomes a row from the sm breakpoint up.

Children are optional. An icon, a plain span, or the body parts (k-banner__title, k-banner__description, k-banner__actions) all sit in the same grid.

ClassTypeDescription
k-bannercomponentThe alert box. Add role="alert" yourself.
k-banner__bodypartGroups the title, description, and actions in the grid.
k-banner__titlepartShort headline for the message.
k-banner__descriptionpartSupporting copy under the title.
k-banner__actionspartTrailing buttons or links.
k-banner--infovariantNeutral notice. Filled info color.
k-banner--successvariantSomething worked.
k-banner--warningvariantSomething needs attention.
k-banner--dangervariantSomething failed.
k-banner--softstyleVariant color as a wash instead of a fill.
k-banner--outlinestyleTransparent with a solid border.
k-banner--dashstyleTransparent with a dashed border.
k-banner--verticalmodifierStacks the grid into a column.
k-banner--horizontalmodifierLays the grid out as a row.
k-banner--sm-horizontalmodifierBecomes a row from the sm breakpoint up.

The default filled info banner. The icon is decorative (aria-hidden); the text is the message.

<div role="alert" class="k-banner k-banner--info">
<span class="k-icon k-icon--info" aria-hidden="true"></span>
<span>New software update available.</span>
</div>

--soft keeps the success color as a wash instead of a solid fill. Use it when the banner should recede.

<div role="alert" class="k-banner k-banner--success k-banner--soft">
<span>Your purchase has been confirmed.</span>
</div>

Put role="alert" on the element so assistive tech announces it when it shows up. The message has to live in text, not only in color. Hide decorative icons with aria-hidden="true". Actions inside are real buttons or links, so they get the kit focus ring.

Do

  • Set role="alert" on the banner.
  • Keep the banner in the page flow. Pin it with a toast when it should float.

Don’t

  • Use this as a status chip. Badges are for that.
  • Announce with color only.
  • Leave an icon visible to the accessibility tree.