Skip to content

Local Modal

<tpg-local-modal></tpg-local-modal>

Local Modals are task-oriented workflows containing the steps the user must take to accomplish a task.

Local Modals are disruptive. Only use them when you need the user’s full attention for the action they are trying to accomplish.

They usually appear aligned to the center of the Workflow Panel over a “Background Overlay”. When Local Modals, are summoned by a Footer action, they can also appear aligned with the bottom of the Workflow Panel (its Footer).

Their footer follows the rules of the Footer component.

Examples

Basic

Positioned relative to nearest parent

The modals positioning attribute is used to set the modals positioning. The positioning attribute can be set to local or global. The default value is global.

In local mode, the modal will be positioned relative to the nearest parent element with positioning set to relative. In global mode, the modal will be positioned relative to the viewport.

Tables

Properties

Attribute Property Description Type Default Value
is-open isOpen Whether or not the modal is open. Note: its recommended to open and close the modal through js methods showModal() and close(); boolean false
prevent-close-on-click-outside preventCloseOnClickOutside Prevents the modal from closing when clicking outside. boolean false
positioning positioning Determines the positioning of the modal: "global" for centering on the screen, "local" for centering within a parent container. 'global' | 'local' 'global'
allow-scroll allowScroll If the modal should prevent scrolling of the background when open. boolean false

Events

Event name Reactjs attribute Description

Functions

Name Description Arguments
scrollDown Scrolls down the content by scrollAmount
  • scrollAmount: ??? = 50
scrollUp Scrolls up the content by scrollAmount
  • scrollAmount: ??? = 50
canScroll Check if fit is possible to scroll No parameters
showModal Opens the dialog - for consumers. No parameters
hideModal Closes the dialog - for consumers. No parameters

Slots

Name Description
header Slot reserved for a tpg-modal-header.
footer Slot reserved for tpg-footer
reserved for the content of the local modal.

CSS Parts

Attribute Description
No CSS parts found.

Sandbox