Using shadcn components in Streamlit
Project description
streamlit-shadcn-ui :construction:
Using shadcn-ui components in streamlit
Installation
pip install streamlit-shadcn-ui
example:
import streamlit_shadcn_ui as ui
trigger_btn = ui.button(text="Trigger Button", key="trigger_btn")
ui.alert_dialog(show=trigger_btn, title="Alert Dialog", description="This is an alert dialog", confirm_label="OK", cancel_label="Cancel", key="alert_dialog1")
Components
Check docs and compoenent examples in
- button
- checkbox
- select
- tabs
- card
- avatar
- date_picker
- date_range_picker (date_picker with mode="range")
- table
- input
- slider
- textarea
- switch
- radio_group
- alert_dialog
- hover_card
- badges
- link_button
- accordion
- alert
- aspect_ratio
- calendar
- carousel
- checkbox
- collapsible
- command
- dialog
- dropdown_menu
- input-OTP
- metric_card
- pagination
- popover
- progress
- radio_group
- resizable
- scroll_area
- separator
- skeleton
- toggle
- toggle_group
One more thing
There is a new component in testing, it will allows you to nest all streamlit-shadcn-ui components together. It will not treat each component as an independent streamlit custom component in iframe, but parse the component structure as data and render them all at once in one iframe.
example (live demo):
with ui.card(key="card1"):
with ui.card(key="card2"):
ui.element("input", key="card2_input")
ui.element("button", key="card2_btn", text="Nest Submmit", variant="outline")
ui.element("button", key="card1_btn", text="Hello World")
Development Guide
There are several scripts in scripts folder to help you develop this project.
# For local development
./scripts/frontend.sh # frontend dev server
./scripts/dev.sh # streamlit dev server
This repo follows the streamlit custom component structure.
./streamlit_shadcn_uiis the python package./streamlit_shadcn_ui/componentsis the frontend mono repo./streamlit_shadcn_ui/components/packages/frontendis the custom components collection../streamlit_shadcn_ui/components/packages/streamlit-components-libis a patch of streamlit-components-lib for react 18 (For now, only the react/react-dom version is changed).
./streamlit_shadcn_ui/py_componentsis the python level API for components.
Reference
License
This repo is under MIT license. See LICENSE for details.
streamlit_shadcn_ui/components/packages/streamlit-components-lib is under its original Apache-2.0 license. It is a temporal patch for streamlit-components-lib in react 18.
Project details
Release history Release notifications | RSS feed
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_shadcn_ui-0.1.19.tar.gz.
File metadata
- Download URL: streamlit_shadcn_ui-0.1.19.tar.gz
- Upload date:
- Size: 330.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70023d343c74a9542180092769ba26841a9248cdfe1a13b2415bfc6710f9b1bd
|
|
| MD5 |
56e7c49d88096d81ec29ec8bb2ac1837
|
|
| BLAKE2b-256 |
9844988e29d4853d0420e7c378393218a92bd897dbb399a7380102f44d821535
|
File details
Details for the file streamlit_shadcn_ui-0.1.19-py3-none-any.whl.
File metadata
- Download URL: streamlit_shadcn_ui-0.1.19-py3-none-any.whl
- Upload date:
- Size: 360.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73466ba1cc690794d41f5b67fd271c27ed8f78c6a3437d9df90a5409816299ec
|
|
| MD5 |
bc2720edfdd7f365c5a6d66e1160aec9
|
|
| BLAKE2b-256 |
37251f5d992affc461a72f339876fbd3a1cde6b96aa3df08405bd3bd758f1f35
|