New Component: Tree Select

Hello everyone,

I wanted to create my first Streamlit Component and after some trial and error I decided to create a Tree Selector Component.

For this I took the TreeSelect Component from Ant Desing and made it usable for Streamlit (TreeSelect - Ant Design).

Hopefully someone can do something with it - I’m also looking forward to feedback.

It’s a lot of fun to use Streamlit - many thanks for creating such an aweseome library!

GitHub: GitHub - flucas96/st_ant_tree: A Streamlit implementation of the Ant Design Tree Component (https://ant.design/components/tree-select/).
PyPI: st-ant-tree · PyPI
Example app: https://flucas96-streamlit-tree-select-example-app-s0vkjx.streamlit.app/

Example:

image

7 Likes

This is awesome! I’ve been wanting something like this for a long time!

1 Like

Hey there,

Thanks for this – it has been very useful.

I noticed I think this no longer works with the latest Streamlit 1.36.0 update. When I select a new leaf I get
Type Error: ‘str’ object is not callable.

Wondering if there might be a quick fix? Thanks!

Hi,

I will have a Look at this on monday.

I am not sure what exactly the problem is but I am encountering the same issue with another component.

Best
Regards

Hey,

I aready had time to look at it. I do not think it is acutally an issue with the component itself but with Streamlit since version 1.36.

In my apps i am sticking for now with version 1.35 and I have opened up a GitHub issue:

Streamlit Component returning a value results in an Error in v.1.136 (worked before in v1.35 · Issue #8961 · streamlit/streamlit (github.com)

I changed how the on_change parameter works and now the component works also with Streamlit v1.36!

Just update to the newest version:
st-ant-tree · PyPI

Awesome this is working again. Thank you for the swift reply and fix!

1 Like

Awesome widget!

I have one main problem with it, when setting defaulValue programatically, it changes the output of the widget but the widget does not show the pre-selected defaults.
I opened a github issue:
changing defaultValue appears only after rerun · Issue #7 · flucas96/st_ant_tree (github.com)

Also, would be awesome to have UI similar to streamlit’s UI.