Skip to main content

A Streamlit custom component to load heart-shaped Toggle Switch

Project description

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

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

streamlit-custom-toggle-0.1.1.tar.gz (549.1 kB view hashes)

Uploaded Source

Built Distribution

streamlit_custom_toggle-0.1.1-py3-none-any.whl (555.5 kB view hashes)

Uploaded Python 3

Supported by

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