Alert
This component shows high priority messages, they’re meant to be noticed & prompt users
Basic Usage
import { Alert } from '@krakentech/coral';
<Alert onClose={...}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Alert content
Properties
icon
<Alert inline severity="info" icon={<IconSecure color="currentColor" />}>
<Typography color="inherit" textStyle="h5">
Secure connection
</Typography>
</Alert>Secure connection
Alternatively, you can set the icon prop to false to hide the icon.
<Alert icon={false} onClose={...}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Alert content
iconAlignment
<Alert iconAlignment="top" onClose={...}>
<Typography color="inherit" textStyle="h5">
This is a lot of alert content to help illustrate how icons can be
aligned. Lorem ipsum dolor sit, amet consectetur adipisicing elit.
Perferendis culpa commodi nobis nesciunt! Blanditiis cumque dolore ipsam
tempora repellat quidem voluptatum, molestias cupiditate laborum. Nisi
ipsa quo odio sit veniam.
</Typography>
</Alert>This is a lot of alert content to help illustrate how icons can be aligned. Lorem ipsum dolor sit, amet consectetur adipisicing elit. Perferendis culpa commodi nobis nesciunt! Blanditiis cumque dolore ipsam tempora repellat quidem voluptatum, molestias cupiditate laborum. Nisi ipsa quo odio sit veniam.
inline
<Alert inline onClose={...}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Alert content
closeIcon
<Alert closeIcon={<IconInfo color="currentColor" size={16} />} onClose={...}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Alert content
severity
<Alert severity="info" onClose={...}>
<Typography color="inherit" textStyle="h5">
Info
</Typography>
</Alert>
<Alert severity="success" onClose={...}>
<Typography color="inherit" textStyle="h5">
Success
</Typography>
</Alert>
<Alert severity="warning" onClose={...}>
<Typography color="inherit" textStyle="h5">
Warning
</Typography>
</Alert>
<Alert severity="error" onClose={...}>
<Typography color="inherit" textStyle="h5">
Error
</Typography>
</Alert>Info
Success
Warning
Error
theme
<Alert severity="info" theme="base900" onClose={...}>
<Typography color="inherit" textStyle="h5">
base900 theme - Info
</Typography>
</Alert>
<Alert severity="success" theme="base900" onClose={...}>
<Typography color="inherit" textStyle="h5">
base900 theme - Success
</Typography>
</Alert>
<Alert severity="warning" theme="base900" onClose={...}>
<Typography color="inherit" textStyle="h5">
base900 theme - Warning
</Typography>
</Alert>
<Alert severity="error" theme="base900" onClose={...}>
<Typography color="inherit" textStyle="h5">
base900 theme - Error
</Typography>
</Alert>base900 theme - Info
base900 theme - Success
base900 theme - Warning
base900 theme - Error
Event Handlers
<Alert onClose={() => {}}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Responsiveness
<Alert inline={{ base: false, md: true }} severity="success" onClose={...}>
<Typography color="inherit" textStyle="h5">
Alert content
</Typography>
</Alert>Alert content
Full API
Design
Good to know
Choose an alert if there is important information you want to draw attention to, it is important that this doesn’t interrupt the users task but just grab their attention.
Why are there 4 alert colours? These correspond to the severity of the alert:
- Red: Error
- Orange: Warning
- Blue: Info (good or bad)
- Green: Success
Customisation
Our alert component has a few variations you can play with. These include:
- Dark (Default) and Light mode
- Dismissible or not
Component breakdown
- Corner radius: 12px
- Outline: 2px
- Item padding: 16px
- Horizontal padding: 16px
- Vertical padding: 8px
- Text: H5 & Body 1