Import the alert component. Import the slot directives only for custom content.

alert.ts
import { KuiAlert } from '@kikita-labs/ui';

// Only for custom content slots:
import { KuiAlertActions, KuiAlertIcon, KuiAlertMessage, KuiAlertTitle } from '@kikita-labs/ui';

Unlike kuiToast(), an alert does not float above the interface, does not dismiss itself on a timer and needs no body region. It renders next to the content it relates to.

Neutral
A plain notice without severity.
Info
We updated the terms of service.
Success
Your changes were saved.
Warning
Your access token expires in 3 days.
Danger
The upload failed. Check your connection.
<div class="alert-example">
  <kui-alert appearance="neutral" title="Neutral" message="A plain notice without severity." />
  <kui-alert appearance="info" title="Info" message="We updated the terms of service." />
  <kui-alert appearance="success" title="Success" message="Your changes were saved." />
  <kui-alert appearance="warning" title="Warning" message="Your access token expires in 3 days." />
  <kui-alert
    appearance="danger"
    title="Danger"
    message="The upload failed. Check your connection."
  />
</div>

shape reuses the button vocabulary restricted to soft (default), outline and solid. size sm tightens padding and gap.

Soft
Tinted background and border.
Outline
Transparent background.
Solid
Saturated fill with on-fill text.
Small
Tighter padding and gap.
<div class="alert-example">
  <kui-alert appearance="info" shape="soft" title="Soft" message="Tinted background and border." />
  <kui-alert appearance="info" shape="outline" title="Outline" message="Transparent background." />
  <kui-alert
    appearance="info"
    shape="solid"
    title="Solid"
    message="Saturated fill with on-fill text."
  />
  <kui-alert appearance="info" size="sm" title="Small" message="Tighter padding and gap." />
</div>

The alert is controlled: (closed) only notifies you that the close button was clicked, so render it conditionally to hide it. actionLabel adds an inline ghost button that emits (action).

Session expiring
Your access token expires in 3 days. Renewed 0 times.
<div class="alert-example">
  @if (!dismissed()) {
    <kui-alert
      appearance="warning"
      title="Session expiring"
      message="Your access token expires in 3 days. Renewed {{ renewals() }} times."
      actionLabel="Renew"
      (action)="renew()"
      (closed)="dismissed.set(true)"
    />
  } @else {
    <button kuiButton shape="outline" type="button" (click)="restore()">
      Show the alert again
    </button>
  }
</div>

Project kuiAlertTitle, kuiAlertIcon, kuiAlertMessage or kuiAlertActions for richer content. A projected slot takes over its area entirely and the matching input is ignored.

Upload failed retrying

Check your connection and try again.

<kui-alert appearance="danger" [closable]="false">
  <kui-icon kuiAlertIcon name="cloud-off" />
  <span kuiAlertTitle>Upload failed <span kuiBadge appearance="danger">retrying</span></span>
  <p kuiAlertMessage>Check your connection and <a href="#retry">try again</a>.</p>
  <div kuiAlertActions>
    <button kuiButton shape="ghost" size="xs" type="button">Retry</button>
    <button kuiButton shape="ghost" size="xs" type="button">Dismiss</button>
  </div>
</kui-alert>

banner stretches the alert to the full container width, removes the corner radius and reduces the border to a single bottom seam. Use it for a system-wide message above the page content.

We updated the terms of service.
<kui-alert appearance="info" banner message="We updated the terms of service." />

Set defaults.alert once for the application or for a subtree. Each option resolves as local input > defaults.alert.<option> > built-in default.

import { provideKikitaUi } from '@kikita-labs/ui';

export const appConfig: ApplicationConfig = {
  providers: [
    provideKikitaUi({
      defaults: {
        alert: {
          /* options below */
        },
      },
    }),
  ],
};
NameTypeDefaultDescription
size'sm' | 'md' — Component size. Takes precedence over the global defaults.size.
shape'soft' | 'outline' | 'solid' — Default shape.
showIconboolean — Shows the leading status icon.
closableboolean — Shows the close button.
closeIconKuiIconGlyph — Icon of the close button. Takes precedence over defaults.icons.close. See Structural Icons.

