st-checkbox-tree


Namest-checkbox-tree JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryStreamlit checkbox tree component
upload_time2025-08-14 10:17:29
maintainerNone
docs_urlNone
authorPeter van Lunteren
requires_python>=3.6
licenseNone
keywords streamlit checkbox tree hierarchical component tree-lines visual-hierarchy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🌲 Streamlit Checkbox Tree

A simple checkbox tree component for Streamlit, forked from [streamlit_tree_selector](https://github.com/BlueGob/streamlit_tree_selector), built on [react-checkbox-tree](https://github.com/jakezatecky/react-checkbox-tree).

<p align="center">
  <img src="./img/example.gif" alt="animated" />
</p>

## Installation

```bash
pip install st-checkbox-tree
```

## Quick start
Using st-checkbox-tree is as simple as importing checkbox_tree and passing a list of nodes.
``` python
import streamlit as st
from st_checkbox_tree import checkbox_tree

st.title("🌲 Streamlit Checkbox Tree")

# Create nodes to display
nodes = [
    {"label": "Folder A", "value": "folder_a"},
    {
        "label": "<b> Folder B </b>",
        "value": "<u> folder_b </u>",
        "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 = checkbox_tree(nodes)
st.write(return_select)
```

### 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`     |
| `half_check_color` | str |  If specified it will override the default color of half checked boxes| `""` |
| `check_color` | str |  If specified it will override the default color of fully checked boxes | `""` |
| `show_tree_lines` | bool | If True, tree lines will be displayed to show hierarchical relationships. | `False` |
| `tree_line_color` | str | Color of the tree lines when show_tree_lines is True. | `"#ccc"` |

### Returns
checkbox_tree 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.                                                                                      | `[]`        |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "st-checkbox-tree",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "streamlit, checkbox, tree, hierarchical, component, tree-lines, visual-hierarchy",
    "author": "Peter van Lunteren",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/de/54/8086996cd3266abda29dc43164c816fb7e37da5ad78bb7bc84458d84ead0/st_checkbox_tree-1.0.2.tar.gz",
    "platform": null,
    "description": "# \ud83c\udf32 Streamlit Checkbox Tree\n\nA simple checkbox tree component for Streamlit, forked from [streamlit_tree_selector](https://github.com/BlueGob/streamlit_tree_selector), built on [react-checkbox-tree](https://github.com/jakezatecky/react-checkbox-tree).\n\n<p align=\"center\">\n  <img src=\"./img/example.gif\" alt=\"animated\" />\n</p>\n\n## Installation\n\n```bash\npip install st-checkbox-tree\n```\n\n## Quick start\nUsing st-checkbox-tree is as simple as importing checkbox_tree and passing a list of nodes.\n``` python\nimport streamlit as st\nfrom st_checkbox_tree import checkbox_tree\n\nst.title(\"\ud83c\udf32 Streamlit Checkbox Tree\")\n\n# Create nodes to display\nnodes = [\n    {\"label\": \"Folder A\", \"value\": \"folder_a\"},\n    {\n        \"label\": \"<b> Folder B </b>\",\n        \"value\": \"<u> folder_b </u>\",\n        \"children\": [\n            {\"label\": \"Sub-folder A\", \"value\": \"sub_a\"},\n            {\"label\": \"Sub-folder B\", \"value\": \"sub_b\"},\n            {\"label\": \"Sub-folder C\", \"value\": \"sub_c\"},\n        ],\n    },\n    {\n        \"label\": \"Folder C\",\n        \"value\": \"folder_c\",\n        \"children\": [\n            {\"label\": \"Sub-folder D\", \"value\": \"sub_d\"},\n            {\n                \"label\": \"Sub-folder E\",\n                \"value\": \"sub_e\",\n                \"children\": [\n                    {\"label\": \"Sub-sub-folder A\", \"value\": \"sub_sub_a\"},\n                    {\"label\": \"Sub-sub-folder B\", \"value\": \"sub_sub_b\"},\n                ],\n            },\n            {\"label\": \"Sub-folder F\", \"value\": \"sub_f\"},\n        ],\n    },\n]\n\nreturn_select = checkbox_tree(nodes)\nst.write(return_select)\n```\n\n### Parameters\n\n| Property             | Type     | Description                                                                                                            | Default     |\n| -------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | ----------- |\n| `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).                                                            | `[]`            |\n| `check_model`         | str   | Specifies which selected nodes should be returned. Possible inputs: \"all\", \"leaf\".                    | `'all'`    |\n| `checked`            | list    | A list of selected nodes.                                                                                       | `[]`        |\n| `direction`          | str   | Specify the direction of the component. Left-to-right ('ltr') or right-to-left ('rtl').    | `'ltr'`     |\n| `disabled`           | bool     | If True, the component will be disabled and cannot be used.                                                   | `False`     |\n| `expand_disabled`     | bool     | If True, nodes cannot be expanded.                                                                 | `False`     |\n| `expand_on_click`      | bool     | If True, nodes will be expanded by clicking on the labels.                        | `False`     |\n| `expanded`           | list    | A list of expanded node values.                                                                                      | `[]`        |\n| `no_cascade`          | bool     | If True, toggling a parent node will not cascade its check state to its children.                                  | `False`     |\n| `only_leaf_checkboxes` | bool     | If True, checkboxes will only be shown for leaf nodes.                                                                 | `False`     |\n| `show_expand_all`      | bool     | If True buttons for expanding and collapsing all parent nodes will appear in the tree.                                | `False`     |\n| `half_check_color` | str |  If specified it will override the default color of half checked boxes| `\"\"` |\n| `check_color` | str |  If specified it will override the default color of fully checked boxes | `\"\"` |\n| `show_tree_lines` | bool | If True, tree lines will be displayed to show hierarchical relationships. | `False` |\n| `tree_line_color` | str | Color of the tree lines when show_tree_lines is True. | `\"#ccc\"` |\n\n### Returns\ncheckbox_tree returns a dictionary containing the keys checked node values as well as expanded node values.\n\n| Property             | Type     | Description                                                                                                            | Default     |\n| -------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | ----------- |\n| `checked`           | list    | A list of expanded node values.                                                                                      | `[]`        |`\n| `expanded`           | list    | A list of expanded node values.                                                                                      | `[]`        |\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Streamlit checkbox tree component",
    "version": "1.0.2",
    "project_urls": null,
    "split_keywords": [
        "streamlit",
        " checkbox",
        " tree",
        " hierarchical",
        " component",
        " tree-lines",
        " visual-hierarchy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c139a036df063a34672cb4ed2041228a0bd2414750b8a7ccebe8f50ff6ec36a7",
                "md5": "94eebdbefd8c857d7d70361f4f95d182",
                "sha256": "994132eb816506cc15ca69e4ff98e6571e21bddc91f1379acfb8905858bae9f8"
            },
            "downloads": -1,
            "filename": "st_checkbox_tree-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "94eebdbefd8c857d7d70361f4f95d182",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 2321072,
            "upload_time": "2025-08-14T10:17:26",
            "upload_time_iso_8601": "2025-08-14T10:17:26.206538Z",
            "url": "https://files.pythonhosted.org/packages/c1/39/a036df063a34672cb4ed2041228a0bd2414750b8a7ccebe8f50ff6ec36a7/st_checkbox_tree-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "de548086996cd3266abda29dc43164c816fb7e37da5ad78bb7bc84458d84ead0",
                "md5": "94333778a4014750ecdf0496732ccd21",
                "sha256": "0c9ecc3e4dd2bdc3c70b826369bdada7f71f221b01313259a5f3cc9c9078116d"
            },
            "downloads": -1,
            "filename": "st_checkbox_tree-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "94333778a4014750ecdf0496732ccd21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3245881,
            "upload_time": "2025-08-14T10:17:29",
            "upload_time_iso_8601": "2025-08-14T10:17:29.451649Z",
            "url": "https://files.pythonhosted.org/packages/de/54/8086996cd3266abda29dc43164c816fb7e37da5ad78bb7bc84458d84ead0/st_checkbox_tree-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-14 10:17:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "st-checkbox-tree"
}
        
Elapsed time: 1.70768s