Streamlit Toggle Switch

Toggle Switch Component

Here is a quick component I wrote today. It is a very simple Toggle Switch component using React/Material-UI. Here is a quick snippet of it.

Install:

pip install streamlit-toggle-switch

Usage

import streamlit as st
import  streamlit_toggle as tog

tog.st_toggle_switch(label="Label", 
                    key="Key1", 
                    default_value=False, 
                    label_after = False, 
                    inactive_color = '#D3D3D3', 
                    active_color="#11567f", 
                    track_color="#29B5E8"
                    )

sample

Github Repo

7 Likes

Very nice @CarlosSerrano. Good customisation options.

Maybe, there will be a 3-way toggle button in future… :slight_smile:

Cheers

1 Like

Very cool and nice design @CarlosSerrano ! Have you considered adding it to Streamlit Extras? GitHub - arnaudmiribel/streamlit-extras: Discover, try, install and share Streamlit re-usable bits we call "extras"!

1 Like

@Amanda_Kelly yes, @blackary mentioned it to me yesterday. Will get it added soon.

Very useful and nice component.
Not sure, if its only me but font seems to be not matching with default theme.
Is it also in roadmap to have flip values on change.