The library is still in early development. Breaking changes and bugs may occur without prior notice. Thanks for your interest in using the library!
v0.2.47Beta

Search

Alert

Source

A component used to display important messages or feedback to the user.

Heads up!
You can customize this alert with different variants.

Usage

Import the Alert, AlertTitle, and AlertDescription components from @bun-ui/react and use them in your project:

import { Alert, AlertDescription, AlertTitle } from "@bun-ui/react"
<Alert variant="info">
  <AlertTitle>Information</AlertTitle>
  <AlertDescription>This is an informational alert.</AlertDescription>
</Alert>

Colors

The Alert component supports multiple variants to indicate different types of messages. Use the color prop to specify the style:

info
This is an informational alert. It provides useful information to the user.
Success
Your action was completed successfully.
Warning
Be careful with this action. It's irreversible.
Error
Something went wrong. Please try again.

Variants

The Alert component comes with two alternative style options filled an outlined, which you can set using the variant prop.

Filled

Standard
Your action was completed successfully.
Success
Your action was completed successfully.
Warning
Be careful with this action. It's irreversible.
Error
Something went wrong. Please try again.

Outlined

Standard
Your action was completed successfully.
Success
Your action was completed successfully.
Warning
Be careful with this action. It's irreversible.
Error
Something went wrong. Please try again.

Icons

The Alert component automatically includes an icon based on the variant. You can also provide a custom icon using the icon prop:

Hot Tip!
You can refresh your dev server with `rs` in many CLIs. Pretty slick, huh?

Action

Add an action to your Alert with the action prop. This lets you insert any element after the Alert's message.

The Alert is showing default action button.
The Alert is showing a custom action button.