Skip to main content

Using shadcn components in Streamlit

Project description

streamlit-shadcn-ui :construction:

streamlit-shadcn-ui is in early development, the updates is shipped frequently. A relative stable will be launched after 11/27 2023. Follow the developer on twitter for updates: Follow ob12er

PyPI - Version PyPI - Downloads Streamlit App

Using shadcn-ui components in streamlit

streamlit-shadcn

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 Streamlit App

  • button
  • checkbox
  • select
  • tabs
  • card
  • avatar
  • date_picker
  • date_range_picker
  • table
  • input
  • slider
  • textarea
  • switch
  • radio_group
  • alert_dialog
  • hover_card
  • badges
  • link_button

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.

POC:

with ui.element("card", key="base_ele") as card:
    with ui.element("card", key="base_ele2") as card2:
        card2.add_child(ui.element("input", key="nst2_input"))
        card2.add_child(ui.element("button", key="nst2_btn", text="Nest Submmit", variant="outline"))
    card.add_child(card2)
    card.add_child(ui.element("button", key="nst_btn", text="Hello World"))
POC example

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


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-0.1.11.tar.gz (172.1 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-0.1.11-py3-none-any.whl (178.2 kB view details)

Uploaded Python 3

File details

Details for the file streamlit-shadcn-ui-0.1.11.tar.gz.

File metadata

  • Download URL: streamlit-shadcn-ui-0.1.11.tar.gz
  • Upload date:
  • Size: 172.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for streamlit-shadcn-ui-0.1.11.tar.gz
Algorithm Hash digest
SHA256 8bd8f3cb694061d15ba577a4d4e4aba7513f4218b9cec234c105521f8c1da527
MD5 f0e23444c79e891398f451005c43d1c4
BLAKE2b-256 a92b2a82ab1621025595399cd83de6376e38fe0c4035ccdb5a297a5df485b6ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_shadcn_ui-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f421f595cbb3cc6192669c8789ee87a0fb9d7facfc09526ba97bbf8cd9731c8b
MD5 9c469308d14a0a27e39079fcdfe5338a
BLAKE2b-256 a01b598d214009f7a791b7e306027e2f05b61a71cf4386e7bd2aa33afd8cb5e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page