Skip to main content

st-segmented-buttons

A customizable segmented button component for Streamlit applications. Create button groups with rich text, icons, and styling options.

Installation

pip install st-segmented-buttons

Quick start

import streamlit as st
from st_segmented_buttons import segmented_buttons

# Simple example
selection = segmented_buttons(
    ["Option A", "Option B", "Option C"],
    default="Option A",
    key="simple_buttons"
)

if selection:
    st.write(f"You selected: {selection}")

Parameters

Parameter Type Default Description
buttons List[Union[str, Dict]] Required Button definitions
default Union[str, List[str]] None Default selection(s)
multiselect bool False Enable multiple selection
color str "#484853" Text color (unselected)
background_color str "#ffffff" Background color (unselected)
selected_color str "#106a6c" Text color (selected)
selected_background_color str "#e9f1f0" Background color (selected)
border_radius str "6px" Border radius
border_width str "1px" Border width
border_color str "#ebebeb" Border color (unselected)
selected_border_color str "#106a6c" Border color (selected)
shadow str "none" Box shadow CSS
height str "40px" Button height
font_size str "14px" Font size
gap str "8px" Gap between buttons
auto_stretch bool False Stretch to fill width
key str None Streamlit component key

Button dictionary format

When using dictionaries for buttons:

{
    "label": "Display Text",     # Required: HTML string
    "value": "return_value",     # Required: Return value
    "icon": "🎯",                # Optional: Icon/emoji
    "disabled": False            # Optional: Disable button
}

Return values

  • Single select: Returns selected value as str or None
  • Multi-select: Returns list of selected values as List[str] or []

License

MIT License - see LICENSE file for details.

Release files for st-segmented-buttons 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for st-segmented-buttons 0.1.0
File Size Uploaded
st_segmented_buttons-0.1.0.tar.gz 401.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for st-segmented-buttons 0.1.0
File Interpreter ABI Platform
st_segmented_buttons-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 805.1 kB

Release files / st_segmented_buttons-0.1.0.tar.gz

Download URL st_segmented_buttons-0.1.0.tar.gz
Size 401.3 kB
Tags Source
SHA-256 checksum
How to use checksums
288b63f0301fd2c1af115e778349768540c636f0a1405d45e053a53b3540a041
BLAKE2b-256 checksum
How to use checksums
5dadd74930fe3a1bd36b2e61b135bf8aa69010024b76fd62615ae216225afde7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / st_segmented_buttons-0.1.0-py3-none-any.whl

Download URL st_segmented_buttons-0.1.0-py3-none-any.whl
Size 403.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fd41aac37cef5a381e6fac2929c2795e51d7bfe30878199352f05237225fd54
BLAKE2b-256 checksum
How to use checksums
3435c9f0c1495a21a2a4b7ba77f802fdb10ee61a4b8f6f4a50bddf3a5e3aef5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.1.0 This release

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