Menu

Alert

Inline feedback. 4 types × 4 styles.

Installation

$ npx uix-ui@latest add alert

This copies the file into components/ui/alert.tsx in your project. npx shadcn@latest add @uix/alert works too.

Usage

alert.tsx
import { Alert } from "@/components/ui/alert";

<div style={{ width: 440, maxWidth: "100%" }}>
  <Alert type="info" title="Your parcel is on its way">Nusrat, the courier will call before arriving.</Alert>
</div>

Examples

Types

Appearances

With an action and a close button

Props

PropTypeDefaultDescription
appearancesubtle | accent | solid | outline"subtle"
typeinfo | success | warning | error"info"
titleReact.ReactNode–
actionsReact.ReactNode–Buttons or links under the message.
onClose() => void–Shows a dismiss button and calls this when it is pressed.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close