Skip to main content

Python tailwind toolkit - Injected with JS

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

st_tailwind-1.3.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

st_tailwind-1.3.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file st_tailwind-1.3.0.tar.gz.

File metadata

  • Download URL: st_tailwind-1.3.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for st_tailwind-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ef91d596073526dafccaf946f57db490c2111a81ba334a89f18eb1d87702e007
MD5 16991636a754d900504fb2860665a270
BLAKE2b-256 c181c5cb4e932dacdb878a5e6e5593efffe402e73684fb840aeef2d1b3783988

See more details on using hashes here.

File details

Details for the file st_tailwind-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for st_tailwind-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc666317c8a6bac708bb0177ee6204af1e25a252312cf83412bcfce983579835
MD5 a8bb1dfdb3280dc398efcc2d5c88eed3
BLAKE2b-256 3301b0c05f9f83d0c85610009f9a0b815cda14a854571bb4f128cbad811956fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page