Add outerElementType/innerElementType props to Tree#339
Merged
TrevorBurnham merged 1 commit intoMay 17, 2026
Merged
Conversation
Lets consumers supply custom react-window outer/inner wrappers without forking the whole DefaultContainer. The defaults (ListOuterElement, ListInnerElement) are now also exported, along with DropContainer, so a custom outer can compose the existing drop-target behavior. Cherry-picked from the title feature of jameskerr#318.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds opt-in customization points to Tree so consumers can supply custom react-window outer/inner wrapper components via props, while preserving current defaults when not provided. Also exposes the default list wrapper components publicly so custom wrappers can reuse existing behavior (e.g., drop-target overlay).
Changes:
- Extend
TreePropswithouterElementTypeandinnerElementTypetyped fromreact-window. - Pass the new props through to
FixedSizeList, defaulting to existingListOuterElement/ListInnerElement. - Export
DropContainer,ListOuterElement, andListInnerElementfrom the package public API.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/react-arborist/src/types/tree-props.ts | Adds outerElementType/innerElementType to TreeProps for react-window wrapper customization. |
| modules/react-arborist/src/components/default-container.tsx | Wires the new props into FixedSizeList with nullish-coalescing fallbacks to current defaults. |
| modules/react-arborist/src/components/list-outer-element.tsx | Exports DropContainer so custom outer wrappers can reuse the existing overlay behavior. |
| modules/react-arborist/src/index.ts | Re-exports the default list wrapper components as part of the public API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets consumers supply custom react-window outer/inner wrappers via props, without having to fork
DefaultContainer. Also exports the defaultListOuterElement,ListInnerElement, andDropContainerso a custom outer element can reuse the existing drop-target behavior.When the new props aren't supplied, behavior is unchanged.
This is the title feature cherry-picked out of #318. That PR also bundled a new padding model, a
scrollTorewrite, auseDndManagerhook, and fork-publishing chores — each worth discussing separately, but none belong here. The author hasn't responded since 2025-10 and is shipping their own published fork, so I'm porting just the cleanly-scoped piece.Closes #318 in spirit (credit to @jorgedanisc for the original).
Test plan
yarn testpasses inmodules/react-arboristyarn buildsucceedsouterElementTypethat composes<DropContainer />+{children}works