Skip to main content

Streamlit Toggle

Open in Streamlit GitHub PyPI

Add toggle switches to your Streamlit app.

Installation

pip install streamlit-toggle

Quickstart

import streamlit as st
from streamlit_toggle import toggle

st.title('Streamlit Toggle')
toggle()

License

Streamlit Toggle has an MIT license, as found in the LICENSE file.

Documentation

streamlit_toggle.toggle

streamlit_toggle.toggle(container=None, widget='slider', label='', value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False)

Add a toggle switch to Streamlit app.

Parameters:

  • container (any, optional): The Streamlit container. Defaults to None.
  • widget (str, optional): The input widget. Defaults to 'slider'.
  • label (str, optional): The short label explaining what the toggle switch is for. Defaults to ''.
  • value (bool, optional): The preselected value on first renders. Defaults to False.
  • key (str, optional): The unique key for the widget. Defaults to None, a key will be automatically generated.
  • help (str, optional): The tooltip that gets displayed next to the toggle switch. Defaults to None.
  • on_change (callable, optional): The callback invoked when the value of the toggle switch changes. Defaults to None.
  • args (tuple, optional): The tuple of args to pass to the callback. Defaults to None.
  • kwargs (dict, optional): The dictionary of kwargs to pass to the callback. Defaults to None.
  • disabled (bool, optional, keyword-only): Whether the toggle switch is to be disabled. Defaults to False.

Returns:

(bool): The value of the toggle switch.

streamlit_toggle.theme

streamlit_toggle.theme(container=None, widget='checkbox', label='Dark', value=False, key=None, help=None, *, disabled=False, path=None)

Add a Streamlit Light and Dark theme toggle switch to Streamlit app.

Parameters:

  • container (any, optional): The Streamlit container. Defaults to None.
  • widget (str, optional): The input widget. Defaults to 'checkbox'.
  • label (str, optional): The short label explaining what the toggle switch is for. Defaults to 'Dark'.
  • value (bool, optional): The preselected value on first renders. Defaults to False, the default Streamlit Light theme.
  • key (str, optional): The unique key for the widget. Defaults to None, a key will be automatically generated.
  • help (str, optional): The tooltip that gets displayed next to the toggle switch. Defaults to None.
  • disabled (bool, optional, keyword-only): Whether the toggle switch is to be disabled. Defaults to False.
  • path (str, optional, keyword-only): The path of Stramlit app. Defaults to None, the file path of the caller.

Returns:

(bool): The value of the toggle switch.

Contribution

Changelog

Version 0.1.0:

  • Made toggling component functional
  • Made essential theming component functional, toggling between Streamlit Light and Dark theme

Metadata

Release files for streamlit-toggle 0.1.3

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-toggle 0.1.3
File Size Uploaded
streamlit_toggle-0.1.3.tar.gz 4.6 kB Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / streamlit_toggle-0.1.3.tar.gz

Download URL streamlit_toggle-0.1.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d2f5dd0283e0d02ba611f943c8cfb650ed3338df7d43d6476e13f2b76147584
BLAKE2b-256 checksum
How to use checksums
5e70235e4ab6dbd24e335de40256cab6b8d31ebd375b6d1c3e33fb5a92dbbbea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / streamlit_toggle-0.1.3-py3-none-any.whl

Download URL streamlit_toggle-0.1.3-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb2f36d9f6d8cb20a30d4ed3e10827daeea0270826eeebea1c078b3448550a76
BLAKE2b-256 checksum
How to use checksums
0710355b5e8339e1ba28a826b9f8b661443a033c24874f6138554937856eb8f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.3 This release

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