Skip to content

Resize observer

The resize observer allows to react on element's size changes triggered by user interaction.

Usage

When to use

  • Adapt an element's layout based on its own size, not just the viewport. For example, changing styles for a specific sidebar when its container is resized.
  • When model changes are required or an adjustment via javascript is necessary.

When not to use

Prefer a pure CSS solution e.g.:

  • Viewport-based responsiveness CSS media queries provide a powerful alternative and the element CSS utils allow to apply different behaviors based on breakpoints.
  • Container-based responsiveness CSS container queries provide powerful alternative to build responsive layouts.

Except where otherwise noted, content on this site is licensed under MIT License.