Feedback
Alert
Inline message for info, success, warning, or error.
Available in
reactangularPreview
Live previewreal component
Heads up — this server is in preview.
Connected to github-mcp. 12 tools available.
Your token expires in 2 days.
Connection lost. Reconnecting…
Install
TerminalBash
npx @mcp-elements/cli add alertUsage
alert-example.tsxTSX
import { Alert } from '@mcp-elements/react'
export function Example() {
return (
<div className="flex flex-col gap-3">
<Alert variant="info" title="Info">This is an informational alert.</Alert>
<Alert variant="success" title="Success">Your changes have been saved.</Alert>
<Alert variant="warning" title="Warning">This action cannot be undone.</Alert>
<Alert variant="error" title="Error">Something went wrong. Please try again.</Alert>
</div>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'info' | 'success' | 'warning' | 'error' | 'info' | Semantic style of the alert |
title | string | — | Bold heading text |
dismissible | boolean | false | Shows a close button to dismiss the alert |
onDismiss | () => void | — | Called when the dismiss button is clicked |