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

Add containers external writing support #40

Open
Rom1deTroyes opened this issue Dec 22, 2022 · 1 comment
Open

Add containers external writing support #40

Rom1deTroyes opened this issue Dec 22, 2022 · 1 comment

Comments

@Rom1deTroyes
Copy link

Is your feature request related to a problem? Please describe.

When using containers as a variable to be able to write into from outside the container (i.e. not with st.container: but cont = st.container() + cont.write('...')) it is not possible to attach a st_tag component.

Describe the solution you'd like

Having a way to do st.st_tag, cont.st_tag and so on, like the other Streamlit input widgets.

Describe alternatives you've considered

I've tried forms and expanders like in #35 and #36 : they render well, but they are not writable from the outside, and cannot be intrigued like I need
(container in a container, writing from a function in another place).

Additional context

I can confirm that it works with with:

    with st.container():
        st.header("HeaderC")
        st.markdown("-----")

        selection_codes_articles = st_tags(
                label="Articles à chercher C:",
                text="(Code + Entrée pour ajouter)",
                value=["12345-01"],
                suggestions=["12345-01"],
                maxtags=-1,
                key="ArticlesC",
        )
        btn = st.button('->C')

image

But it didn't work when writing from outside (see the second example in documentation) :

    cont = st.container()
    cont.header("HeaderCont")
    cont.markdown("-----")
    selection_codes_articles = st_tags(
            label="Articles à chercher Cont:",
            text="(Code + Entrée pour ajouter)",
            value=["12345-01"],
            suggestions=["12345-01"],
            maxtags=-1,
            key="ArticlesCont",
    )
    btn = cont.button('->Cont')

image

The st_tag() is not internal, so it is rendered after the container (expected behavior, thus we need a way to attach the component inside the container).

Using cont.st_tags of course don't work either (StreamlitAPIException: st_tags() is not a valid Streamlit command.), but will be the best option (please @streamlit gets this widget official !)

Any thoughts about how to achieve this ?

Thanx for this works, it's a great piece of UI/UX 🥇

@CHerSun
Copy link

CHerSun commented Feb 14, 2023

with cont:
   st_tags...

???

And how do you expect to add writing to st.container directly, if author doesn't influence Streamlit internal code? It's not C# with extension methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants