Skip to main content

streamlit-shadcn-ui

PyPI - Version PyPI - Downloads Streamlit App

shadcn components for Streamlit, implemented on Streamlit Components V2.

The 1.x package uses checked-in shadcn source backed by Base UI, React 19, Tailwind CSS 4, and Streamlit's isolated Shadow DOM runtime. Components render without an iframe. Anchored and modal overlays stay in their own component ShadowRoot and use the browser top layer, so Select, Combobox, Dropdown Menu, Popover, Hover Card, Date Picker, Alert Dialog, and Elements Dialog, Sheet, or Tooltip are not clipped by the Streamlit layout.

Installation

pip install streamlit-shadcn-ui

Python 3.10 or newer and Streamlit 1.60 or newer are required.

The component test suite runs on Streamlit 1.60.0 and 1.61.1 with Starlette 1.3.1. To use the tested Streamlit 1.60 configuration, install all three packages together.

pip install "streamlit==1.60.0" "starlette==1.3.1" "streamlit-shadcn-ui==1.6.0"

During 1.5.0 acceptance, Streamlit 1.60.0 intermittently failed to serve component assets with Starlette 1.10.0. The same tests passed with Starlette 1.3.1. See the host compatibility findings.

Quick start

import streamlit as st
import streamlit_shadcn_ui as ui

fruit = ui.select(
    "Fruit",
    ["Apple", "Banana", "Orange"],
    value="Banana",
)

enabled = ui.switch("Enable notifications", value=True)

if ui.button("Save", variant="default"):
    st.write({"fruit": fruit, "enabled": enabled})

key is optional for ordinary calls. Add a stable key when components are created from a loop, can be reordered, or need identity that survives changes to their other arguments:

for project in projects:
    ui.checkbox(project.name, key=f"project_{project.id}")

Choice components return the original Python values rather than their display labels. Use format_func, Choice, or MenuItem to customize presentation without changing the returned value.

Components

  • Choice and action: select, combobox, dropdown_menu, radio_group, button, link_button, breadcrumb, pagination
  • Inputs: checkbox, input, input_group, number_input, textarea, input_otp, slider, switch, toggle, toggle_group
  • Date and navigation: calendar, date_picker, tabs, accordion, collapsible
  • Overlays: popover, hover_card, alert_dialog; Elements also provides Dialog, Sheet, and Tooltip composition
  • Display: alert, avatar, badge, badges, card, metric_card, aspect_ratio, progress, scroll_area, separator, skeleton, table
  • Records: data_table adds local sorting, search, pagination, column visibility, stable row selection, and one-shot row actions
  • Composition: elements creates one nested, stateful React tree from typed Card, Button Group, Dialog, Sheet, Empty, Field, Item, Avatar, Tooltip, Spinner, Tabs, Accordion, Collapsible, Scroll Area, layout, content, input, choice, and action nodes
  • Charts: line_chart, area_chart, bar_chart, pie_chart, radar_chart, radial_chart accept records or DataFrames with native shadcn tooltips and legends. The Charts guide includes data limits.
with ui.elements(key="settings") as el:
    with el.card(key="account"):
        with el.card_header():
            el.heading("Account")
            el.text("Manage your preferences.", variant="muted")
        with el.card_content():
            email = el.input("Email", key="email")
        with el.card_footer():
            save = el.button("Save", key="save", stretch=True)

st.write(email.value, save.clicked)

See the Elements documentation, the V2 technical assessment, and the independent shadcn homepage-card use case. Version 1.5.0 introduced nested Elements containers, Item, Sheet, and Data Table. The records example combines a Data Table with a Sheet editor and saves edits back to the table. Data Table supports up to 1,000 local rows and remains a standalone widget. See the composition matrix for widget and Elements support. Version 1.6.0 adds open_request to Sheet so a row action can open an editor directly. Elements now supports static tables and all six chart families. A two-step report form shows how to keep a draft while moving between steps. See the record editor, chart and table tabs, and report setup form. Release changes are recorded in the changelog and the 1.6.0 release notes.

