- Components
- Feedback
- Alert
Alert
Displays a callout for user attention.
Payment information
You are currently on the free plan. Upgrade to unlock more features.
default.tsx
Installation
npm
pnpm
yarn
bun
Examples
Variants
Use the variant
prop to change the visual style of the alert.
This is a neutral alert
This is an info alert
This is a critical alert
This is a warning alert
This is a success alert
variants.tsx
Title
Use the title
prop to add a title to the alert.
Your account has been suspended.
title.tsx
Content
Pass children to the alert to add content.
Payment Information
Enter your payment method to complete your purchase.
content.tsx
Custom icon
Use the icon
prop to add a custom icon to the alert. An explicit null
value can be used to remove the default icon.
Hello world
custom-icon.tsx
Action
Use the action
prop to add an action to the alert.
You are currently on the free plan. Upgrade to unlock more features.
action.tsx
Examples
Composition
If you need to customize things further, you can drop down the composition pattern.
Payment Information
Enter your payment method to complete your purchase.
composition.tsx
API Reference
Alert accepts all HTML div
element props and the following:
Prop | Type | Default | Description |
---|---|---|---|
variant | 'default' | 'success' | 'warning' | 'danger' | 'info' | 'default' | The visual style of the alert. |
fill | boolean | false | Weather the visual style should be filled. |
Last updated on 10/11/2024