A Streamlit component that renders an indented, tree-like clickable list and returns the clicked item ID.
- Hierarchical list rendering using
level - Configurable indentation (
indent) - Optional custom CSS (
style) - Optional callback hook (
on_change)
Install directly from GitHub:
pip install git+https://github.com/dschiese/clickable_list.gitOr install locally for development:
git clone https://github.com/dschiese/clickable_list.git
cd clickable_list
pip install -e .import streamlit as st
from clickable_list import clickable_list
options = [
{"id": 1, "name": "Method A", "level": 0},
{"id": 2, "name": "Method B", "level": 1},
{"id": 3, "name": "Method C", "level": 2},
]
selected = clickable_list(options, indent=20)
st.write("Selected:", selected)clickable_list(options, indent=10, key=None, style=None, on_change=None, args=(), kwargs=None)
options: list of dicts withid,name,levelindent: left spacing per hierarchy level in pixelskey: Streamlit component keystyle: CSS string applied to list itemson_change: callback executed after selection change
streamlit run src/app.pyMIT (see LICENSE).