structyl

The full prop reference for the Alert component. Displays a callout for user attention.

Import

tsx
import { Alert } from '@structyl/styled';

Props

Alert

Convenience compound alert component with built-in icon, title, description, and optional close button.

PropTypeDefault
variant#'default' | 'success' | 'warning' | 'destructive' | 'info' | 'error'

Visual style variant of the alert

'default'
color#'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'default'

Color scheme for the alert (used in compound variants)

filled#boolean

Whether the alert background is filled (used with color variant)

icon#React.ReactNode

Icon/element to display on the left side of the alert

title#React.ReactNode

Title text or element to display in the alert

description#React.ReactNode

Description text or element to display below title

closeable#boolean

Whether to display a close button (top-right)

onClose#() => void

Callback fired when close button is clicked; also triggers close button display

className#string

Additional CSS classes to merge with component styles

children#React.ReactNode

Content rendered inside the alert (after description if provided)

ref#React.Ref<HTMLDivElement>

Forward reference to underlying div element

Alert.Root

Base alert container supporting variant/color styling.

PropTypeDefault
variant#'default' | 'success' | 'warning' | 'destructive' | 'info' | 'error'

Visual style variant of the alert

'default'
color#'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'default'

Color scheme for the alert (used in compound variants)

filled#boolean

Whether the alert background is filled (used with color variant)

className#string

Additional CSS classes to merge with component styles

onClose#() => void

Callback for close action (destructured, does not reach DOM)

children#React.ReactNode

Content rendered inside the alert

ref#React.Ref<HTMLDivElement>

Forward reference to underlying div element

Alert.Icon

Container for alert icon or icon element, positioned on the left with spacing.

PropTypeDefault
className#string

Additional CSS classes to merge with component styles

children#React.ReactNode

Icon element or SVG to display

ref#React.Ref<HTMLSpanElement>

Forward reference to underlying span element

Alert.Content

Wrapper div for alert text content (title, description, children).

PropTypeDefault
className#string

Additional CSS classes to merge with component styles

children#React.ReactNode

Content to display inside the wrapper

ref#React.Ref<HTMLDivElement>

Forward reference to underlying div element

Alert.Title

Heading element for alert title text.

PropTypeDefault
className#string

Additional CSS classes to merge with component styles

children#React.ReactNode

Title text or element

ref#React.Ref<HTMLHeadingElement>

Forward reference to underlying h5 element

Alert.Description

Container for alert description text, with reduced opacity.

PropTypeDefault
className#string

Additional CSS classes to merge with component styles

children#React.ReactNode

Description text or element

ref#React.Ref<HTMLDivElement>

Forward reference to underlying div element

Alert.Close

Close button for dismissing the alert (positioned top-right).

PropTypeDefault
className#string

Additional CSS classes to merge with component styles

onClick#(e: React.MouseEvent<HTMLButtonElement>) => void

Callback fired when close button is clicked

ref#React.Ref<HTMLButtonElement>

Forward reference to underlying button element

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library