Overlay
Overlay provides component developers a way to position elements globally or relative to a anchor element. The overlay wraps the backdrop, position, exit listener and portal to provide a simple API for handling position.
There are five overlay components in the Overlay:
ConnectedOverlay- A overlay that is relative to a anchoring element.GlobalOverlay- A overlay that is placed on top of other elements globally.OverlayPortal- A wrapper around the portal component to manage z-indexs.OverlayTrigger- The internal trigger component that theConnectedOverlayuses.
Examples
Global Overlay
A overlay component typically used by components like Dialogs or Drawers. You can use the Global Ovleray using element APIs.
Use the css variable --color-layer-transparent to set the backdrop color.
// index.css
body {
--color-layer-transparent: rgba(0, 0, 0, 0.5);
}Dialog Example
Below is an example of a simple dialog component using the global overlay.
Connected Overlay
A overlay component typically used by components like menus.
Tooltip Example
Below is an example of simple tooltip component using the connected overlay.
Menu Example
Below is an example of simple menu component using the connected overlay.
API
GlobalOverlay
ConnectedOverlay
OverlayTrigger
OverlayPortal
Last updated on