Can i change the layout when i click a button?
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.
2022-11-04T04:47:33Z
You can change the visibility of a row by returninggr.update(visible=True)orgr.update(visible=False)and assign the output to be a Row
2023-07-27T21:08:50Z
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.
2023-07-30T04:36:24Z
Hi@miguelwonyes 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 anelem_idand target it using custom css, as described here:Custom CSS And JS
2023-07-30T07:42:11Z
Hi and thanks for the reply.Sorry, I was not very clear. I want to know if I can update it dynamically.
2023-07-30T08:01:18Z
Hi@miguelwonyou can update properties of agr.Button()component by returninggr.Button.update(...)from your function, as described here:Gradio update DocsSo there are two possibilities here:You could update thevariantproperty, which (in the default theme) changes the color (from gold ifvariantisprimary, gray ifsecondary, red ifstop)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.