Alert Type
This document describes the Alert which contains data for one alert object.
Type Definitions
Alert
type Alert = {
id: string;
type: AlertType;
display?: AlertDisplay;
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.
AlertDisplay
export type AlertDisplay = "default" | "prominent";
default: A small alert in the corner of the screen (from thealertsPluginpositionandalign).prominent: A modal in the center of the screen with aClosebutton. It does not close automatically. Useful for errors that the user should not miss.
The default value per alert type can be set with the defaultDisplay option of the alertsPlugin.