for example, I whould like to add a row or change some other layout of the frame when i click a button. how can i do this operation.
You can change the visibility of a row by returning
gr.update(visible=False) and assign the output to be a Row
Hi @abidlabs. Do you know if I can update the css (of the block element)? I’m trying to update the color of a button.
Hi @miguelwon yes you can change the color of buttons in your Gradio app using either themes or custom css.
If you’d like to change the color of buttons throughout your entire app, you should create a custom theme, it’s pretty easy using gradio’s built-in theme editor: Theming Guide.
If you’d like to change the color of a specific button, you can assign it an
elem_idand target it using custom css, as described here: Custom CSS And JS
Hi and thanks for the reply.
Sorry, I was not very clear. I want to know if I can update it dynamically.
So there are two possibilities here:
- You could update the
variantproperty, which (in the default theme) changes the color (from gold if
primary, gray if
secondary, red if
- You could create two different buttons, style them as you want, and then toggle the visibility of the buttons from your function which would make it appear as if the color has changed.