Skip to main content

A simple and elegant checkbox tree for Streamlit.

Project description

🐙 streamlit_tree_select

A simple and elegant checkbox tree for Streamlit. Build on react-checkbox-tree.

animated

Installation

streamlit-tree-select is distributed via. PyPi:

pip install streamlit-tree-select

Quickstart

Using streamlit-tree-select is as simple as importing tree_select and passing a list of nodes.

import streamlit as st
from streamlit_tree_select import tree_select

st.title("🐙 Streamlit-tree-select")
st.subheader("A simple and elegant checkbox tree for Streamlit.")

# 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)

Properties

The tree select can be customized using the following parameters:

Property Type Description Default
nodes list A list containing tree nodes and their children. A need needs to include a label and a value. Furthermore, a list of children can be added. Further possible parameters: className (A class Name to add to the node, default None), disabled (Whether the node should be disabled, default False), showCheckbox (Whether the node should show a checkbox, default True), title (A custom title attribute for th node, default None). []
check_model str Specifies which selected nodes should be returned. Possible inputs: "all", "leaf". 'all'
checked list A list of selected nodes. []
direction str Specify the direction of the component. Left-to-right ('ltr') or right-to-left ('rtl'). 'ltr'
disabled bool If True, the component will be disabled and cannot be used. False
expand_disabled bool If True, nodes cannot be expanded. False
expand_on_click bool If True, nodes will be expanded by clicking on the labels. False
expanded list A list of expanded node values. []
no_cascade bool If True, toggling a parent node will not cascade its check state to its children. False
only_leaf_checkboxes bool If True, checkboxes will only be shown for leaf nodes. False
show_expand_all bool If True buttons for expanding and collapsing all parent nodes will appear in the tree. False

Returns

tree_select returns a dictionary containing the keys checked node values as well as expanded node values.

Property Type Description Default
checked list A list of expanded node values. []
expanded list A list of expanded node values. []

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_tree_select_dark-0.0.14.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_tree_select_dark-0.0.14-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_tree_select_dark-0.0.14.tar.gz.

File metadata

File hashes

Hashes for streamlit_tree_select_dark-0.0.14.tar.gz
Algorithm Hash digest
SHA256 3b66d6c90a9731a5d5009ff582c1335c6f8490e9247b03d699b8eb65c7be201f
MD5 28af663ccd674c1ab72527b36284dd7c
BLAKE2b-256 560e9b6a91c2dc113135197b56a7f7b3734a35f466d9b7f98cddde85c2f299dd

See more details on using hashes here.

File details

Details for the file streamlit_tree_select_dark-0.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_tree_select_dark-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 b86e0be8c407883593e3a9ff594e3a189cb158a587238ea099ec823a7b7431b2
MD5 1693cda9d3990ea18c4c373cec9dd781
BLAKE2b-256 48a18e23ee23bb3c926e9cbd0ec922d34f225269a41d1c77c6637498bc5316dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page