Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the background color of an action button?

I have a Shiny for Python app with some buttons. I want to change the color of a button. How can I do this?

from shiny.express import ui

with ui.layout_columns():
    ui.input_action_button("red_button", "Make this button red!")
    ui.input_action_button("blue_button", "Make this button blue!")
like image 237
Redz Avatar asked Oct 24 '25 03:10

Redz


1 Answers

You can pass a style attribute and set the background-color:

from shiny.express import ui

with ui.layout_columns():
    ui.input_action_button(
        "red_button", 
        "Make this button red!", 
        style = "background-color: red;"
    )
    ui.input_action_button(
        "blue_button", 
        "Make this button blue!",
        style = "background-color: lightblue;"
    )

enter image description here

like image 117
Jan Avatar answered Oct 27 '25 02:10

Jan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!