Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Avoid StreamlitDuplicateElementId error when the same widget is in the main area and sidebar #10598

@sfc-gh-jrieke

Description

@sfc-gh-jrieke

Checklist

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

Summary

Using the same widget in the main area and the sidebar results in a StreamlitDuplicateElementId error:

import streamlit as st

st.button("Button")
st.sidebar.button("Button")

Image

However, we could easily differentiate the automatically generated keys for these two elements, given that one of them is in the sidebar and the other isn't.

Why?

Convenience, don't need to assign a key but it "just works".

How?

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.sidebarRelated to `st.sidebar` containergood first issueGood for newcomers to the codebasetype: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