Alert Type
This document describes the Alert which contains data for one alert object.
Type Definitions
Alert
type Alert = {
id: string;
type: AlertType;
title?: string;
message?: string;
duration?: AlertDuration;
onClose?: (alert: Alert) => void;
};
id: Autogenerated when creating the alert.onClose: An optional callback function.
AlertType
export type AlertType = "info" | "success" | "warning" | "error";
Based on what the selected type of the alert is, it will be rendered differently:
info:infoIicon withinfocolor.success:checkicon withsuccesscolor.warning:warningTriangleicon withwarncolor.error:XMarkicon witherrorcolor.
AlertDuration
export type AlertDuration = number | "auto";
- The
numbervalue needs to be in milliseconds. - The
autovalue will calculate the duration depending on the length of themessage.