Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Alert

Used to communicate a state that affects a system, feature or page.

SourceStorybookRecipe
This is the alert title

Usage

import { Alert } from "@chakra-ui/react"
<Alert.Root>
  <Alert.Indicator />
  <Alert.Content>
    <Alert.Title />
    <Alert.Description />
  </Alert.Content>
</Alert.Root>

Examples

Description

Render the Alert.Description component to provide additional context to the alert.

Invalid Fields
Your form has some errors. Please fix them and try again.

Status

Change the status of the alerts by passing the status prop. This affects the color scheme and icon used. Alert supports error, success, warning, and info statuses.

There was an error processing your request
Chakra is going live on August 30th. Get ready!
Seems your account is about expire, upgrade now
Data uploaded to the server. Fire on!

Variants

Use the variant prop to change the visual style of the alert. Values can be either subtle, solid, outline

Data uploaded to the server. Fire on!
Data uploaded to the server. Fire on!
Data uploaded to the server. Fire on!

With Close Button

Here's and example of how to compose the Alert with a close button.

Success!
Your application has been received. We will review your application and respond within the next 48 hours.

With Spinner

Here's and example of how to compose the Alert with a spinner.

We are loading something

Custom Icon

Use the icon prop to pass a custom icon to the alert. This will override the default icon for the alert status.

Submitting this form will delete your account

Color Palette Override

The default colorPalette is inferred from the status prop. To override the color palette, pass the colorPalette prop.

This is an info alert but shown as teal

Customization

You can style the Alert component using style props.

Black Friday Sale (20% off)
Upgrade your plan to get access to the sale.
Upgrade
Heads up: Black Friday Sale (20% off)

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

status 'info'
'info' | 'warning' | 'success' | 'error' | 'neutral'

The status of the component

variant 'subtle'
'subtle' | 'surface' | 'outline' | 'solid'

The variant of the component

size 'md'
'sm' | 'md' | 'lg'

The size of the component

Previous

Action Bar

Next

Avatar