Skip to main content

streamlit-shadcn-ui

PyPI - Version PyPI - Downloads Streamlit App

shadcn components for Streamlit, implemented on Streamlit Components V2.

Version 1.0 is a V2-only release: it 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, Dropdown Menu, Popover, Hover Card, Date Picker, and Alert Dialog 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.

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, dropdown_menu, radio_group, button, link_button, breadcrumb, pagination
  • Inputs: checkbox, input, textarea, input_otp, slider, switch, toggle, toggle_group
  • Date and navigation: calendar, date_picker, tabs, accordion, collapsible
  • Overlays: popover, hover_card, alert_dialog
  • Display: alert, avatar, badge, badges, card, metric_card, aspect_ratio, progress, scroll_area, separator, skeleton, table

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.

Each call is an independently isolated V2 component. Precomposed helpers such as Card, Popover, and Collapsible accept documented text or data arguments; they do not accept arbitrary React children or nested Streamlit elements.

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

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 pytest tests/v2 -q

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_shadcn_ui-1.0.2.tar.gz (269.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_shadcn_ui-1.0.2-py3-none-any.whl (288.8 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_shadcn_ui-1.0.2.tar.gz.

File metadata

  • Download URL: streamlit_shadcn_ui-1.0.2.tar.gz
  • Upload date:
  • Size: 269.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for streamlit_shadcn_ui-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8d00f25ab40825b8e3b05dbeccf4568d2002cccf05c426c708a27f84726dc1d1
MD5 26a8a4828f2832c3f9677bcd03428541
BLAKE2b-256 a24b13d99669bb5f19ac1e5430cc3dabd40b558c30170f529fceead87bedefbd

See more details on using hashes here.

File details

Details for the file streamlit_shadcn_ui-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_shadcn_ui-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b88de40cc68a5077d0b6a0f73b60b580b31632a09a8a72c765da2c9803a338d9
MD5 a630da9811df8dbbcccbb94a11c87d2f
BLAKE2b-256 61fef8976b290098af6b034f53cf51d38e5126d28049b865c909eccde3a20c74

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.3

2 files

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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