Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add refs to underlying DOM elements in imperative API #249

Closed

Conversation

psychedelicious
Copy link
Contributor

Closes #248

No worries if this feature isn't accepted, or the implementation should be different.

Add `elementRef: RefObject<HTMLElement>` to both `ImperativePanelHandle` and `ImperativePanelGroupHandle`, giving access to the underlying DOM elements for these components.
Updates Imperative API docs.
Copy link

vercel bot commented Dec 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-resizable-panels ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 30, 2023 2:00am

@bvaughn
Copy link
Owner

bvaughn commented Dec 30, 2023

I don't think I want to approach exposing the DOM elements this way. Having multiple "ref" properties for a component– one that points to the DOM element and one that points to an imperative API– feels odd to me.

I have some utilities that I use internally for querying the underling DOM elements. I think maybe I can export those publicly though, to fit your original use case. They are here: https://github.com/bvaughn/react-resizable-panels/tree/main/packages/react-resizable-panels/src/utils/dom

Give me some time to think over this. :)

@bvaughn bvaughn closed this Dec 30, 2023
@psychedelicious
Copy link
Contributor Author

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Access underlying DOM elements via Imperative API
2 participants