pro-ui

Alert

Inline alert message with icon and color variants for info, success, warning, and error states.

Import

import { Alert } from '@dangbt/pro-ui'

Basic usage

<Alert variant="info" title="Did you know?">
  You can export your data as CSV from the table toolbar.
</Alert>
 
<Alert variant="warning" title="Trial expiring">
  Your trial expires in 3 days. Upgrade to keep access.
</Alert>
 
<Alert variant="danger">
  Failed to save changes. Please try again.
</Alert>
 
<Alert variant="success" title="Saved!">
  Your changes have been saved successfully.
</Alert>

Dismissible

const [show, setShow] = useState(true)
 
{show && (
  <Alert variant="warning" onDismiss={() => setShow(false)}>
    Please review the highlighted fields.
  </Alert>
)}

Props

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'danger''info'Alert severity
titlestringAlert headline
onDismiss() => voidIf provided, shows a dismiss button
childrenReactNodeAlert body text

On this page