Lapikit

Alert component

Alert

The Alert component displays contextual messages in the user interface: notifications, warnings, confirmations or errors. It can be styled in several variants, states and densities, and is easily integrated using Snippets to enrich its content.

Examples of alert

Base

This is the minimal version of an alert. It contains simple text and adopts the default styles (variant filled, density default, neutral state).

Variant

The alert can adopt different visual styles via the prop variant:

  • filled (default): solid background.
  • outline: visible border.
  • text : transparent background.
  • dash : dotted border.

These variants can be adapted to different visual contexts or levels of importance.

State

For greater expressiveness, an alert can be marked by a status: info, success, warning, error. Each state applies a color and a contextual icon to convey the right signal to the user.

Density

Prop density lets you control the vertical size of the alert:

  • compact: reduced margins and padding, useful for lists or tables.
  • comfortable: a visual compromise.
  • default: standard spacing.

Ideal for adapting alerts to different levels of hierarchy or UI density.

Snippet

The prepend, append and close snippets are used to add custom content:

  • Icon or avatar on the left (prepend),
  • Button or action on the right (append),
  • Custom close icon (close).

These snippets enable you to compose rich alerts without sacrificing structure.

Closable

Add the closable prop to allow the user to close the alert manually. A close button is automatically displayed, unless overridden by the close slot.

API Reference

propstypedescriptiondefaulttype_extend
ref $bindableHTMLElementDirect access to DOM elementundefined
isstringDefines the HTML tag.div
hrefstringIf set, transforms alert into clickable linkundefined
open $bindablebooleanControls alert display.true
darkbooleanEnable dark theme for component.false
lightbooleanEnable light theme for the component.false
colorstringApplies a custom color to text or icons.undefined
backgroundstringApply a custom background color.undefined
variantenumSets the visual style of the alert.undefinedoutline | text | dash
densityenumControls vertical densitydefaultcompact | comfortable | default
roundedstringControls item rounding (none, sm, md, lg, etc.).md
closablebooleanIf true, displays a close button to hide the alert.false
warningbooleanApply a visual style of warning.false
infobooleanApplies an informative style.false
successbooleanApply a success style (confirmation, validation, etc.).false
errorbooleanApply a visual style of error.false
prependSnippetApply a visual style of error.undefinedSnippet to insert content to the right of the alert (e.g. icon, button, action)
appendSnippetSnippet to insert content to the left of the alert (e.g. icon or avatar).undefined
closeSnippetSnippet to customize the close button (replace default icon).undefined

Variables CSS

variabledefaultdescription
–-alert-color–-kit-on-containerText color
–-alert-background–-kit-containerBackground color
–-alert-radius–-kit-radius-mdAlert edge radius

To enhance your Alerts, think of Icon for legibility, or Button for integrated actions.

©2025 Lapikit.

Made with by Nycolaide