5Sponsor

Alert

Alert box with success/error/warning/info variants

Terminal
alert-demo
No opentui live preview is registered for this example yet.

Installation

pnpm dlx shadcn@latest add @termcn/alert

Usage

import { Alert } from "@/components/ui/alert";
<Alert variant="success" title="Build complete">
  Everything is ready to ship.
</Alert>

Examples

Error

Use variant="error" to display an error alert.

Terminal
alert-error
No opentui live preview is registered for this example yet.

Warning

Use variant="warning" to display a warning alert.

Terminal
alert-warning
No opentui live preview is registered for this example yet.

Without Border

Set bordered={false} to remove the border.

Terminal
alert-no-border
No opentui live preview is registered for this example yet.

Custom Icon and Color

Override the icon and color with icon and color props.

Terminal
alert-custom
No opentui live preview is registered for this example yet.

API Reference

Alert

PropTypeDefault
variant"success" | "error" | "warning" | "info""info"
titlestringundefined
childrenReactNodeundefined
iconstringundefined
borderedbooleantrue
borderStyle"single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic"undefined
colorstringundefined
paddingXnumber1
paddingYnumber0