schluca / streamlit_tree_select Goto Github PK
View Code? Open in Web Editor NEWA simple and elegant checkbox tree for Streamlit.
License: MIT License
A simple and elegant checkbox tree for Streamlit.
License: MIT License
how can I deselect my selection? reset the tree?
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.
First,Thank you for your contributions. when I use the componment , my tree nodes have some same value ,then an error occur:
Component Error Duplicate value 'homepage' detected. All node values must be unique.
how to fix it? I would greatly appreciate anyone proposing a solution
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
Hi,
I documented feature requests here: https://discuss.streamlit.io/t/new-component-streamlit-tree-select-a-simple-and-elegant-checkbox-tree/30195/10
Thanks,
Arvindra
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",
}
I tried to change the color of the checkboxes, but since they are as iframe object it seems we can't edit the css. Is there anyway we can do it?
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"
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?
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"]
Any clues would be appreciated! Thank you!
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.
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.
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!
Thank you for making such a great library.
I made a code snippet to create nodes from a directory.
https://gist.github.com/HiroshigeAoki/0a1d414ad0dd9fef6721f73a896513a6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.