Toggling component for Streamlit
Project description
Streamlit Toggle
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
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_toggle-0.1.2.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for streamlit_toggle-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99e01be909e4a4289e20ddb9c787654013f377ec7a0bf1d3d755ec54f686719c |
|
MD5 | a260581f3f2034422678ec26ca7aa7a0 |
|
BLAKE2b-256 | eb4f91cdae118354421c2690603f940f77381eb26dd371b4e3e263d706714204 |