File uploader dropdown

How could I minimize or even remove the drop-down which appears when an add attachment button is being clicked?

Hello. Could you please share your app or a code snippet of it?

Thanks,

Sure!

 with columns[0]:
        if "clicked" not in st.session_state:
                st.session_state.clicked = False

        def set_clicked():
                st.session_state.clicked = True

        st.button("📎", on_click=set_clicked, use_container_width=True)
        if st.session_state.clicked:
                allowed_types = ["pdf","doc","txt"]

                attachment_selected = st.file_uploader("Upload a file", type=allowed_types)
                print(attachment_selected)```

I don’t see a dropdown when I click the button.

@Aryan_Gupta could you do a screen recording of the issue. I cant replicate it.

@CarlosSerrano @Goyo

import streamlit as st

if 'clicked' not in st.session_state:
    st.session_state.clicked = False

def set_clicked():
    st.session_state.clicked = True

st.button('Upload File', on_click=set_clicked)
if st.session_state.clicked:
    uploaded_file = st.file_uploader("Choose a file")
    print(uploaded_file)
    if uploaded_file is not None:
        # print(uploaded_file)
        st.write("You selected the file:", uploaded_file.name)

Check this out!
When you click Upload File button, you will see a drop-down as Browse files, I want to completely remove it.
So when the user clicks on that button, a screen will pop up to choose the file menu.
Is that possible?

@Aryan_Gupta I ran your code, where is the select_box you mention?

Could you post a screenshot of your result?

Thanks,

@CarlosSerrano
I’m talking about that same box which appeared when you click that Upload File button.
ss

This box!
Can we just remove this entirely?

That is the file uploader component.

And we can’t remove it?
Or minimize it

You want to remove the Browse files button? Or the complete file uploader? But then why are you calling file_uploader()?

I want that functionality but not the entire box.
And I think that it’s not possible.

The functionality consists on being able to drag and drop a file to the box or click the button to select files. If you remove the box and the button, there is no functionality left.

Okay
Got it!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.