Skip to main content

shinyswatch

Bootswatch + Bootstrap 5 themes for Shiny.

Here are just three of the 25 themes in shinyswatch:

Minty Sketchy Superhero
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, add a shinyswatch.theme theme object 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(
    ui.input_slider("num", "Number:", min=10, max=100, value=30),
    ui.output_text_verbatim("slider_val"),
    theme=shinyswatch.theme.darkly,  # <- Use a shinyswatch theme here
)


def server(input: Inputs, output: Outputs, session: Session):
    @output
    @render.text
    def slider_val():
        return f"{input.num()}"


app = App(app_ui, server)

darkly theme

Note: When writing shiny apps that use shinyswatch on shinylive.io, remember to add shinyswatch to your requirements.txt file!

Theme picker

To add a theme picker to your app, add the theme picker UI and server functions to your app’s UI and server definitions.

Demo theme picker app on shinylive.io.

Plot Theming

shinyswatch themes include a .colors attribute that can be used to theme plots or other outputs and UI elements. In the example below, try changing the theme and re-running the app to see how the plot changes.

Demo plot theming app on 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

Release files for shinyswatch 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shinyswatch 0.13.0
File Size Uploaded
shinyswatch-0.13.0.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for shinyswatch 0.13.0
File Interpreter ABI Platform
shinyswatch-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.9 MB

Release files / shinyswatch-0.13.0.tar.gz

Download URL shinyswatch-0.13.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f620a0c3087c628794cece291817c0fa1392b6050a33578780f89274c521fcea
BLAKE2b-256 checksum
How to use checksums
e6c423f040aa3f013880fe3120b8f96e1edf1bf5e504215a36cafe6e5f0be3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / shinyswatch-0.13.0-py3-none-any.whl

Download URL shinyswatch-0.13.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dac07f22e38a1fc8d756b59990db689f5ab0194ad1ea6f9c6acecb925e03bb5e
BLAKE2b-256 checksum
How to use checksums
b78bf0200b8f6d8744e6db5cc8fa08a4f4a5e84c22194a1b617e91643797f03c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.13.1

2 release files

This release

0.13.0 This release

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release 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