Skip to main content

Alert

A callout with five semantic tones, a blur reveal on mount, a short shake for destructive alerts and a spring height collapse when dismissed.

variant="default"·open:true

Customize

Blur reveal (px)8
Speed0.4

Installation

npx shadcn@latest add @kinetic/alert

Usage

Put an icon, an AlertTitle and an AlertDescription inside Alert.

import { CheckCircleIcon } from "@heroicons/react/24/outline";
import { Alert, AlertDescription, AlertTitle } from "@/components/kinetic/ui/alert";

export function Synced() {
  return (
    <Alert variant="success">
      <CheckCircleIcon />
      <AlertTitle>Changes saved</AlertTitle>
      <AlertDescription>Your profile is up to date.</AlertDescription>
    </Alert>
  );
}

Variants

Use variant with default, destructive, success, warning or info. Every alert renders with role="alert".

<Alert variant="warning">...</Alert>
<Alert variant="destructive">...</Alert>

Dismissible

Set dismissible to add a close button. The alert collapses its height with a spring and then unmounts. dismissLabel sets the button's accessible name.

<Alert dismissible dismissLabel="Hide notice">...</Alert>

Controlled

Pass open and onOpenChange to drive visibility yourself, or defaultOpen to start hidden. Opening again plays the reveal.

const [open, setOpen] = useState(true);

<Alert open={open} onOpenChange={setOpen} dismissible>...</Alert>

Action

Add an AlertAction row for buttons that line up with the text column.

<Alert variant="info">
  <AlertTitle>Update available</AlertTitle>
  <AlertDescription>Version 2.4 is ready to install.</AlertDescription>
  <AlertAction>
    <Button size="sm">Install</Button>
  </AlertAction>
</Alert>

Motion preferences

animateOnMount plays the blur reveal on first render and shakeOnDestructive adds the horizontal shake. Tune them with blurPx and speed. Reduced motion shows and hides the alert without movement.

API Reference

Alert

Zero-dependency callout alert with five semantic variants, WAAPI blur-to-sharp entrance, optional destructive shake, and Euler spring height collapse.

PropTypeDefaultDescription
variant"default" | "destructive" | "success" | "warning" | "info""default"Visual and semantic tone for the alert callout.
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => voidtrueControlled or uncontrolled visibility driving spring height collapse.
dismissible / dismissLabelboolean / stringfalse / "Dismiss alert"Renders an accessible 24x24px close button in the top-right corner.
animateOnMount / shakeOnDestructive / blurPx / speedboolean / boolean / number / numbertrue / true / 8 / 0.4Configures blur reveal on mount, horizontal destructive shake, blur radius, and speed.

AlertTitle / AlertDescription / AlertAction

Clamped heading, rich description track, and inline action row aligned with the content column.

PropTypeDefaultDescription
...propsReact.ComponentProps<"div">-Standard div attributes.

Notes

Omit size-* classes on direct child icons inside Alert since [&>svg]:size-4 handles sizing automatically. Override role='region' with aria-label for non-urgent static notices.