Components
Alert
Alert provides users with information that is especially important for them to see and understand. The component is designed to capture users' attention. The text in the alert should be short and clear.
React
Press Enter to start editing
const PreviewEn = () => { return <Alert>A message that is important for the user to see</Alert>; }; render(<PreviewEn />)
Usage
Examples
Changing the alert
In code, you change the type of alert by changing data-color.
The icon is controlled via CSS.
React
Press Enter to start editing
const VariantsEn = () => ( <> <Alert data-color='info'>This is an info alert</Alert> <Alert data-color='success'>This is a success alert</Alert> <Alert data-color='warning'>This is a warning alert</Alert> <Alert data-color='danger'>This is a danger alert</Alert> </> ); render(<VariantsEn />)
HTML
For HTML, use the class name ds-alert and the attribute data-color to change the type of alert.
Read above for when to use role and aria-live.
Read about role and aria-live on the accessibility page for the Alert component.