Bootswatch + Bootstrap 5 themes for Shiny.
Project description
shinyswatch
Bootswatch + Bootstrap 5 themes for Shiny.
Here are just three of the 25 themes in shinyswatch:
Minty | Sketchy | Superhero |
---|---|---|
Installation
pip install shinyswatch
To install the latest development version from this repository:
pip install https://github.com/rstudio/py-shinyswatch/tarball/main
Usage
To use a theme, call the theme function and add it to your App's UI definition.
# Minty theme
shinyswatch.theme.minty()
# Sketchy theme
shinyswatch.theme.sketchy()
# Superhero theme
shinyswatch.theme.superhero()
Example Shiny application:
File: app.py |
Screenshot |
---|---|
from shiny import App, Inputs, Outputs, Session, render, ui
import shinyswatch
app_ui = ui.page_fluid(
# Theme code - start
shinyswatch.theme.darkly(),
# Theme code - end
ui.input_slider("num", "Number:", min=10, max=100, value=30),
ui.output_text_verbatim("slider_val"),
)
def server(input: Inputs, output: Outputs, session: Session):
@output
@render.text
def slider_val():
return f"{input.num()}"
app = App(app_ui, server)
|
Note: When writing shiny apps on shinylive.io, remember to add
shinyswatch
to yourrequirements.txt
file!
Theme picker
To add a theme picker to your app, add the shinyswatch.theme_picker_ui()
in place of your theme object and add shinyswatch.theme_picker_server()
into your server
definition.
Demo: shinylive.io
Development
If you want to do development on shinyswatch for Python:
pip install -e ".[dev,test,docs]"
Examples
There are multiple examples in the shinyswatch repo.
To run the demos locally, you can run the examples by calling:
python3 -m shiny run examples/basic-darkly/app.py
python3 -m shiny run examples/big-sketchy/app.py
python3 -m shiny run examples/components/app.py
python3 -m shiny run examples/theme-picker/app.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for shinyswatch-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8478fe74650881074ea94ca6ec830213a11c708b06145e2d4c13c77719cade31 |
|
MD5 | 7f3b45439787959e4dc9ae1a3ccd77a8 |
|
BLAKE2b-256 | dfc6bed34a01b84a111b5d0ab1daa23ebf7cac22c6f7b67c4999610f2bdd29f6 |