BETA

Tabular Modal Page

Description

Tabular Modal pages are controlled components used to render a page with custom navigational controls and content, for instance, with Tabs. Similar to InfoModalPage, but with no header and a gray top bar.

Usage

import { TabularModalPage } from '@commercetools-frontend/application-components';
<TabularModalPage
title="Lorem ipsum"
isOpen={true}
onClose={handleClose}
topBarCurrentPathLabel="Lorem ipsum"
topBarPreviousPathLabel="Back"
>
<ViewHeader {...viewHeaderProps} />
<TabsContainer {...tabsContainerProps} />
</TabularModalPage>;

Properties

PropsTypeRequiredDefaultDescription
isOpenboolean-Indicates whether the page is open or closed. The parent component needs to manage this state.
titlestring-The title of the page.
subtitlenode or string--The subtitle of the page, usually a React component. If a string is passed, it's rendered as a paragraph.
onClosefunction--Called when the page closes: click on overlay, click on close button, press ESC. If the function is not provided, the page cannot be closed by any of the listed options.
levelnumber1The level indicates the stack position of the modal page, progressively increasing the z-index position (combined with the baseZIndex) as well as the spacing from the left side of the page.
baseZIndexnumber1000The base z-index value to be applied to the overlay container, incremented by 1 according to the level prop.
zIndexnumber-The z-index value to be applied to the overlay container. This value overrides the normal z-index value calculated from the baseZIndex and level props. If you provide this value, you would need to take care of providing a proper z-index based on the stacked level.
topBarCurrentPathLabelstringThe title propLabel to appear as the current path of the top bar of the modal.
topBarPreviousPathLabelstring"Go Back" (translated)Label to appear as the previous path of the top bar of the modal.
childrennode-Content rendered within the page. It isn't wrapped by anything except the Modal Container itself, so its expected to have its style fully customized.
formControlsnode--Pass a React.node with form controls. You can use the pre-made form buttons exposed by this component or you can use your own.
customTitleRownode--Pass a React.node to be used in place of the title and subtitle.
tabControlsnode-Pass a React.node to be used as the Tabs component for controlling the navigation between the Tab contents within the modal.
getParentSelectorfunction--The function should return an HTML element that will be used as the parent container to hold the modal DOM tree. If no function is provided, it's expected that an HTML element with the id="parent-container" is present in the DOM. In the NODE_ENV=test environment, the default HTML element is body.
shouldDelayOnClosebool-trueSets whether the ModalPage should delay calling its onClose function to allow the closing animation time to finish. This can be turned off if the developer is controlling the ModalPage only through the isOpen prop, and not abruptly mounting/unmounting it or one of its parent elements. You might also want to turn this off if you need to display a Prompt (for example to save changes) on the ModalPage before navigating out of it, as this option makes the Modal close itself before onClose is called.

Static properties

Form Control Buttons

Pre-configured form control buttons to easily re-use them in the custom controls.

TabularModalPage.FormPrimaryButton = FormPrimaryButton;
TabularModalPage.FormSecondaryButton = FormSecondaryButton;
TabularModalPage.FormDeleteButton = FormDeleteButton;

TabularModalPage.Intl

This is a convenience proxy export to expose pre-defined Intl messages defined in the @commercetools-frontend/i18n package. The Intl messages can be used for button labels.

<TabularModalPage
// other props...
formControls={
<TabularModalPage.FormSecondaryButton
// other props...
label={TabularModalPage.Intl.revert}
/>
}
/>