Alert

Inline alert banner in info, success, warning and destructive tones that keep contrast in light and dark, with icons, a title, description and optional actions, polite status or assertive alert roles by severity, and a dismiss that fades the banner and collapses its height so the content below slides up, plus an AlertStack whose gaps collapse with it.

Preview

Alert preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/alert
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

Alert

variant?
"success" | "destructive" | "info" | "warning"
info
title?
ReactNode
—
description?
ReactNode
—
icon?
ReactNode

Replace the variant icon; `null` hides it.

—
actions?
ReactNode

Buttons rendered under the text (e.g. library `Button size="sm"`).

—
dismissible?
boolean

Show a dismiss (X) button.

false
dismissLabel?
string
Dismiss
open?
boolean

Controlled visibility. Leave undefined to let the Alert hide itself on dismiss.

—
onDismiss?
(() => void)

Called when the dismiss button is pressed.

—
className?
string
—

AlertStack

className?
string
—

Updated