Alert

stable 1.3 kB
<hk-alert>

An inline banner in four tones. Dismissal actually removes it, and the tone is carried by an icon as well as colour.

#banner#message

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
tone'info' | 'success' | 'warning' | 'danger''info'Sets the skin and the icon.
titlestring''Bold first line.
dismissiblebooleanfalseShows the close button.
iconstring | nullnullOverrides the tone icon.

Outputs

  • dismissedEventEmitter<void>

    Emits when closed.

Keyboard

  • Tab Reaches the dismiss button
  • Enter / Space Dismisses

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-alert-info-bg#f0f9ffInfo fill.
--hk-alert-danger-bg#fef2f2Danger fill.
--hk-alert-radius12pxCorner radius.

Accessibility

  • Uses role="alert" for danger and warning so they interrupt, and role="status" for info and success so they do not.
  • Every tone pairs a distinct icon with its colour, so the meaning survives colour blindness.

More in Feedback