Alert
Alert component for feedback.
When To Use
- When you need to show alert messages to users.
- When you need a persistent static container which is closable by user actions.
Basic
The simplest usage for short messages.
Success Text
Info Text
Warning Text
Error Text
astro
---
import Alert from '@/components/feedback/Alert.astro';
---
<Alert variant="success" title="Success Text" />
<Alert variant="info" title="Info Text" />
<Alert variant="warning" title="Warning Text" />
<Alert variant="error" title="Error Text" /> Closable
To show close button.
Warning Text
Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text
Error Text
Error Description Error Description Error Description Error Description Error Description Error Description
astro
---
import Alert from '@/components/feedback/Alert.astro';
---
<Alert variant="warning" title="Warning Text" closable>
Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text Warning Text
</Alert>
<Alert variant="error" title="Error Text" closable>
Error Description Error Description Error Description Error Description Error Description Error Description
</Alert> Description
Additional description for alert message.
Success Text
Success Description Success Description Success Description
Info Text
Info Description Info Description Info Description Info Description
Warning Text
Warning Description Warning Description Warning Description Warning Description
Error Text
Error Description Error Description Error Description Error Description
astro
---
import Alert from '@/components/feedback/Alert.astro';
---
<Alert variant="success" title="Success Text">
Success Description Success Description Success Description
</Alert>
<Alert variant="info" title="Info Text">
Info Description Info Description Info Description Info Description
</Alert>
<Alert variant="warning" title="Warning Text">
Warning Description Warning Description Warning Description Warning Description
</Alert>
<Alert variant="error" title="Error Text">
Error Description Error Description Error Description Error Description
</Alert> Custom icon
Make information more clear and more friendly and meet customized needs.
Success Tips
Detailed description and advices about successful copywriting.
Informational Notes
Additional description and informations about copywriting.
Warning
This is a warning notice about copywriting.
Error
This is an error message about copywriting.
astro
---
import Alert from '@/components/feedback/Alert.astro';
---
<Alert variant="success" title="Success Tips" icon="ThumbsUp">
Detailed description and advices about successful copywriting.
</Alert>
<Alert variant="info" title="Informational Notes" icon="Info">
Additional description and informations about copywriting.
</Alert>
<Alert variant="warning" title="Warning" icon="TriangleAlert">
This is a warning notice about copywriting.
</Alert>
<Alert variant="error" title="Error" icon="CircleX">
This is an error message about copywriting.
</Alert> API Reference
| Property | Description | Type | Default |
|---|---|---|---|
| variant | The variant of the alert, dictating its colors and default icon. | 'info' | 'success' | 'warning' | 'error' | 'info' |
| title | Optional title text for the alert. | string | - |
| icon | Custom icon to override the variant default. Must be a valid IconName. | IconName | - |
| closable | If true, shows a close button that dismisses the alert when clicked. | boolean | false |