New Component: Toggle Button Set

Hey everyone,

I wanted to share something new I’ve created: a component based on MUI’s Toggle Button Group. This feature allows users to select multiple options at once or just one, while still being able to see all the available buttons.

Install it by running pip install streamlit-toggle-button-set

image

Code for the above:

import streamlit as st
from toggle_button_set import toggle_button_set

outcome = toggle_button_set(
    button_list=['a', 'b', '1', '2', '🐋', '🐉'],
    default=['a', '1', '🐋', '🐉'],
    color="primary",
    size="large",
    exclusive=False,
    use_container_width=False
)

st.write(outcome)

You can find the PyPl & Github links below:
benny140/streamlit-toggle-button-set (github.com)
streamlit-toggle-button-set · PyPI

4 Likes

That looks super awesome. I love it! Does it offer simple destructuring? I see in the docs. Wonder how this API would work for people.

a_pressed, b_pressed, one_pressed, two_pressed = toggle_button_set(
    button_list=['a', 'b', '1', '2'],
    default=['a', '1'],
    color="primary",
    size="large",
    exclusive=False,
    use_container_width=False
)

I see both sides of just providing what was pressed, but thought it was interesting!