Feedback

Alert

Inline message for info, success, warning, or error.

Available inreactangular

Preview

Live previewreal component

Install

TerminalBash
npx @mcp-elements/cli add alert

Usage

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

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'error''info'Semantic style of the alert
titlestringBold heading text
dismissiblebooleanfalseShows a close button to dismiss the alert
onDismiss() => voidCalled when the dismiss button is clicked