Skip to Content

Alert

Display toast and banner notifications for system feedback with support for actions and dismissal.

Import

import { Alert } from "@raydenui/ui";

Usage

Basic

<Alert state="information">This is an informational message</Alert>

States

<Alert state="information">Information alert</Alert> <Alert state="success">Success! Operation completed.</Alert> <Alert state="warning">Warning: Please review before proceeding.</Alert> <Alert state="error">Error: Something went wrong.</Alert>

Variants

// Toast variant (default) <Alert variant="toast" state="success"> Changes saved successfully </Alert> // Banner variant <Alert variant="banner" state="warning"> Your trial expires in 3 days </Alert>

With Title

<Alert state="success" title="Payment Successful"> Your payment of $99.00 has been processed. </Alert>

With Actions

<Alert state="error" title="Connection Lost" actions={ <Button size="sm" variant="destructive" appearance="outlined"> Retry </Button> } > Unable to connect to the server. Please try again. </Alert>

Dismissible

const [show, setShow] = useState(true); {show && ( <Alert state="information" onDismiss={() => setShow(false)} > New features are available! </Alert> )}

Props

PropTypeDefaultDescription
variant"toast" | "banner""toast"Alert variant
state"information" | "success" | "warning" | "error""information"Alert state/color
titlestring—Alert title
iconReactNode—Custom icon
actionsReactNode—Action buttons
onDismiss() => void—Dismiss handler (shows close button)
classNamestring—Additional CSS classes

Accessibility

  • Uses role="alert" for screen readers
  • Dismissible alerts have proper close button labels
  • Icons are decorative
Last updated on