Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prototype] Add key parameter to st.container #8569

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

LukasMasuch
Copy link
Collaborator

@LukasMasuch LukasMasuch commented Apr 26, 2024

Describe your changes

GitHub Issue Link (if applicable)

Testing Plan

  • Explanation of why no additional tests are needed
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@LukasMasuch LukasMasuch changed the title Add key parameter to st.container [Prototyep] Add key parameter to st.container Apr 26, 2024
@LukasMasuch LukasMasuch changed the title [Prototyep] Add key parameter to st.container [Prototype] Add key parameter to st.container Apr 26, 2024
lib/streamlit/elements/widgets/data_editor.py Fixed Show fixed Hide fixed
def current_container_key(this_dg: DeltaGenerator) -> str | None:
"""Find the container key for the given DeltaGenerator."""
# Avoid circular imports.
from streamlit.delta_generator import dg_stack

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
streamlit.delta_generator
begins an import cycle.
@xgorse
Copy link

xgorse commented Apr 29, 2024

Great, it will simplify a lot CSS interface customisation,
It will be awsome if we could inject the same CSS classname, based on key attribute, for any widget and button.
It will avoir user a special container juste for CSS

Any plan for that ?

Thanks

@@ -29,11 +31,18 @@

SpecType: TypeAlias = Union[int, Sequence[Union[int, float]]]

# Pattern to validate a container key (to be compatible with css class names):
_KEY_PATTERN: Final = re.compile(r"^[a-zA-Z_][a-zA-Z0-9\-_]*$")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check here that it starts with a letter is not needed since we prefix the key anyways with some letters (e.g. st-)

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants