Changing or adding attributes to resulting elements

Hi everybody, I have a general question rather than a specific problem. Is it possible (through the use of provided attributes/arguments or through altering the source code of bokeh) to change or add attributes of the various html elements that bokeh spits out? For instance, if I have a Button widget/model, is it possible to, in Bokeh, make it so the resulting button html element can have a given class? Or an additional arbitrary attribute such as “data-toggle” or something of that nature?

I ask because I’m finding myself doing a lot of css and javascript trickery after the fact to alter the elements that bokeh spits out, and it would be much easier to simply spit out what I want from the get go.

If it matters, I am exclusively working with a bokeh server, rather than outputting static pages.

Thanks for any insight!

Jeremy

You can add arbitrary css classes to LayoutDOM subclasses by setting the css_classes property:

  layouts — Bokeh 3.3.2 Documentation

Thanks,

Bryan

···

On Feb 28, 2017, at 18:13, Jeremy Bowyer <[email protected]> wrote:

Hi everybody, I have a general question rather than a specific problem. Is it possible (through the use of provided attributes/arguments or through altering the source code of bokeh) to change or add attributes of the various html elements that bokeh spits out? For instance, if I have a Button widget/model, is it possible to, in Bokeh, make it so the resulting button html element can have a given class? Or an additional arbitrary attribute such as "data-toggle" or something of that nature?

I ask because I'm finding myself doing a lot of css and javascript trickery after the fact to alter the elements that bokeh spits out, and it would be much easier to simply spit out what I want from the get go.

If it matters, I am exclusively working with a bokeh server, rather than outputting static pages.

Thanks for any insight!

Jeremy

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9d0515c8-5940-48a8-9c86-f6b0a1c3b8d2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Great, thank you for the help. I assume this means that only classes can be added, no other attributes?

···

On Tuesday, February 28, 2017 at 7:50:50 PM UTC-5, Bryan Van de ven wrote:

You can add arbitrary css classes to LayoutDOM subclasses by setting the css_classes property:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/layouts.html#bokeh.models.layouts.LayoutDOM.css_classes](http://bokeh.pydata.org/en/latest/docs/reference/models/layouts.html#bokeh.models.layouts.LayoutDOM.css_classes)

Thanks,

Bryan

On Feb 28, 2017, at 18:13, Jeremy Bowyer [email protected] wrote:

Hi everybody, I have a general question rather than a specific problem. Is it possible (through the use of provided attributes/arguments or through altering the source code of bokeh) to change or add attributes of the various html elements that bokeh spits out? For instance, if I have a Button widget/model, is it possible to, in Bokeh, make it so the resulting button html element can have a given class? Or an additional arbitrary attribute such as “data-toggle” or something of that nature?

I ask because I’m finding myself doing a lot of css and javascript trickery after the fact to alter the elements that bokeh spits out, and it would be much easier to simply spit out what I want from the get go.

If it matters, I am exclusively working with a bokeh server, rather than outputting static pages.

Thanks for any insight!

Jeremy


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9d0515c8-5940-48a8-9c86-f6b0a1c3b8d2%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Currently yes, it might be possible to add that functionality but it would represent new development, so a feature request on GitHub would be appropriate.

Thanks,

Bryan

···

On Feb 28, 2017, at 19:28, Jeremy Bowyer <[email protected]> wrote:

Great, thank you for the help. I assume this means that only classes can be added, no other attributes?

On Tuesday, February 28, 2017 at 7:50:50 PM UTC-5, Bryan Van de ven wrote:
You can add arbitrary css classes to LayoutDOM subclasses by setting the css_classes property:

        layouts — Bokeh 3.3.2 Documentation

Thanks,

Bryan

> On Feb 28, 2017, at 18:13, Jeremy Bowyer <[email protected]> wrote:
>
> Hi everybody, I have a general question rather than a specific problem. Is it possible (through the use of provided attributes/arguments or through altering the source code of bokeh) to change or add attributes of the various html elements that bokeh spits out? For instance, if I have a Button widget/model, is it possible to, in Bokeh, make it so the resulting button html element can have a given class? Or an additional arbitrary attribute such as "data-toggle" or something of that nature?
>
> I ask because I'm finding myself doing a lot of css and javascript trickery after the fact to alter the elements that bokeh spits out, and it would be much easier to simply spit out what I want from the get go.
>
> If it matters, I am exclusively working with a bokeh server, rather than outputting static pages.
>
> Thanks for any insight!
>
> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9d0515c8-5940-48a8-9c86-f6b0a1c3b8d2%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f3237b6e-7788-406b-82a0-9b35cf1c1183%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.