Component guideEditable source

Alert

An inline message with a title, optional description, and severity styling.

Original component docs
On this page14 sectionsBack to top

Use Alert for a message that belongs in the page: a failed save, permission notice, or service warning. It does not open a modal or dismiss itself. Use Sonner for transient feedback.

Live preview
Loading preview...

#Installation

Complete the base setup, then use the CLI or create the source file manually:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/alert.json

#Usage

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";

export default function SaveError() {
  return (
    <Alert variant="destructive">
      <AlertTitle>Changes were not saved</AlertTitle>
      <AlertDescription>Check your connection, then try saving again.</AlertDescription>
    </Alert>
  );
}

#API reference

Prop / partPurposeDefault
variantdefault or destructivedefault
AlertTitleShort summary—
AlertDescriptionExplanation or recovery steps—
childrenIcon, text, and optional actions—
roleAnnouncement semanticsalert
classNameLayout and width overrides—

#Accessibility

The default alert role announces important updates. Do not use it for every decorative card. For non-urgent updates, choose role="status" or ordinary page text as appropriate. Use words, not color alone, to explain severity. Hide decorative icons with aria-hidden.

#Examples

#Destructive

Loading preview...

#Icon and description

Loading preview...

#Description only

Loading preview...

#Icon and title

Loading preview...

#Long title

Loading preview...

#Long description

Loading preview...

#Long title and description

Loading preview...

#Additional examples

#With button

Loading preview...