Skip to content
Discussion options

You must be logged in to vote

I think the easiest way to change such detailed styling is to add some custom CSS to the head HTML:

ui.add_head_html('''
<style>
    .q-btn:disabled {
        background-color: grey !important;
        opacity: 0.3 !important;
    }
</style>
''')
ui.button('Enabled')
ui.button('Disabled').disable()

To only affect individual buttons, you can introduce and address a custom class like "my-button":

ui.add_head_html('''
<style>
    .my-button:disabled {
        background-color: grey !important;
        opacity: 0.3 !important;
    }
</style>
''')
ui.button('Enabled').classes('my-button')
ui.button('Disabled').classes('my-button').disable()

Note that "!important" is needed in this case to over…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jeffective
Comment options

Answer selected by jeffective
Comment options

You must be logged in to vote
2 replies
@evnchn
Comment options

evnchn Jan 9, 2026
Collaborator

@falkoschindler
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants