Skip to content

Alert

Inline alert block for displaying important messages inside containers, panels, or cards. Uses a colored circle icon to convey meaning.

Also known as: callout, banner, notice, inline message

View in Storybook

When to use

  • Highlighting important information, warnings, or errors inside a page section.
  • Showing success confirmations after an action.
  • Providing contextual guidance or tips.

Import

tsx
import { Alert } from '@vacano/ui'

Usage

tsx
<Alert
  icon={<InfoIcon />}
  title="This is an alert"
  description="Thanks for subscribing to our newsletter!"
/>

Variants

The variant prop controls the icon circle color. The alert container stays neutral.

tsx
<Alert icon={<InfoIcon />} title="Information" variant="normal" />
<Alert icon={<CheckIcon />} title="Success" variant="success" />
<Alert icon={<AlertTriangleIcon />} title="Warning" variant="warning" />
<Alert icon={<XIcon />} title="Error" variant="danger" />

Radius

The radius prop controls the border radius of the alert container.

tsx
<Alert icon={<InfoIcon />} title="No radius" radius="none" />
<Alert icon={<InfoIcon />} title="Small radius" radius="sm" />
<Alert icon={<InfoIcon />} title="Medium radius" radius="md" />
<Alert icon={<InfoIcon />} title="Large radius" radius="lg" />
<Alert icon={<InfoIcon />} title="Full radius" radius="full" />

Props

PropTypeDefaultDescription
iconReactNode-Icon displayed inside a colored circle
titleReactNode-Bold title text
descriptionReactNode-Supporting description text
variant'normal' | 'success' | 'warning' | 'danger''normal'Icon circle color variant
radius'none' | 'sm' | 'md' | 'lg' | 'full''lg'Border radius of the container
classNamestring-CSS class name for the root element
classnamesAlertClassNames-Custom class names for sub-elements
refRef<HTMLDivElement>-Ref forwarded to the root element
data-test-idstring-Test identifier attribute

The component also accepts all standard HTMLDivElement attributes (except title and className which are overridden by component props).

AlertClassNames

KeyDescription
iconIcon circle container
titleTitle text
descriptionDescription text

Released under the MIT License.