☰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

Bokeh Div add onclick event

Community Support
gabylange31
gabylange31

Hello everyone,

I’ve been trying for a while to add an onclick event to a bokeh Div widget in order to raise a callback. However, it’s not possible to do it since it’s not natively defined.

I also tried to create a “Custom” class from Div to add the on-click event but I didn’t succeed either.

If you have any suggestions, I’m interested…

Thank you in advance.

⌁   Link to post
p-himik
p-himik

Are you 100% sure that having a clickable div is a good idea in your case? Is there really a good reason to not just use a Button?

For reference, this question has been asked many times before. Just the first 3 from Discourse that I found:

The answer is the same every time - either use a Button or create a custom model that doesn’t require Bokeh events to know that a user has clicked on it. For an example, take a look at how AbstractButtonView.render is implemented - it uses a regular JS event to know when the button is clicked.

⌁   Link to post

End of archived discussion · Replies are disabled