ResizeObserver Playground - Interactive Lab | IconVault

Drag-resize elements and watch contentRect, borderBoxSize and device pixels update live. Free, runs fully in your browser.

All tools

ResizeObserver Playground

Drag-resize elements and see box sizes live

5 of 5 free uses left
Observed box modelSwitching re-observes with the new box option.

Drag the corner to resize

Every size change fires the observer callback.

Resizable box

ResizeObserver reports this element live.

No-drag demo: growing text

ResizeObserver watches this card grow as the text gets longer.

Live box sizes

Waiting for the first callback...

devicePixelContentBoxSize is what canvas renderers use to size backing stores at the right resolution; it needs no manual devicePixelRatio math.

Callback log

Resize the box.

Copy-ready code

const box = document.querySelector("#resizable");

const ro = new ResizeObserver((entries) => {
  for (const entry of entries) {
    console.log("contentRect:", entry.contentRect.width, entry.contentRect.height);
    console.log("borderBoxSize:", entry.borderBoxSize[0].inlineSize, "x", entry.borderBoxSize[0].blockSize);
    if (entry.devicePixelContentBoxSize[0])
      console.log("device pixels:", entry.devicePixelContentBoxSize[0].inlineSize);
  }
});

// "content-box" | "border-box" | "device-pixel-content-box"
ro.observe(box, { box: "content-box" });

// Later: ro.unobserve(box); ro.disconnect();

5 of 5 free copies left.

About this tool

IconVault's ResizeObserver Playground makes element observation tangible: drag a box by its corner and watch contentRect, borderBoxSize and devicePixelContentBoxSize update live, switch the observed box model, and read every callback in the timestamped log. It is free to use and runs fully in your browser with nothing uploaded.

How to use: drag the resize handle, toggle between content-box, border-box and device-pixel-content-box, and try the no-drag growing-text demo. Perfect for developers building responsive components, canvas renderers and container-aware layouts.

Frequently asked questions

Popular searches

resizeobserverresize observer examplejavascript resize observerresizeobserver tutorialobserve element resizeresizeobserver box optionscontent-box vs border-boxborderboxsizecontentrectdevicepixelcontentboxsizeresizeobserver callbackdetect div resize jselement resize listenerresizeobserver vs window resizeresizeobserver reactresizeobserver typescriptresizeobserver disconnectresizeobserver unobserveresizeobserver loop errorresizeobserver loop completedfix resizeobserver loopresponsive element queriescontainer queries vs resizeobserverresizeobserver canvascanvas resize observerresizeobserver debounceobserve multiple elementsresizeobserver entrieslearn resizeobserverweb api resizeobserverresizeobserver browser supportresizeobserver polyfillelement size change jsget element size javascriptoffsetwidth vs clientwidthdevice pixel ratio canvascrisp canvas resizeresizeobserver mdnresizeobserver example codefrontend resize detectionjavascript layout observerresizeobserver performanceobserve iframe resizeresizeobserver text changeauto resize detectionjs resize playgroundresizeobserver labdom size observerelement resize demoresizeobserver guide

More tools

Coming soon

CLI

Coming soon

Figma plugin

Coming soon

VS Code extension

Coming soon

Chrome extension

Coming soon

AI icon generator

Coming soon

Team workspaces

Coming soon

View all 10+ tools →