Modal
Overview
Modals sit on top of the page, containing additional content or functionality without leaving the context of a page.
When to use:
- To focus on a particular on an specific task or content.
- To confirm high impact actions (e.g. deleting a configuration).
Implementation
A Modal appears as a layer on top of the primary interface. Modals disrupt users from interacting with the page until they complete a specific task.
Edit the code below to see your changes live!
Props
Prop name | Type | Default | Description |
|---|---|---|---|
actions | object[] | | Accepts an array of objects with Button props and an additional |
backdrop | boolean | true | Determines if the backdrop is shown. |
closeOnClickOutside | boolean | false | Controls whether |
closeOnEscKey | boolean | true | Controls whether |
header | string | | Sets visible text that describes the content of the modal. |
isOpen | boolean | false | Determines if the modal/dialog is open. |
onClose | () => void | | Function that will be called on close events. |
variant | modal | dialog | modal | Determines the modal variant. |
Props ending with * are required
Do's and Don'ts
Do |
|---|
Modals should require that users take an action. |
Modals should close when users press an action button, not when merchants click or tap the area outside the Modal. |
It should be clear why the Modal was opened. |
Modals should block other content on a page. |
User should have the option to come back without any actions. |
Header and content should be left aligned, footer right aligned. |
Modals should be positioned in the middle of the screen. |
Don't |
|---|
Modals shouldn’t have more than two buttons (primary and secondary) at the bottom. |