FullWidthModal Deprecated
Deprecated
Do not use it in new code. It stays documented to help migrate its remaining usages.
Do not use modals for fullscreen layouts.
Use instead:
FullPageLayoutfrommurray/web: It provides the same UI elements.
A full-width modal for a flow with more than one step. Declared with a `name` and opened through `useShowFullWidthModal`.
partially-compliant
- Overview
- Props
- Figma
Opening
Every FullWidthModal is declared with a name. To open a modal, you need to use the useShowFullWidthModal hook, which returns a function to use to open a specific modal (e.g.show('my-modal')).
Accessible name
Screen readers announce the modal by its name, so every FullWidthModal needs one:
title: the header title names the modal.aria-labelledby: the id of a heading rendered in the content, such as<FullWidthModal.Title id="…">.aria-label: a label, when no visible heading fits.
Closing
FullWidthModal can be closed by clicking on the close button or by clicking on the overlay. You can also close a modal by using the useHideFullWidthModal hook, which returns a function to use to close the opened modal (e.g.hide()).
Footer
You can add an optional footer by adding the containsFooter attribute on <FullWidthModal>, and rendering <FullWidthModal.Footer modalName="the-same-name-as-the-parent-modal"> inside the modal. There is currently no way to NOT duplicate the modal name.
With steps
If you have a multiple steps in your full-width modal, you can wrap the content of the modal inside a FullWidthModal.SideBarWrapper. It will add a sidebar on the left of the modal with the list of steps, highlighting the current step.
FullWidthModal props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-label | string | |||
| aria-labelledby | string | |||
| backButtonLabel | string | |||
| children* | ReactNode | |||
| closeButtonLabel | string | |||
| containsFooter | boolean | A modal with a footer will render differently (to leave space for the footer), so it needs to know if a footer is rendered inside. Forgetting to set this will make the scrollbar disappear under the footer when scrolling at the bottom of the content. | ||
| headerBackgroundColor | string | |||
| id | string | |||
| name* | stringRegExp | |||
| onBack | () => void | |||
| onClose | () => void | |||
| scrollOffset | number | |||
| showCloseButton | boolean | |||
| style | CSSProperties | |||
| subtitle | string | |||
| title | string | |||
| titleAlignment | "center""left" | |||
| zIndex | number |
Undocumented props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| ref | any |