Skip to content

Information request: Is variable row height a possibility? #276

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

Open
janvandenberg opened this issue Oct 6, 2024 · 5 comments
Open

Information request: Is variable row height a possibility? #276

janvandenberg opened this issue Oct 6, 2024 · 5 comments
Milestone

Comments

@janvandenberg
Copy link

First of all, I want to express my sincere gratitude to all the contributors of react-arborist. This library is truly awesome and it looks like it can be incredibly helpful in my project.

I'm wondering if there's a way to create variable row heights in react-arborist. My node leaves are sometimes bigger than the allotted height. Right now I can only cut off my text, but I was wondering if there is another way? I've attempted to implement this using a row renderer, but I haven't been successful so far. Since the absolute positioning of the siblings don't take my custom height into consideration.

@CHE1RON
Copy link

CHE1RON commented Oct 8, 2024

That would be a great thing to have! 👍

@gpalomar
Copy link

Is there a planned date for this functionality? I really need it in my project 😃

@jameskerr
Copy link
Contributor

If you are asking for a dynamic height that adjusts based on the contents of the node, that is not a goal for this project. But if you want to provide the height of each node statically, we could do that. The goal with this project was to virtualize the rows so that you can have many items in the tree. Virtualization is fast because we can do math to calculate where a row should be positioned.

I use react-window for the virtualization and they do have an option for mixed-height rows. You can see what I mean over at their docs

https://react-window.vercel.app/#/examples/list/variable-size

One day, we could use that instead of FixedSizeList. Not high on the priority list though.

@CHE1RON
Copy link

CHE1RON commented Dec 4, 2024

What about #238, at least in the interim? Right now, our team maintains a private fork of react-arborist, applying some of the existing PRs, and so far it works great 🤔

@jameskerr jameskerr added this to the Version 4 milestone Feb 6, 2025
@SnakeAmadeus
Copy link

SnakeAmadeus commented Mar 20, 2025

I just played around with statically declared variable height rows in my project. Visually, it worked pretty well with a custom row renderer using RowRendererProps. However, I found it broke the DnD functionality because the positions of drop cursors are based on the tree.visibleNodes.length * tree.rowHeight defined in DropContainer. This mechanism is built upon the assumption that every visible row in the view is fixed-sized. So for anyone who wants a temporary solution without the DnD support, it is possible by defining your own RowRendererProps.

Image

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

No branches or pull requests

5 participants