Skip to main content

No project description provided

Reason this release was yanked:

import streamlit as st

Project description

streamlit tree independent components

Component is React component designed to render a hierarchical tree view with checkboxes, integrated with Streamlit for use within Streamlit applications. It allows users to navigate and select items in a nested structure, with customizable icons and state management features.

Features

Hierarchical Tree Structure:

Renders a nested tree structure using TreeView and TreeItem from Material-UI. Nodes can have multiple child nodes, creating a multi-level hierarchy. Checkbox Selection:

Each node includes a checkbox for selection.

The component manages the selection state, ensuring it reflects the user's choices. Node Icon Customization:

Nodes can display different icons based on their type (folder, settings, document, or a default file icon).

Icons are determined using the determineIcon function.

Disabled Nodes: Nodes can be marked as disabled using the disable property. Disabled nodes are visually distinct (grayed out) and cannot be selected. The component skips these nodes when managing state changes and rendering. Parent-Child Relationship Management:

Includes functions (getChildById and findParentById) to manage selection states across parent and child nodes.

Ensures consistent selection/deselection of parent and child nodes.

State Management: Manages the state using selected (to track selected nodes) and setSelected. State updates occur whenever a user interacts with the component.

Integration with Streamlit:

Uses StreamlitComponentBase and the Streamlit API for seamless integration with Streamlit apps. Sends updated state back to the Streamlit environment for dynamic interactions. Recursive Rendering:

The renderTree method handles recursive rendering of the tree structure, ensuring all child nodes are displayed correctly.

Expandable Nodes: Includes icons for expanding (ExpandMoreIcon) and collapsing (ChevronRightIcon) nodes, enhancing navigation through the tree.

Installation instructions

pip pip install -i https://test.pypi.org/simple/ streamlit-tree-independent-components

Usage instructions

import streamlit as st
from streamlit_tree_independent_components import tree_independent_components

st.subheader("Component with input args")

treeItems =  {
  "id": "0",
  "name": "Parent",
  "icon":"folder",
  'disable':False,
  "children": [
    {
      "id": "1",
      "name": "Child - 1",
      "icon":"folder",
    },
    {
      "id": "2",
      "name": "Child - 2",
      "icon":"document",
      'disable':False,
      "children": [
        {
          "id": "3",
          "name": "Child - 3",
          "icon":"document",
          "children": [
            {
              "id": "4",
              "name": "Child - 4",
              "icon":"settings",
            },
            {
              "id": "5",
              "name": "Child - 5",
              "icon":"folder",
              "children": [
                {
                  "id": "6",
                  "name": "Child - 6",
                  "icon":"settings",
                  "disable":False
                },
              ],
            },
          ],
        },
      ],
    },
    {
      "id": "7",
      "name": "Child - 7",
      "icon":"folder",
      'disable': True,
      "children": [
        {
          "id": "8",
          "name": "Child - 8",
          "icon":"folder",
          'disable': False
        },
      ],
    },
  ],
}
checkItems = ["0","1","2","3","4","5","6","7"]

result = tree_independent_components(treeItems, checkItems, expandItems=checkItems)

st.write(result)

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_independent_components-0.0.9.tar.gz (578.8 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file streamlit_tree_independent_components-0.0.9.tar.gz.

File metadata

File hashes

Hashes for streamlit_tree_independent_components-0.0.9.tar.gz
Algorithm Hash digest
SHA256 695d39449d8e46be06dea67606e862bda80886c0a9bd5d445033d67c6e5bd6b2
MD5 2dd6c3b9ff2c2011a5c2ab3b5d669ef4
BLAKE2b-256 0c0d19745a14d5a9110c6b83462c81eec51736ec2b5a09fea9a7ecbad7ea6087

See more details on using hashes here.

File details

Details for the file streamlit_tree_independent_components-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_tree_independent_components-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 15ea3c4d99212443c0bf280bb79de61d6108a9ffc2a2bdf5aa238f52b8966bae
MD5 d633c71bc6a4601138ae7a1832f33c80
BLAKE2b-256 66cb020596de4ea04871b63fcc89733f549aa8ed166d4bbbf34da68a3cde355b

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