useOverlayStacking
To stack overlays correctly on top of each other, use the useOverlayStacking
hook. The hook returns the styles you need to ensure a correct stacking order.
Applying the returned styles to the container, its position will be fixed.
Import
import { useOverlayStacking } from '@dynatrace/strato-components-preview/core';
Use cases
Nest overlays
Use the OverlayStackingProvider
to nest overlays. The provider is increasing
the nesting level whenever a new overlay is opened. Doing this, nested overlays
will be rendered on top of the parent overlay again.
Offset overlays
As the first argument, you can pass an offset to the hook that will be used as the top offset in the returned styles, allowing you to adjust the containers position.
Still have questions?
Find answers in the Dynatrace Community