Git Product home page Git Product logo

streamlit-shadcn-ui's Introduction

streamlit-shadcn-ui ๐Ÿšง

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 (date_picker with mode="range")
  • table
  • input
  • slider
  • textarea
  • switch
  • radio_group
  • alert_dialog
  • hover_card
  • badges
  • link_button

streamlit card

streamlit date picker

streamlit select

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")

streamlit react_component

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_ui is the python package
    • ./streamlit_shadcn_ui/components is the frontend mono repo
      • ./streamlit_shadcn_ui/components/packages/frontend is the custom components collection.
      • ./streamlit_shadcn_ui/components/packages/streamlit-components-lib is a patch of streamlit-components-lib for react 18 (For now, only the react/react-dom version is changed).
    • ./streamlit_shadcn_ui/py_components is 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.

streamlit-shadcn-ui's People

Contributors

observedobserver avatar bhznjns avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.