Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a new Resizable compound component under src/foundations/ui/resizable/ that allows splitting a container into draggable, keyboard-adjustable panels (including horizontal/vertical orientation and nested layouts), plus documentation and example previews for the docs site.
Changes:
- Adds the
Resizable/Resizable.Panelimplementation with inferred handles, pointer + keyboard resizing, and CSS constraint-derived bounds. - Adds a full docs page describing features, API, accessibility notes, and usage guidance.
- Adds multiple preview examples (horizontal, min/max constraints, vertical, nested) for the docs site.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/foundations/ui/resizable/resizable.tsx | Implements the Resizable compound component and resize handle behavior. |
| src/foundations/ui/resizable/page.mdx | Documents the component’s API, behavior, examples, and accessibility notes. |
| src/foundations/ui/resizable/examples/resizable.preview.tsx | Adds the default horizontal preview example. |
| src/foundations/ui/resizable/examples/resizable-min-max.preview.tsx | Adds an example demonstrating min/max constraints. |
| src/foundations/ui/resizable/examples/resizable-vertical.preview.tsx | Adds a vertical orientation preview example. |
| src/foundations/ui/resizable/examples/resizable-nested.preview.tsx | Adds a nested Resizable preview example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (3)
src/foundations/ui/resizable/resizable.tsx:236
- The drag lifecycle attaches multiple
windowevent listeners but only explicitly removespointermove. If the pointer sequence is interrupted (e.g. window blur / tab switch) the body cursor anduserSelectcan remain stuck until the next drag. Using anAbortController(and listening forblur) makes cleanup deterministic and removes all listeners in one place.
const prevCursor = document.body.style.cursor;
const prevUserSelect = document.body.style.userSelect;
document.body.style.cursor = orientation === "horizontal" ? "col-resize" : "row-resize";
document.body.style.userSelect = "none";
src/foundations/ui/resizable/examples/resizable.preview.tsx:7
w-200isn’t used anywhere else in the repo and is not a default Tailwind width token, so this preview container may end up with no explicit width. Usew-full(with the existingmax-w-2xl) or an explicit arbitrary value.
<Resizable className="h-72 w-200 max-w-2xl rounded-xl border border-border">
src/foundations/ui/resizable/examples/resizable-min-max.preview.tsx:7
w-200isn’t used anywhere else in the repo and is not a default Tailwind width token, so this preview container may end up with no explicit width. Usew-full(with the existingmax-w-2xl) or an explicit arbitrary value.
<Resizable className="h-72 w-200 max-w-2xl rounded-xl border border-border">
Split Resizable.Panel's imperative onResize(size, setSize) into two single-purpose props: a pure snap(size) => number transformer that shapes the panel's size during a resize, and a read-only onResize(size) => void notification. snap runs in the drag loop after the range is measured, so it pins/collapses without constraining the range — keeping symmetric drag-collapse and drag-expand while dropping the anti-react imperative setter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Expose a ResizablePanelHandle on Resizable.Panel's ref (via useImperativeHandle) with a resize(size) method to set a panel's size programmatically from outside a drag — for presets, reset, or button-driven collapse. The adjacent panel absorbs the difference and the change is persisted. This is the additive imperative escape hatch we chose over a controlled size prop; snap/onResize are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduces a Resizable compound component that splits a container into panels separated by draggable handles.