react-virtualized-auto-sizer
Measures a container's available width/height and passes it to a child component
Repository Health
Technical Analysis
react-virtualized-auto-sizer measures the available width and height of its parent HTMLElement and passes those dimensions as props to a child render function or component. It began as the AutoSizer component extracted from the original react-virtualized library and was made standalone for use with react-window, giving virtualization libraries — and any component that needs to fill and react to its container’s dimensions — a reliable, dependency-free way to know how much space is available.
The library exposes both a classic render-prop <AutoSizer> component and a useSize hook for measuring an element imperatively, built on native ResizeObserver under the hood. The maintainer notes that newer versions of react-window use ResizeObserver directly and no longer need this package, but it remains widely used by other virtualization and layout code that hasn’t made that jump.
What You Get
- An
<AutoSizer>render-prop component that reports{width, height}of its parent container - A
useSizehook for measuring an element’s dimensions directly in function components - Options to disable width or height measurement independently (
disableWidth/disableHeight) - A
defaultWidth/defaultHeightfallback for consistent server-side rendering output - Built on native
ResizeObserverrather than polling or window-resize listeners
Common Use Cases
- Sizing a
react-windoworreact-virtualizedlist/grid to exactly fill its parent container - Making any fixed-size chart, canvas, or map component responsive to its flex/grid container
- Building resizable dashboard panels where child content needs to know the panel’s current pixel dimensions
- Measuring a container for responsive layout decisions without hardcoding breakpoints
Under The Hood
Architecture The published package’s core lives in lib/components/AutoSizer.tsx (71 lines), a thin component that renders a full-size wrapper div and delegates the actual measuring logic to the useSize hook in lib/hooks/useSize.ts (153 lines), which sets up a ResizeObserver on the wrapper element and returns its current {width, height} reactively; lib/vendor/detectElementResize.js retains a legacy resize-detection fallback vendored from the original react-virtualized implementation for environments without ResizeObserver. The repository is a monorepo-shaped workspace where lib/ is the actual publishable library and src/, index.tsx, and vite.config.ts build the project’s documentation/demo site (deployed to Vercel) — the demo site is not part of the npm package. Tech Stack TypeScript throughout, built with Vite/pnpm workspaces, using native browser ResizeObserver as the sole measurement mechanism with no runtime dependencies beyond React itself as a peer dependency. Code Quality lib/components/AutoSizer.test.tsx and a lib/utils/test directory cover the core measuring behavior, tested via Vitest (vitest.config.ts, vitest.setup.ts); the project maintains a documented FAQ and example site alongside the code, and CHANGELOG.md tracks releases carefully given the library’s role as infrastructure for other virtualization packages. API Design The API is intentionally minimal — a single <AutoSizer> component taking a render-prop child plus a handful of boolean/number options, and an equivalent useSize hook for hook-based code — making integration a one-line wrap around existing virtualized-list code with almost no configuration required.
Used by 16 apps in this directory
Jitsi Meet
Collaboration · Team Chat · Video Conferencing
Open-source, end-to-end encrypted video conferencing you can self-host or embed into any web or mobile app.
Label Studio
AI Development · Data Engineering
Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.
Mattermost
Collaboration · Devops · Team Chat
Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.
OpenPanel
Analytics
Open-source Mixpanel alternative with session replay, MCP integration, and privacy-first product analytics you fully control.
Outline
Collaboration · Knowledge Management
A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
PostHog
Ab Testing Experimentation · Analytics · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.