Skip to content

Alert

Alert

Feedback component for displaying important messages, warnings, or notifications.

Import

import Alert from '@primitivekit/svelte/Alert.svelte';

Basic Usage

<Alert>Content</Alert>

Props

No props available.

Customization

The Alert component supports CSS variables for complete customization:

<Alert style={{
  '--alert-bg-color': '#007bff',
  '--alert-text-color': '#ffffff'
}}>Custom</Alert>

Design Tokens

The following design tokens are available for customization:

  • --alert-padding
  • --alert-border-radius
  • --alert-border-width
  • --alert-icon-color
  • --alert-text-color
  • --solid
  • --info
  • --alert-bg-color
  • --subtle
  • --left-accent
  • … and 5 more

Accessibility

The Alert component is fully accessible and follows WCAG 2.1 AA standards:

  • ✅ Semantic HTML elements
  • ✅ Keyboard accessible
  • ✅ Focus visible indicator
  • ✅ Proper ARIA attributes
  • ✅ Screen reader compatible
  • ✅ Touch target size (44x44px minimum)
  • ✅ Color contrast compliance

Keyboard Navigation

KeyAction
TabMove focus to/from component

Related Components

  • Badge - Small label component for displaying status, counts, or categories.
  • Spinner - Loading indicator component for showing that content is being loaded or processed.
  • Progress - Feedback component for showing the completion progress of a task or operation.
  • Skeleton - Placeholder component for showing loading states with animated skeleton screens.

See Also