Skip to main content

Streamlit Tailwind

codecov

If you find this project useful, please consider leaving a star <3

This project, Streamlit Tailwind, is designed to simplify the process of creating user interfaces. It provides a straightforward way to incorporate Tailwind CSS into your Streamlit applications. So, without further ado:

Install

Same as always, good ol' pip (or equivalents)

pip install st_tailwind

Example

img.png

import streamlit as st

import st_tailwind as tw

st.set_page_config("Streamlit Tailwind Examples")


def main():
    tw.initialize_tailwind()

    tw.write("Grid Container", classes="text-blue-500 pb-4")
    with tw.container(classes="grid grid-cols-4"):
        for idx in range(1, 9):
            st.button(f"Button {idx}")

    tw.write("Colored Button", classes="text-purple-500 pb-4")
    tw.button("Button", classes="bg-red-500")


if __name__ == "__main__":
    main()

Usage

Initialization

After configuring your page, call the initialize function so tailwind can be injected as a dependency.

import streamlit as st

import st_tailwind as tw

st.set_page_config("Streamlit Tailwind Examples")

tw.initialize_tailwind()

First way:

Use the tailwind wrapper components.

import st_tailwind as tw

tw.selectbox("test", [], classes="w-fit")

Second way:

Wrap the component yourself. You can add the classes keyword argument either in the wrapper method or on the wrapped method.

import streamlit as st

from st_tailwind import tw_wrap

tw_wrap(st.selectbox, classes="w-fit")("test", [])
tw_wrap(st.selectbox)("test", [], classes="w-fit")

Metadata

Release files for st_tailwind 1.3.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 st_tailwind 1.3.0
File Size Uploaded
st_tailwind-1.3.0.tar.gz 7.6 kB Details

Built distribution (wheel)

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

Total release size: 15.7 kB

Release files / st_tailwind-1.3.0.tar.gz

Download URL st_tailwind-1.3.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ef91d596073526dafccaf946f57db490c2111a81ba334a89f18eb1d87702e007
BLAKE2b-256 checksum
How to use checksums
c181c5cb4e932dacdb878a5e6e5593efffe402e73684fb840aeef2d1b3783988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.11

Release files / st_tailwind-1.3.0-py3-none-any.whl

Download URL st_tailwind-1.3.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc666317c8a6bac708bb0177ee6204af1e25a252312cf83412bcfce983579835
BLAKE2b-256 checksum
How to use checksums
3301b0c05f9f83d0c85610009f9a0b815cda14a854571bb4f128cbad811956fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.11

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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