Set any of these on the component or an ancestor to restyle one part. Each token is optional: when it is not set, the part uses the role or scale token in the default column.

NameTypeDefaultDescription
--kui-alert-title-font-sizeCSS custom property--kui-text-sm-sizeTitle font size
--kui-alert-message-font-sizeCSS custom property--kui-text-sm-sizeMessage font size
--kui-alert-actions-gapCSS custom property--kui-space-3Actions gap
--kui-alert-icon-sizeCSS custom property1.125rem (1rem for sm)Status icon size

Every text the component owns (accessible names, visible words, announcements) is a typed message with an English default. Override it for the application with provideKikitaUi({ messages }), or for a subtree with provideKuiMessages.

NameTypeDefaultDescription
closestring — Accessible name of the dismiss button. Default Close notification.

Inputs verified against @kikita-labs/ui v2.0.0 public typings.

NameTypeDefaultDescription
appearance'neutral' | 'info' | 'success' | 'warning' | 'danger''neutral'Semantic type. Same five values as the toast. neutral never shows the built-in icon; danger is announced assertively, every other value politely.
shape'soft' | 'outline' | 'solid' | undefinedundefinedVisual weight, using the button shape vocabulary. Falls back to defaults.alert.shape, then soft.
size'sm' | 'md' | undefinedundefinedPadding and gap density. Falls back to defaults.alert.size, then the root defaults.size (sm or md only), then md.
bannerbooleanfalseStretches the alert to the full width of its container and removes the corner radius.
titlestring | undefinedundefinedOptional single-line heading. Ignored when [kuiAlertTitle] is projected. Set at least one of title, message or [kuiAlertMessage].
messagestring | undefinedundefinedOptional supporting text below the title. Ignored when [kuiAlertMessage] is projected.
showIconboolean | undefinedundefinedShows the built-in appearance icon (defaults.alert.showIcon, then true). neutral never shows one. Ignored when [kuiAlertIcon] is projected, which always renders.
closableboolean | undefinedundefinedShows the close button and enables (closed). Falls back to defaults.alert.closable, then true.
closeLabelstring | undefinedundefinedAccessible label for the close button. Falls back to the alert.close message (Close notification).
actionLabelstring | undefinedundefinedLabel for the inline ghost action button. Ignored when [kuiAlertActions] is projected.
(action)void-Emits when the action button is clicked. Not emitted for a projected [kuiAlertActions].
(closed)void-Emits when the close button is clicked. The alert never removes itself; hide it with @if.
[kuiAlertTitle]content slot-Replaces the plain title string with arbitrary markup.
[kuiAlertIcon]content slot-Replaces the built-in severity icon. A projected icon always renders, even for neutral, and inherits --kui-alert-icon-color.
[kuiAlertMessage]content slot-Replaces the plain message string with arbitrary markup (links, lists). The title still renders alongside it.
[kuiAlertActions]content slot-Replaces the single ghost action button with custom controls. kuiButton inside it picks up the appearance-tinted ghost colour.
KuiAlertOptionsinterface-Shape of defaults.alert: size, shape, showIcon, closable and closeIcon.

The alert is a static region, not an overlay, and its announcement depends on severity.

  • appearance="danger" renders role="alert" with aria-live="assertive"; every other appearance uses role="status" with aria-live="polite". Both are aria-atomic="true".
  • The alert itself is not in the tab order; only its action and close buttons are.
  • The close button has an accessible name from closeLabel or the alert.close message.
  • Severity is never colour-only: info, success, warning and danger pair an icon with text. neutral has no icon because it carries no severity.
  • Escape does not close an alert.

Documented limits of the installed package.

  • The close button hit target is 28px (kuiIconButton size="xs"), below the 44px platform recommendation. The toast shares this limitation.
  • A formal assistive-technology review of the alert has not been run yet; see state-coverage.md in the library repository.