GithubHelp home page GithubHelp logo

schluca / streamlit_tree_select Goto Github PK

View Code? Open in Web Editor NEW
64.0 64.0 7.0 1.91 MB

A simple and elegant checkbox tree for Streamlit.

License: MIT License

Python 41.53% HTML 6.47% CSS 31.40% TypeScript 20.60%
streamlit-component tree-selection

streamlit_tree_select's People

Contributors

bluegob avatar schluca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

streamlit_tree_select's Issues

reset tree

how can I deselect my selection? reset the tree?

Developer/Contributor docs

Great work. Thanks.

I want to extend tree select. Can you describe how developer set up, and some guidelines what you expect from PR.

Thanks again.

tree_select checked property doesn't select the listed nodes

Hi,

The tree_select checked property doesn't cause the listed nodes to be visibly selected in the tree, nor expand the branches they are in (depending on the expand_on_click setting).

Would it be possible to provide the checked nodes list in the form they would have been defined, i.e. as dict objects? It seems they need to be converted to strings, so I need to do something like checked=[json.dumps(node1), json.dumps(node2), ...] instead of simply checked=[node1, node2]. I get the pre-checked nodes back as values but as stated above the tree nodes don't visibly show as checked.

Thanks,
Arvindra

Change the style of label

How can I change the label style (for example: bold, color...) of nodes?

I want something like this:
{
"value": f'table_name',
"label": f"Table table_name, keys: table_keys",
}

Streamlit Dark mode accessibility issue

image

Repo steps:

set .streamlit config.toml:

[theme]
base = 'dark'

Use default example for tree_select.

# Create nodes to display
nodes = [
    {"label": "Folder A", "value": "folder_a"},
    {
        "label": "Folder B",
        "value": "folder_b",
        "children": [
            {"label": "Sub-folder A", "value": "sub_a"},
            {"label": "Sub-folder B", "value": "sub_b"},
            {"label": "Sub-folder C", "value": "sub_c"},
        ],
    },
    {
        "label": "Folder C",
        "value": "folder_c",
        "children": [
            {"label": "Sub-folder D", "value": "sub_d"},
            {
                "label": "Sub-folder E",
                "value": "sub_e",
                "children": [
                    {"label": "Sub-sub-folder A", "value": "sub_sub_a"},
                    {"label": "Sub-sub-folder B", "value": "sub_sub_b"},
                ],
            },
            {"label": "Sub-folder F", "value": "sub_f"},
        ],
    },
]

return_select = tree_select(nodes)
st.write(return_select['checked'])

At least in this case, text should be white or to "follow streamlit theme"

Is there a way to populate children of a node only when said node is expanded

I'd like to start off by saying I really like this feature.

One scenario I have is the structure I want to represent with this tree can only be built up via recursive calls across a network. This is very long winded particularly since I may not need all of the nodes being retrieved. One way I would like to do it is by attaching a delegate to an attribute. Ideally this could be something I could cache so further collapse and expand interactions of the same node do not need to go back to the network.

Is something like this possible or feasible?

Keeping the expanded state of the tree!

Hello,

I want to keep the current state, of expansion of the tree even when some action is done. I tried with the following code, but it turns out that expansion needs to be done twice.

if "current_expanded_folder" not in st.session_state:
    st.session_state.current_expanded_folder = []
    
checked_value = tree_select(
                    nodes,
                    expanded= st.session_state.current_expanded_folder,
                )
st.session_state.current_expanded_folder = checked_value["expanded"]

streamlit tree

Any clues would be appreciated! Thank you!

Feature request: Preselected nodes

Currently, there is only the property 'checked' in which you can insert a list.
The problem with selecting all items like that is on the user interface the items appear as unchecked -> What I need is a property where I can select which checkboxes should appear as checked + add them to the checked list -> the user sees which of the items are preselected.

Enforce maximum number of checked nodes?

Is it possible to enforce a maximum number of checked nodes?

My tree shows different text versions, and the user should be allowed to only two nodes, for which a diff will be displayed. If they try to select a third node, it should be possible to display an error message.

Show tree_select in st.sidebar?

How can I display the tree in a sidebar? It would be great if the following worked:

st.sidebar.title("Sidebar with tree")
st.sidebar.tree_select(nodes)

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.