Skip to content

Add a stateful button #16240

Description

@lukasmasuch

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Add a stateful mode for st.button so each click toggles between on and off, with the button visually showing its current state and returning a boolean value.

Why?

This would support compact on/off actions that should look like buttons rather than switches, without requiring manual st.session_state handling.

How?

For example, add a toggle=True parameter to st.button, or introduce a dedicated st.toggle_button API.

Additional Context

st.toggle covers the switch-style UI; this request is for the same stateful behavior with a button-style appearance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:widgetsRelated to widget elementsfeature:st.buttonRelated to the `st.button` widgetfeature:st.toggleRelated to the `st.toggle` widgettype:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions