<cs-resize-observer>
StableHelpersSince 0.1

Resize observers watch their slotted elements for size changes and emit an event when they occur. Provides a thin, declarative interface to the browser's ResizeObserver API.

0 × 0
Drag the box's bottom-right corner to resize it.

The resize observer will report changes to the dimensions of the elements it wraps through the cs-resize event. When emitted, event.detail.entries holds a collection of ResizeObserverEntry objects describing the observed elements and their new dimensions.

API

Importing

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick this component, use one of the following snippets.

npm Self-Hosted React
import '@cruglobal/cornerstone-components/components/resize-observer/resize-observer.js';
import './cornerstone/components/resize-observer/resize-observer.js';
import CsResizeObserver from '@cruglobal/cornerstone-components/react/resize-observer/index.js';

Slots

Learn more about using slots.

NameDescription
(default)One or more elements to watch for resizing.

Attributes & Properties

Learn more about attributes and properties.

PropertyAttributeDescriptionTypeDefaultReflects
disableddisabledDisables the observer.booleanfalseYes

Events

Learn more about events.

NameDescription
cs-resizeEmitted when the element is resized.