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
Actual
Invoicing Finance
Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Coder
Devops · Developer Tools · Code Editors
Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.
CodeSandbox
Code Editors · Developer Tools
Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.
Convex Backend
Developer Tools · Databases
Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.
Dub
Marketing · Analytics
The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.
Grafana
Monitoring · Analytics
The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.
highlight.io
Developer Tools · Analytics · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.
GraphQL Hive
Developer Tools · Devops · Monitoring
Open-source GraphQL schema registry and observability platform with breaking change detection, federation support, and CI/CD integration for teams of any size.