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

Feature: fine-grained collapsed control #4

Open
rotsee opened this issue May 29, 2024 · 0 comments
Open

Feature: fine-grained collapsed control #4

rotsee opened this issue May 29, 2024 · 0 comments

Comments

@rotsee
Copy link

rotsee commented May 29, 2024

Thank you for this project! Here is a feature request:

Allow collapsed to recieve a function that determines if a node should be open or not, given its depth and content.

Use case: Sometimes it is useful to hide not only nodes below a certain depth, but also those with very many children.

It would be nice to be able to do something like this: collapsed: (key, depth, content) => depth > 2 || content.length > 200

This would allow all sorts of custom behaviour:
collapsed: (key, depth, content) => key.startsWith("_")

For an example of this, see https://github.com/microlinkhq/react-json-view where shouldCollapse offers this functionality

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

1 participant