Alert API
View componentThe full prop reference for the Alert component. Displays a callout for user attention.
Import
import { Alert } from '@structyl/styled';Props
Alert
Convenience compound alert component with built-in icon, title, description, and optional close button.
| Prop | Type | Default |
|---|---|---|
| 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# | booleanWhether the alert background is filled (used with color variant) | — |
| icon# | React.ReactNodeIcon/element to display on the left side of the alert | — |
| title# | React.ReactNodeTitle text or element to display in the alert | — |
| description# | React.ReactNodeDescription text or element to display below title | — |
| closeable# | booleanWhether to display a close button (top-right) | — |
| onClose# | () => voidCallback fired when close button is clicked; also triggers close button display | — |
| className# | stringAdditional CSS classes to merge with component styles | — |
| children# | React.ReactNodeContent 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.
| Prop | Type | Default |
|---|---|---|
| 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# | booleanWhether the alert background is filled (used with color variant) | — |
| className# | stringAdditional CSS classes to merge with component styles | — |
| onClose# | () => voidCallback for close action (destructured, does not reach DOM) | — |
| children# | React.ReactNodeContent 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.
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes to merge with component styles | — |
| children# | React.ReactNodeIcon 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).
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes to merge with component styles | — |
| children# | React.ReactNodeContent to display inside the wrapper | — |
| ref# | React.Ref<HTMLDivElement>Forward reference to underlying div element | — |
Alert.Title
Heading element for alert title text.
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes to merge with component styles | — |
| children# | React.ReactNodeTitle text or element | — |
| ref# | React.Ref<HTMLHeadingElement>Forward reference to underlying h5 element | — |
Alert.Description
Container for alert description text, with reduced opacity.
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes to merge with component styles | — |
| children# | React.ReactNodeDescription text or element | — |
| ref# | React.Ref<HTMLDivElement>Forward reference to underlying div element | — |
Alert.Close
Close button for dismissing the alert (positioned top-right).
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes to merge with component styles | — |
| onClick# | (e: React.MouseEvent<HTMLButtonElement>) => voidCallback 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 .