Overlay
Overlay reveals supplementary content after the user clicks a UI trigger element. It remains active and open until dismissed by the user. It can contain interactive and focusable elements, such as buttons or links.
| Salt package | @salt-ds/core |
|---|---|
| Available since | 1.24.0 |
The Overlay component allows the user to expose and interact with supplemental information. The overlay remains persistent until the user dismisses it.
Use the placement prop to position overlay content relative to the trigger. The default placement is top.
Use OverlayHeader, OverlayPanelContent and OverlayFooter to create distinct padded sections within OverlayPanel. Sections need to be direct children of OverlayPanel for their spacing rules to apply. When OverlayPanel has a constrained height, OverlayHeader and OverlayFooter stay in place while OverlayPanelContent scrolls.
OverlayHeader follows the Header Block pattern. Pass the title to header, and add preheader or description when needed.
When content in OverlayPanelContent exceeds the height available to OverlayPanel, it scrolls while the header stays in place.
With actions, users can decide if interacting with content in the overlay should close the overlay. This example shows how activating the Export button triggers the export function, closes the overlay, and returns focus to the trigger element.
Pass a close button to the actions prop of OverlayHeader to keep the control aligned with the title and visible when the overlay content scrolls.
Use the hideArrow prop to display the overlay without the arrow.