☰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

Can a CustomAction be initialized as active?

Community Support
roinr
roinr

Plot tools have this blue line on their left side to indicate they’re active.
I was wondering if there’s a way to initialize a CustomAction so it will have the bk-active class and display this blue line. I tried using the css_classes property but apparently CustomAction doesn’t have it.

⌁   Link to post
Bryan
Bryan

Actions do not have any notion of “active”. They are buttons that can be clicked, and when they are clicked an action happens. There is no persistent state associated with them at all. If you want or need a tool to reflect some kind of state, then an Action is not what you want.

⌁   Link to post
Bryan
Bryan

@roinr Maybe? Actions are intended to be fire-and-forget. It’s definitely 100% against the intended design and purpose of CustomAction for their toolbar buttons to reflect any kind of “active” state whatsoever, so I’m afraid you are more or less on your own trying to make this happen. The proper solution would be to implement a different kind of tool as a custom extension.

⌁   Link to post
roinr
roinr

@Bryan But it’s not really a state it’s just a class name that I add to my “widget”. The fact that I can use a JS callback to toggle this class name shouldn’t matter.
Anyways, I guess for now I can still make it work if I decide that the initial state is “inactive”. Once the user clicks the action button a JS callback can toggle the “bk-active” class name.
Thanks!

⌁   Link to post

End of archived discussion · Replies are disabled