Skip to content

KAlert ​

示例 ​

Alert banner with a light surface, a colored left accent bar, and optional filled semantic icon. Each variant derives its tint from the theme's color tokens so it adapts to light/dark automatically. Includes title and description sub-components.

Sub-Components ​

  • KAlert — Root alert container with variant and closable support
  • KAlertTitle — Alert title (<h5> element)
  • KAlertDescription — Alert description text

Props (KAlert) ​

NameTypeDefaultDescription
variant'default' | 'destructive' | 'warning' | 'info' | 'success''default'Visual style variant of the alert. default is neutral with no icon; the others get a semantic color, left accent bar, and icon.
closablebooleanfalseWhether the alert can be dismissed with a close button. Fades out (~200ms) before the close event fires.
titlestring—Convenience title text. Ignored if the default slot is used.
descriptionstring—Convenience description text. Ignored if the default slot is used.
classstring—Additional CSS classes.
theme'auto' | 'day' | 'night''auto'Theme mode. auto follows the current theme; day and night force a specific mode.

Emits ​

NameDescription
closeEmitted after the alert finishes its fade-out transition when the close button is clicked.

Slots ​

NameDescription
defaultAlert content. Use sub-components (KAlertTitle / KAlertDescription) for structured layouts; takes precedence over the title / description props.

Basic Usage ​