An alert is used to convey important information to the user through the use of contextual types, icons, and colors.
Import
import{Alert}from'@trendmicro/react-styled-ui';
Usage
Variants
You can use the variant prop to change the appearance of the alert. The variants come in two variations: solid and outline.
Solid
The solid variant is used to indicate an important message.
EDITABLE EXAMPLE
<Alertvariant="solid"severity="info">
<Text>This is an important message.</Text>
</Alert>
Outline
The outline variant is useful for displaying a contextual alert that is not a part of the primary flow of the application.
EDITABLE EXAMPLE
<Alertvariant="outline"severity="info">
<Text>This is a contextual alert.</Text>
</Alert>
Severity levels
The severity prop can be used to specify the severity level of the alert. The severity levels are: success, info, warning, and error. The default severity level is success.
EDITABLE EXAMPLE
<Stackdirection="column"spacing="6x">
<Stackdirection="column"spacing="2x">
<Alertvariant="solid"severity="success">
<Text>This is a success alert.</Text>
</Alert>
<Alertvariant="solid"severity="info">
<Text>This is an info alert.</Text>
</Alert>
<Alertvariant="solid"severity="warning">
<Text>This is a warning alert.</Text>
</Alert>
<Alertvariant="solid"severity="error">
<Text>This is an error alert.</Text>
</Alert>
</Stack>
<Stackdirection="column"spacing="2x">
<Alertvariant="outline"severity="success">
<Text>This is a success alert.</Text>
</Alert>
<Alertvariant="outline"severity="info">
<Text>This is an info alert.</Text>
</Alert>
<Alertvariant="outline"severity="warning">
<Text>This is a warning alert.</Text>
</Alert>
<Alertvariant="outline"severity="error">
<Text>This is an error alert.</Text>
</Alert>
</Stack>
</Stack>
icon prop
The icon prop allows you to specify an icon to be displayed in the alert.
If not specified, the default icon will be used based on the severity prop.