A simple clickable list component for streamlit
Project description
streamlit-clickable-list
See demo: https://demopy-6aplg2asvytivaazchhqbj.streamlit.app/
How to install
pip install streamlit-clickable-list
How to use
col1, col2 = st.columns([1, 1])
with col1:
def on_click(name: str) -> None:
print(f"clicked: {name}")
st.session_state['clicked'] = name
st.header("Clickable list:")
clickable_list(["aaa", "bbb", "ccc"], on_click, key="clickable_list")
with col2:
st.header("Result:")
if "clicked" in st.session_state:
st.write(f"Clicked: {st.session_state['clicked'] or 'none'}")
For the component development
Based on: https://docs.streamlit.io/develop/concepts/custom-components/intro
Set up
- Set up python environment and dependencies
- Used: v3.9
- If you use
uv, run:uv sync
- Set up Node.js environment
- Used v22.13.1
- If you use
nvm, run:nvm use
- Set up node_modules
cd frontend npm install
Run dev
- Use dev mode
- Edit
streamlit_clickable_list/__init__.py-_RELEASE = True +_RELEASE = False
- Edit
- Run dev server
cd frontend npm start - Run streamlit app
streamlit run demo.py # with WSL streamlit run demo.py --server.fileWatcherType=poll --server.address=0.0.0.0- If you use
uv, adduv run
- If you use
Release to PyPI
- Use release mode
- Edit
streamlit_clickable_list/__init__.py-_RELEASE = False +_RELEASE = True
- Edit
- Build react app
cd frontend npm build - Run the app to check it in local
streamlit run demo.py # with WSL streamlit run demo.py --server.fileWatcherType=poll --server.address=0.0.0.0 - Update version
- Edit
pyproject.tomlto change version
- Edit
- Build python
- If you use
uv, run:rm dist/streamlit_clickable_list-* uv build
- If you use
- Push to GitHub (if you update
README.md)git push origin main - Publish to PyPI
uv publish --token <PyPI token>- Check
$HOME/.pypircfor <PyPI token>
- Check
Release to Streamlit Community Cloud
Only the first time:
- Log in Streamlit Community Cloud
- "Create app" > "Deploy a public app from GitHub"
- Input info in "Deploy an app"
To publish:
- First, publish it to PyPI
- Because the app in Streamlit Community Cloud uses the streamlit-clickable-list in PyPI
- Generate
requirement.txt- If you use
uv, run:uv pip compile pyproject.toml > requirements.txt
- If you use
- Push github, then it will be deployed to Streamlit Community Cloud
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_clickable_list-0.1.2.tar.gz.
File metadata
- Download URL: streamlit_clickable_list-0.1.2.tar.gz
- Upload date:
- Size: 405.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92372fa72f5117f59ceeb0b3410e4798253d0e0d7f801c7a094b66c4b00781e9
|
|
| MD5 |
0283d0e8e3d3023ae06545e2717f219a
|
|
| BLAKE2b-256 |
0859372cb079f80c201f27dc66e6d5d198bfff8d0e17bfb847c982029816b314
|
File details
Details for the file streamlit_clickable_list-0.1.2-py3-none-any.whl.
File metadata
- Download URL: streamlit_clickable_list-0.1.2-py3-none-any.whl
- Upload date:
- Size: 408.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbaee8020123b3a7481d05f0c227dfa636da8f502727f6b9ae2be1146a23c6d
|
|
| MD5 |
da074083df0df47cb27f859745df11d6
|
|
| BLAKE2b-256 |
bcb7b7b98094fbfd4a86776d8951f0f70495cdc7b120dda8cc959325c67a16de
|