☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Hiding a button without removing it from layout

Community Support
Maxxner
Maxxner

Bokeh offers the .visible = False functionality to hide a button. However this essentially means that the button is removed from the layout which triggers the compute layout function.

In my case I’d like to keep the layout but instead display the background at the same position. Is there an easy way to achieve this?

⌁   Link to post
Maxxner
Maxxner

Unfortunately the disabled button is not an option for me as this functionality is already reserved for actually triggering the button.

I’d like to mention that in HTML both functionality exist.

visibility="hidden"

(what I need)

display="none"

(what is currently supported, representing visibility=False)

⌁   Link to post
_jm
_jm

If the efficiency of computing the layout is a concern, I cannot offer a workaround unfortunately.

However, if you are concerned only with preserving the placement of objects on the page, you could have the button and a spacer share the same real-estate by making their visible properties the negation of one another. (I have used similar logic to achieve dynamic layouts in prior bokeh apps and the time involved in re-layout was generally acceptable for my cases.)

⌁   Link to post
Maxxner
Maxxner

Layout computing is my only concern unfortunately (complex layout with many plots).

For consistent placements I have already played around with empty divs which works fine and is similar to your proposal.

⌁   Link to post
_jm
_jm

I see.

I had issues with complex layouts with many plots a few years ago in scenarios where I did not expect redraw operations to occur.

See my following discourse topic and the solution I implemented to workaround it as the last post in the thread. No guarantee it will address your particular use-case, but it is at least passingly relevant.

⌁   Link to post

End of archived discussion · Replies are disabled