streamlit-shadcn-ui


Namestreamlit-shadcn-ui JSON
Version 0.1.18 PyPI version JSON
download
home_pagehttps://github.com/ObservedObserver/streamlit-shadcn-ui
SummaryUsing shadcn components in Streamlit
upload_time2023-12-12 04:18:31
maintainer
docs_urlNone
authorObserved Observer
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Observed Observer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords streamlit shadcn ui components
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # streamlit-shadcn-ui :construction:

[![PyPI - Version](https://img.shields.io/pypi/v/streamlit-shadcn-ui)](https://pypi.org/project/streamlit-shadcn-ui/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/streamlit-shadcn-ui)
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://shadcn.streamlit.app/)

Using shadcn-ui components in streamlit

<img width="1453" alt="streamlit-shadcn" src="https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/75620347-9e9c-454c-a7ce-381d7464c519">


## Installation

```bash
pip install streamlit-shadcn-ui
```

example:
```py
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](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://shadcn.streamlit.app/)

+ [x] button
+ [x] checkbox
+ [x] select
+ [x] tabs
+ [x] card
+ [x] avatar
+ [x] date_picker
+ [x] date_range_picker (date_picker with mode="range")
+ [x] table
+ [x] input
+ [x] slider
+ [x] textarea
+ [x] switch
+ [x] radio_group
+ [x] alert_dialog
+ [x] hover_card
+ [x] badges
+ [x] link_button

![streamlit card](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/799b9235-96a6-406e-b270-e685de9ba5fd)

![streamlit date picker](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/8c32c4e0-8aaf-421d-b459-bceb63f1dd0a)

![streamlit select](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/f5a6eb8d-163f-4a7b-b88b-9b962d32dc1b)



## 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](https://shadcn.streamlit.app/Experiment(Cool))):
```py
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](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/ab40ed25-cc41-4630-adc9-7d604e44d538)

## Development Guide

There are several scripts in `scripts` folder to help you develop this project.

```sh
# 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
+ [streamlit-shadcn-ui examples and docs repo](https://github.com/ObservedObserver/steamlit-shadcn-ui-docs)
+ [Streamlit](https://streamlit.io/)
+ [shadcn-ui](https://ui.shadcn.com/)

# License
This repo is under MIT license. See [LICENSE](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. 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ObservedObserver/streamlit-shadcn-ui",
    "name": "streamlit-shadcn-ui",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "streamlit,shadcn,ui,components",
    "author": "Observed Observer",
    "author_email": "Observed Observer <ooer@kanaries.net>",
    "download_url": "https://files.pythonhosted.org/packages/0a/13/1188fad0a7a4c54cc3d2e56a7723f8a4155006a4617ab73ae9f7106c765a/streamlit-shadcn-ui-0.1.18.tar.gz",
    "platform": null,
    "description": "# streamlit-shadcn-ui :construction:\n\n[![PyPI - Version](https://img.shields.io/pypi/v/streamlit-shadcn-ui)](https://pypi.org/project/streamlit-shadcn-ui/)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/streamlit-shadcn-ui)\n[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://shadcn.streamlit.app/)\n\nUsing shadcn-ui components in streamlit\n\n<img width=\"1453\" alt=\"streamlit-shadcn\" src=\"https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/75620347-9e9c-454c-a7ce-381d7464c519\">\n\n\n## Installation\n\n```bash\npip install streamlit-shadcn-ui\n```\n\nexample:\n```py\nimport streamlit_shadcn_ui as ui\ntrigger_btn = ui.button(text=\"Trigger Button\", key=\"trigger_btn\")\n\nui.alert_dialog(show=trigger_btn, title=\"Alert Dialog\", description=\"This is an alert dialog\", confirm_label=\"OK\", cancel_label=\"Cancel\", key=\"alert_dialog1\")\n\n```\n\n## Components\n\nCheck docs and compoenent examples in [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://shadcn.streamlit.app/)\n\n+ [x] button\n+ [x] checkbox\n+ [x] select\n+ [x] tabs\n+ [x] card\n+ [x] avatar\n+ [x] date_picker\n+ [x] date_range_picker (date_picker with mode=\"range\")\n+ [x] table\n+ [x] input\n+ [x] slider\n+ [x] textarea\n+ [x] switch\n+ [x] radio_group\n+ [x] alert_dialog\n+ [x] hover_card\n+ [x] badges\n+ [x] link_button\n\n![streamlit card](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/799b9235-96a6-406e-b270-e685de9ba5fd)\n\n![streamlit date picker](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/8c32c4e0-8aaf-421d-b459-bceb63f1dd0a)\n\n![streamlit select](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/f5a6eb8d-163f-4a7b-b88b-9b962d32dc1b)\n\n\n\n## One more thing\nThere is a new component in testing, it will allows you to nest all streamlit-shadcn-ui components together.\nIt 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.\n\nexample ([live demo](https://shadcn.streamlit.app/Experiment(Cool))):\n```py\nwith ui.card(key=\"card1\"):\n    with ui.card(key=\"card2\"):\n        ui.element(\"input\", key=\"card2_input\")\n        ui.element(\"button\", key=\"card2_btn\", text=\"Nest Submmit\", variant=\"outline\")\n    ui.element(\"button\", key=\"card1_btn\", text=\"Hello World\")\n```\n\n![streamlit react_component](https://github.com/ObservedObserver/streamlit-shadcn-ui/assets/22167673/ab40ed25-cc41-4630-adc9-7d604e44d538)\n\n## Development Guide\n\nThere are several scripts in `scripts` folder to help you develop this project.\n\n```sh\n# For local development\n./scripts/frontend.sh # frontend dev server\n./scripts/dev.sh # streamlit dev server\n```\n\nThis repo follows the streamlit custom component structure.\n+ `./streamlit_shadcn_ui` is the python package\n    + `./streamlit_shadcn_ui/components` is the frontend mono repo\n        + `./streamlit_shadcn_ui/components/packages/frontend` is the custom components collection.\n        + `./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).\n    + `./streamlit_shadcn_ui/py_components` is the python level API for components.\n\n\n\n## Reference\n+ [streamlit-shadcn-ui examples and docs repo](https://github.com/ObservedObserver/steamlit-shadcn-ui-docs)\n+ [Streamlit](https://streamlit.io/)\n+ [shadcn-ui](https://ui.shadcn.com/)\n\n# License\nThis repo is under MIT license. See [LICENSE](LICENSE) for details.\n`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. \n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Observed Observer  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Using shadcn components in Streamlit",
    "version": "0.1.18",
    "project_urls": {
        "Homepage": "https://github.com/ObservedObserver/streamlit-shadcn-ui",
        "repository": "https://github.com/ObservedObserver/streamlit-shadcn-ui"
    },
    "split_keywords": [
        "streamlit",
        "shadcn",
        "ui",
        "components"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12344ec3e3569a36cca3f6f0c8a25e9344b6acce9d21308552f17531eec5d034",
                "md5": "693ee45054ed85a6cee5668a95ab10f7",
                "sha256": "6e1728f0f1d24508a17fc030ac0216a35077980e80585a0ced406ece822c0168"
            },
            "downloads": -1,
            "filename": "streamlit_shadcn_ui-0.1.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "693ee45054ed85a6cee5668a95ab10f7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 276402,
            "upload_time": "2023-12-12T04:18:27",
            "upload_time_iso_8601": "2023-12-12T04:18:27.512098Z",
            "url": "https://files.pythonhosted.org/packages/12/34/4ec3e3569a36cca3f6f0c8a25e9344b6acce9d21308552f17531eec5d034/streamlit_shadcn_ui-0.1.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a131188fad0a7a4c54cc3d2e56a7723f8a4155006a4617ab73ae9f7106c765a",
                "md5": "58ce70ee77177a0878925d607fe5f5cb",
                "sha256": "37a4b95869cdbd285310e7da0cc6130670b055a4bb48a3442f228a26e71b82d6"
            },
            "downloads": -1,
            "filename": "streamlit-shadcn-ui-0.1.18.tar.gz",
            "has_sig": false,
            "md5_digest": "58ce70ee77177a0878925d607fe5f5cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 262069,
            "upload_time": "2023-12-12T04:18:31",
            "upload_time_iso_8601": "2023-12-12T04:18:31.270797Z",
            "url": "https://files.pythonhosted.org/packages/0a/13/1188fad0a7a4c54cc3d2e56a7723f8a4155006a4617ab73ae9f7106c765a/streamlit-shadcn-ui-0.1.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-12 04:18:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ObservedObserver",
    "github_project": "streamlit-shadcn-ui",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "streamlit-shadcn-ui"
}
        
Elapsed time: 0.17178s