re-resizable

A dependency-free React component that adds drag-to-resize handles, grid snapping, and aspect-ratio locking to any element.

Library
npm
v6.11.2
2,666 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
47 /100 Fair
Development Activity 8
Maintenance 20
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
68 /100 Good
Architecture 75
Code Quality 78
Innovation 55
Learning Curve 65

re-resizable is a React component library that wraps any child content in a resizable box, exposing eight drag handles (four edges, four corners) for freeform or constrained resizing. It ships as a single dependency-free package — no runtime dependencies beyond React itself — and supports both controlled (size) and uncontrolled (defaultSize) usage, matching how the rest of a typical React app already manages state.

Beyond basic drag-resize, it handles the edge cases teams tend to hand-roll themselves: aspect-ratio locking (with extra width/height for adjacent sidebars or headers), grid and snap-point resizing, resize boundaries scoped to the window, the parent, or an arbitrary element, and correct behavior inside CSS-scaled ancestors via a scale prop. An imperative updateSize instance method lets consumers resize programmatically outside the normal props flow.

What You Get

  • Eight-direction resize handles (edges + corners) with per-direction enable/disable control
  • Controlled and uncontrolled size APIs (size vs defaultSize) with resize start/move/stop callbacks
  • Grid, snap-point, and aspect-ratio-lock resize constraints, including bounds scoped to window, parent, or element
  • Zero runtime dependencies and a small footprint, shipped as both ES5 and ESM builds
  • Full TypeScript types and an imperative updateSize API for programmatic resizing

Common Use Cases

  • Resizable side panels and dashboard widgets
  • User-resizable image/video/media containers that preserve aspect ratio
  • Split-pane / IDE-style layouts with draggable dividers
  • Resizable text areas, chat boxes, or embeds with min/max size constraints

Under The Hood

Architecture

The library centers on a single Resizable class component (src/index.tsx, extending PureComponent) that owns all resize state — original pointer position, original size, active direction, and an isResizing flag — and delegates the eight visual drag handles to a small memoized Resizer function component (src/resizer.tsx) that just wires onMouseDown/onTouchStart per direction. Rather than relying on React’s synthetic events for drag tracking, Resizable attaches mousemove/mouseup/touchmove/touchend listeners directly to window in componentDidMount, and mutates the wrapper’s DOM style imperatively via a ref during drag (wrapping updates in flushSync from react-dom to force synchronous, tear-free commits mid-drag). This keeps resize math — grid/snap clamping, aspect-ratio locking, boundary calculation — concentrated in a handful of instance methods (calculateNewMax, calculateNewMaxFromBoundary), which is easy to reason about but means the freeform, grid-snapped, aspect-locked, and bounded resize modes all share the same code path, so a change to the core clamping logic risks affecting all of them at once.

Tech Stack

Written in strict TypeScript with React as the only peer dependency (supporting 16.13 through 19), and zero runtime dependencies otherwise. Built with Rollup (rollup-plugin-typescript2, Babel plugins) into parallel ES5 and ESM (lib/index.es5.js, lib/index.js) bundles, distributed via files: ["lib"]. Package management and CI use pnpm; Storybook powers the live demo, deployed to GitHub Pages via gh-pages.

Code Quality

The project has a substantial Playwright component-test suite (src/index.spec.tsx, using @playwright/experimental-ct-react and sinon for spies) covering sizing modes, relative units (vw/vh/vmin/vmax), and callback behavior. tsconfig.json runs in strict mode, and CI (GitHub Actions) runs three separate jobs — lint, tsc, and test — on every push and PR. Linting still uses legacy tslint rather than eslint, which is dated but functional and paired with Prettier for formatting.

What Makes It Unique

Resizable wrapper components are a well-trodden pattern (react-rnd, interact.js, and similar libraries all solve the same problem), so the core idea isn’t novel. What distinguishes this implementation is its attention to detail: zero runtime dependencies, careful handling of relative units (percentages, vw/vh/vmin/vmax) for both size and min/max constraints rather than pixels only, a scale prop that corrects resize math when nested inside a CSS-transformed ancestor, and lockAspectRatioExtraWidth/Height for keeping media aspect-locked alongside a fixed-size sidebar or header — the kind of edge cases most hand-rolled resize implementations miss.

Used by 18 apps in this directory

TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,055

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
68
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 2 months ago
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
85%
GPL 3.0

Notesnook

File Storage · Note Taking · Security

14,822

End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.

View details
91
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 85%
JavaScript 12%
Updated 5 days ago
TypeScript
26%
AGPL 3.0

Omnivore

Bookmarks Archiving · Knowledge Management · Note Taking

16,356

Self-hosted read-it-later platform with highlights, newsletters, PDFs, and seamless Obsidian and Logseq integration.

View details
90
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 26%
JavaScript 24%
HTML 20%
Updated 6 days ago
TypeScript
97%
AGPL 3.0

Responsively App

Design Tools · Developer Tools

25,464

Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.

View details
79
Repo Health
71
Technical
66
Dependency
Built with
TypeScript 97%
Updated 3 weeks ago
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,304

The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.

View details
96
Repo Health
79
Technical
63
Dependency
Built with
TypeScript 97%
Updated 5 days ago
Python
79%
AGPL 3.0

Skyvern

AI Agents · Automation

23,257

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
70
Dependency
Built with
Python 79%
TypeScript 19%
Updated 5 days ago
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,920

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
78
Repo Health
76
Technical
62
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
72%
AGPL 3.0

Worklenz

Collaboration · Product Management · Project Management

3,259

All-in-one open source project management for teams who want full control — plan projects, track tasks, manage resources, and monitor finances without the SaaS lock-in.

View details
87
Repo Health
7
Technical
64
Dependency
Built with
TypeScript 72%
JavaScript 21%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers