Skip to content

Alert

Contextual feedback messages with semantic variants.

Props

AlertProps

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'destructive' | 'muted''info'Visual variant
iconLucideIconAuto-selectedCustom icon
hideIconbooleanfalseHide the icon
classNamestring-Additional class
childrenReactNode-Alert content

Compound Components

AlertTitle

Renders as <h5>. Accepts standard heading props.

AlertDescription

Renders as <p>. Accepts standard paragraph props.

Example

tsx
<Alert variant="warning">
  <AlertTitle>Unsaved changes</AlertTitle>
  <AlertDescription>
    You have unsaved changes that will be lost.
  </AlertDescription>
</Alert>

Variants

VariantIconUse case
infoInfoInformational messages
successCheckCircleSuccess confirmations
warningAlertTriangleWarnings
destructiveXCircleErrors
muted-Subtle context

See also