Skip to main content

Streamlit Custom Toggle

A custom component to load heart-shaped Toggle Switch widget

Installation ⬇

pip install streamlit-custom-toggle

Example Usage

Copy this code snippet

import streamlit as st
from streamlit_custom_toggle import st_custom_toggle

st.header('Music Choices')
col1, col2, col3 = st.columns(3, gap="small")
with col1:
    calm = st_custom_toggle('Calm', active_track_fill="#EAE4E4", active_thumb_color="#EAE4E4", value="true", key="toggle1")  # Disabled toggle switch

with col2:
    fun = st_custom_toggle('Fun', active_track_fill="#57FD6E", active_thumb_color="#EAE4E4", key="toggle2")

with col3:
    music_toggle = st_custom_toggle('Rock', active_track_fill="#FF5733", active_thumb_color="#900C3F", key="toggle3")
    music = st.radio(
    "Select your favorite artist",
    ('The Beatles', 'AC/DC', 'Pink Floyd', 'Elvis Presley', 'MÃ¥neskin'), disabled=music_toggle)

    st.markdown(f"You choose {music}")

# Checking the toggle state
st.code(f"Calm = {calm}, Fun = {fun}, Rock = {music_toggle}")

References

Release files for streamlit-custom-toggle 0.1.1

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

Source distribution (sdist)

Source distribution for streamlit-custom-toggle 0.1.1
File Size Uploaded
streamlit-custom-toggle-0.1.1.tar.gz 549.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-custom-toggle 0.1.1
File Interpreter ABI Platform
streamlit_custom_toggle-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / streamlit-custom-toggle-0.1.1.tar.gz

Download URL streamlit-custom-toggle-0.1.1.tar.gz
Size 549.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5a72ca0e9ea56e31d32ee68b23dc2e6737621058c0544c7c7c0ebcc55495d1ea
BLAKE2b-256 checksum
How to use checksums
0e7f7a3252371baf29416a26c184a90ce24aa04da9581f186dbb7b87aebbbf19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.7

Release files / streamlit_custom_toggle-0.1.1-py3-none-any.whl

Download URL streamlit_custom_toggle-0.1.1-py3-none-any.whl
Size 555.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51fda67ad1c95c8fc9abf2a6987f8ff279dad8fd5de138220d2cf4d832431f33
BLAKE2b-256 checksum
How to use checksums
41bf0b38d2db274b945def12fee8520b8cae2968ca6e6973091388d9f018a762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.0.1

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