The documentation app uses Home.py as its explicit router. Its product homepage, interactive Playground, and component pages are executable documentation for the complete catalog.

Architecture

The production component path is deliberately kept recognizable and upgradable:

Python API
  -> Streamlit Components V2 adapter
    -> owned generated shadcn component
      -> Base UI behavior primitive

shadcn owns the component palette, radius, typography, focus rings, and interaction styling. Streamlit provides the surrounding light/dark color scheme, language, and direction. The package does not restyle shadcn to look like Streamlit.

Ordinary helper calls are independently isolated V2 components. Precomposed helpers such as Card, Popover, and Collapsible accept documented text or data arguments. ui.elements is the opt-in aggregate path: its complete typed tree is rendered in one V2 root. Neither path accepts native Streamlit elements as React children.

See the 1.0 API decision, architecture plan, and V1-to-1.0 migration guide for the detailed contracts.

Migrating from 0.1.x

The 1.0 package root is the V2 API. The V1 iframe implementation and streamlit_shadcn_ui.v1 compatibility namespace are not shipped. Applications that cannot migrate yet should remain on the last 0.1.x release.

The most common source changes are:

  • button(text=...) becomes button(label=...);
  • grouped V1 checkboxes become ordinary composition of scalar checkboxes;
  • with ui.card(...) becomes Streamlit layout around a declarative Card;
  • low-level trigger/content helpers and experimental element() trees are removed;
  • component return values and callbacks replace reliance on raw session-state transport dictionaries.

The full mapping is in the compatibility matrix.

Development

Follow the repository's AGENTS.md. Changes to shadcn default styles, including overrides in adapters or documentation CSS, require explicit user permission.

Use Node 22.20.0 and the pnpm version pinned in the frontend manifest.

./scripts/frontend_v2.sh            # watch the V2 frontend build
./scripts/dev.sh                    # run the documentation app
./scripts/verify_v2_release_source.sh
python3 -m unittest discover -s tests/v2

Pull requests and pushes to main run Python tests on Streamlit 1.60.0 and 1.61.1. CI also rebuilds the checked-in frontend, checks the wheel and source archive, and exercises the record editor, chart and table tabs, and two-step report setup in Chromium. See the Components workflow.

The Python implementation lives in streamlit_shadcn_ui/v2, generated and adapted frontend source in streamlit_shadcn_ui/frontend_v2, and release assets in streamlit_shadcn_ui/frontend_v2/dist.

References

License

MIT. See LICENSE.

Metadata

Release files for streamlit-shadcn-ui 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-shadcn-ui 1.6.0
File Size Uploaded Provenance Actions
streamlit_shadcn_ui-1.6.0.tar.gz 490.1 kB Without provenance Details for streamlit_shadcn_ui-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-shadcn-ui 1.6.0
File Interpreter ABI Platform Actions
streamlit_shadcn_ui-1.6.0-py3-none-any.whl Python 3 none any Details for streamlit_shadcn_ui-1.6.0-py3-none-any.whl

Total release size: 1.0 MB

Release files / streamlit_shadcn_ui-1.6.0.tar.gz

Download URL streamlit_shadcn_ui-1.6.0.tar.gz
Size 490.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc6c7ec09b7854b0a153dad27f1c2c9912bf9e1631d229ab120cb53ab0332daf
BLAKE2b-256 checksum
How to use checksums
fa20d267f20c48fd45886c6a38f701b5e3f20cc2431c7ee69a85042ddabde5d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Release files / streamlit_shadcn_ui-1.6.0-py3-none-any.whl

Download URL streamlit_shadcn_ui-1.6.0-py3-none-any.whl
Size 513.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b231777a2edef5c89209ac23ea371a58726a6cb9cebbfd0b46401a4c0fc1a957
BLAKE2b-256 checksum
How to use checksums
6e529a53661c62547ca3cd2c8850bcb3116536ec8f08923e8e36a9835a98bf5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Security for streamlit-shadcn-ui 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page