import gradio as gr advanced_button = gr.Button("Advanced options", elem_id="advanced-btn") css = ''' #advanced-options {display: none} ''' block = gr.Blocks(css=css) with block: advanced_button = gr.Button("Advanced options", elem_id="advanced-btn") with gr.Row(elem_id="advanced-options"): samples = gr.Slider(label="Images", minimum=1, maximum=4, value=3, step=1) advanced_button.click( None, [], [], _js=""" () => { const options = document.querySelector("body > gradio-app").shadowRoot.querySelector("#advanced-options"); options.style.display = ["none", ""].includes(options.style.display) ? "flex" : "none"; }""", ) block.launch()