NOCTA UI

Alert

A flexible alert component for displaying important messages with multiple variants and dark mode support

Installation

Install the Alert component using the nocta-ui CLI:

npx nocta-ui add alert

Then import the components you need:

import {
  Alert,
  AlertTitle,
  AlertDescription,
} from '@/components/ui/alert';

Examples

Default Alert

Simple Alert

Variants

The Alert component supports four variants: default, destructive, warning, and success.

Api Reference

Alert

PropTypeDefaultDescription
variant'default' | 'destructive' | 'warning' | 'success''default'Alert style variant and icon
showIconbooleantrueWhether to display the variant icon
classNamestring''Additional CSS classes
childrenReact.ReactNodeAlert content

AlertTitle

PropTypeDefaultDescription
asReact.ElementType'h5'HTML element to render
classNamestring''Additional CSS classes
childrenReact.ReactNodeTitle content

AlertDescription

PropTypeDefaultDescription
classNamestring''Additional CSS classes
childrenReact.ReactNodeDescription content

All components also accept their respective HTML element attributes.