Skip to content

Feature: fine-grained collapsed control #4

@rotsee

Description

@rotsee

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions