Coming from Orbiter, you should be aware of the following changes:
dismissable
has been renamedisDismissable
.wrapperProps
has been renamedoverlayProps
.onClose
has been removed.
An Alert is a “conversation” between the system and the user. It is prompted when the system needs input from the user or to give the user urgent information concerning their current workflow.
Alerts work best when used for short tasks or to warn the user to task relevant information. Alerts are useful in many scenarios; they are less disorientating than navigating a user to a new page for simple tasks or knowledge gathering. However, Alerts are disruptive and can be distracting to the user. Use them sparingly.
<Alert> <Heading /> /* (Required) The heading of the Alert */ <Content /> /* (Required) The content of the Alert */ </Alert>
A Alert
uses the following components:
An alert must have a heading, some content and a primary button label.
An alert can have a secondary button.
An alert can have a cancel button.
An alert primary and secondary buttons can be disabled.
Use a confirmation alert when a non-destructive action is required from a user.
Use a destructive alert to confirm a permanent change, like deleting data.
An alert can be undismissable.
The open state can be handled in controlled mode.
An alert can show a pending state. This is useful when you want to show that an action is in progress.
A Alert can be small or medium. The default size is medium.
A Alert can have different size in mobile and desktop view.
Don't overuse alerts. They are disruptive and can easily annoy the user if used incorrectly or too frequently. When alerts are used for non-workflow related tasks, it is likely a user will start ignoring or dismissing the alert without fully understanding the content. This can cause users to make hurried or impulsive choices when dealing with more critical alerts.
A user action, such as clicking a button, should trigger the alert to open. Don't interrupt the user by opening an alert when they aren't expecting it. Avoid system generated pop-ups that distract the user while working. Triggers can either be a direct or indirect consequence of a user's action. An example of an indirect action is a user closing a tab with unsaved content that then causes an alert to ask if they want to save their changes before closing. If the system is autogenerating an alert that is not a consequence of a user's action, but a response to processes happening in the background, then a toast notification should be used instead.
Alert tasks should be direct and easy to complete. Avoid feature creep in alerts where a once simple alert has become bloated with interactions. When deciding to use an alert consider how the task could expand in the future and if an alert will be able to effectively incorporate additions.
The button to focus by default when the alert open.
The cancel button label.
Whether or not the dialog should close on outside interactions.
Whether or not the primary button is disabled.
The primary button label.
Whether or not the secondary button is disabled.
The secondary button label.
The visual style of the Alert.
The size of the Alert.
Additional props to render on the wrapper element.
Whether or not the Alert is loading.
The inline style for the element.
Children of the dialog. A function may be provided to access a function to close the dialog.
The CSS className for the element.
Called when the cancel button is clicked
Called when the primary button is clicked.
Called when the secondary button is clicked.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null
value indicates that the local props completely override all props received from a parent.
The accessibility role for the dialog.
The element's unique identifier. See MDN.
Defines a string value that labels the current element.
Identifies the element (or elements) that labels the current element.
Identifies the element (or elements) that describes the object.
Identifies the element (or elements) that provide a detailed, extended description for the object.
Whether the overlay is open by default (controlled).
Whether the overlay is open by default (uncontrolled).
Handler that is called when the overlay's open state changes.
Coming from Orbiter, you should be aware of the following changes:
dismissable
has been renamed isDismissable
.wrapperProps
has been renamed overlayProps
.onClose
has been removed.