Components/Overlays/Modal
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/modalpreviewlayout
Modal preview layout displays files, such as images, videos or PDFs, inside a <Modal/> overlay. Its header strip holds a title, actions and a close button, and previous and next buttons let users move between several items.
<CustomModalLayout/> instead.<MessageModalLayout/> instead.An example for preview layout modal with title, actions and content that takes the full width
An example for preview layout modal with title, actions and content that overflows the height
An example for preview layout modal with title, actions and multiple content
An example for preview layout modal with light skin
| Name | Type | Default | Description |
|---|---|---|---|
actions | ReactNode | — | Accepts any content to render in the header strip, such as actions relevant to the displayed content. |
children (required) | ReactNode | — | Accepts the content to display in the middle of the screen. When multiple children are passed, one is shown at a time with previous and next buttons to navigate between them. |
closeButtonAriaLabel | string | — | ARIA label for close button. |
closeButtonTooltipText | string | — | Tooltip close button text. |
dataHook | string | — | Applied as data-hook HTML attribute that can be used in the tests. |
nextButtonProps | NextButtonProps | — | Next button props ##### onClick signature: function(childIndexDisplayed: number) => void * childIndexDisplayed: the index of the child component displayed. |
onClose (required) | () => void | — | Defines a callback function which is called when the close button is clicked, or when the overlay is clicked and shouldCloseOnOverlayClick is true. |
prevButtonProps | PrevButtonProps | — | Previous button props ##### onClick signature: function(childIndexDisplayed: number) => void * childIndexDisplayed: the index of the child component displayed. |
shouldCloseOnOverlayClick | boolean | true | Specifies whether clicking the overlay calls onClose. |
skin | "light" | "dark" | 'dark' | Controls the skin of the component. |
startDisplayingAtChildIndex | number | 0 | Pass an index to start rendering from a specific child component. |
title | string | — | Sets the title text displayed in the header strip. Long titles are truncated with an ellipsis. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
clickOverlay | Click the overlay |
getPreviewTitle | Get the title node |
getPreviewActions | Get the actions node |
getPreviewContent | Get the content node |
clickClose | Click the close button |
getCurrentChildIndex | Get the index of the rendered child |
getSkin | Get skin |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 22 October 2026