Alert
A callout for an important message, with a title, a description and optional actions.
Not translated yet
This product page has no French version.
import {Alert, AlertDescription, AlertTitle} from 'alinea/components'
import {IcRoundTranslate} from 'alinea/dashboard/icons'
export function AlertExample() {
return (
<Alert icon={IcRoundTranslate} style={{width: 300}}>
<AlertTitle>Not translated yet</AlertTitle>
<AlertDescription>
This product page has no French version.
</AlertDescription>
</Alert>
)
}Variants
warning asks for attention and destructive reports an error. Destructive alerts get role="alert", which screen readers announce right away, the others use role="status".
Scheduled for Monday
The autumn collection goes live at 9:00.
Unpublished changes
Tom Verbeke is editing this page.
Could not publish
The path /linen-shirt is already in use.
import {Alert, AlertDescription, AlertTitle} from 'alinea/components'
import {
IcBaselineErrorOutline,
IcRoundInfo,
IcRoundWarning
} from 'alinea/dashboard/icons'
export function AlertVariantsExample() {
return (
<div style={{display: 'grid', gap: 12, width: 420}}>
<Alert icon={IcRoundInfo}>
<AlertTitle>Scheduled for Monday</AlertTitle>
<AlertDescription>
The autumn collection goes live at 9:00.
</AlertDescription>
</Alert>
<Alert variant="warning" icon={IcRoundWarning}>
<AlertTitle>Unpublished changes</AlertTitle>
<AlertDescription>Tom Verbeke is editing this page.</AlertDescription>
</Alert>
<Alert variant="destructive" icon={IcBaselineErrorOutline}>
<AlertTitle>Could not publish</AlertTitle>
<AlertDescription>
The path /linen-shirt is already in use.
</AlertDescription>
</Alert>
</div>
)
}Actions
AlertActions holds buttons below the description, for example to retry or to dismiss the message.
A newer draft exists
Maya Janssens saved a draft of “Oak dining chair” 5 minutes ago.
import {
Alert,
AlertActions,
AlertDescription,
AlertTitle,
Button
} from 'alinea/components'
import {IcRoundHistory} from 'alinea/dashboard/icons'
export function AlertActionsExample() {
return (
<Alert icon={IcRoundHistory} style={{width: 420}}>
<AlertTitle>A newer draft exists</AlertTitle>
<AlertDescription>
Maya Janssens saved a draft of “Oak dining chair” 5 minutes ago.
</AlertDescription>
<AlertActions>
<Button size="sm" variant="outline">
Discard
</Button>
<Button size="sm" color="primary">
Open draft
</Button>
</AlertActions>
</Alert>
)
}Props
<Alert>
A callout for an important message: AlertTitle, AlertDescription and AlertActions
PropTypeDefaultDescription
variant'default' | 'destructive' | 'warning'Default 'default'
iconIconType | ReactElementDefault –
role'alert' | 'status' | 'note'Default –Defaults to
alert for destructive alerts, which interrupts assistive technology, and status for the othersAlso accepts className and style, id and aria-* labelling attributes and data-* attributes.
<AlertTitle>
PropTypeDefaultDescription
idstringDefault –
Also accepts className and style and data-* attributes.
<AlertDescription>
PropTypeDefaultDescription
idstringDefault –
Also accepts className and style and data-* attributes.
<AlertActions>
Controls below the description
PropTypeDefaultDescription
children*ReactNodeDefault –
Also accepts className and style and data-* attributes.