Skip to content
Docs/Alert

Alert

Feedback messages with multiple variants, optional title, optional description, and optional icon.

Usage

tsx
1import { Alert, AlertTitle } from '@storm-ds/ui'
2
3<Alert>
4 <AlertTitle>Heads up!</AlertTitle>
5 Something happened.
6</Alert>

Variants

All Variants

tsx
1<Alert variant="success"><AlertTitle>Success</AlertTitle>Your changes have been saved.</Alert>
2<Alert variant="warning"><AlertTitle>Warning</AlertTitle>This action cannot be undone.</Alert>
3<Alert variant="info"><AlertTitle>Info</AlertTitle>A new version is available.</Alert>

With Icon

tsx
1<Alert icon={<InfoIcon className="w-4 h-4" />}><AlertTitle>Info</AlertTitle>Here is some context.</Alert>

With Description

Props

PropTypeDefaultDescription
variant'default' | 'secondary' | 'destructive' | 'success' | 'warning' | 'info''default'Alert style
iconReactNodeundefinedIcon displayed on the left
classNamestring-Custom classes

Use with AI

Create a Next.js component using Storm UI's Alert. Import: `import { Alert, AlertTitle, AlertDescription } from '@storm-ds/ui'`. Uses role="alert". Variants: default (border-storm-border), secondary (violet tint), destructive (red tint), success (green tint), warning (yellow tint), info (blue tint). AlertTitle is an optional bold heading. AlertDescription is an optional secondary text block. Pass an icon via the `icon` prop (ReactNode) to display it on the left side. Example: `<Alert variant="success" icon={<CheckIcon />}><AlertTitle>Saved</AlertTitle><AlertDescription>Your changes have been saved.</AlertDescription></Alert>`