Formatting button and tabs when using components() function

Hi, I know I can format buttons and tags in a bokeh app, for example by having a styles.css file that looks like this:

.custom_button .bk-btn-group button {
    font-family: “Georgia”;
    font-size: 0.9vw;
    background: #104b1f;
    border: none;
}

And referencing that in the main.py file with:

Button(label="Download data", button_type="primary", aspect_ratio=1, css_classes=['custom_button'])

But how can I apply that same formatting if I want to output the file using:

script, div = components()

I’ve tried various ways, like including this in the python file, but haven’t found a solution.

css_classes = '''
<style>
.custom_button .bk-btn-group button {
    font-family: “Georgia”;
    font-size: 0.9vw;
    background: #104b1f;
    border: none;
}

 </style>'''

Thanks

If you are using components then you must embedding in an HTML template? You should include the styles in the template.

Thanks. That helped me figure it out.

1 Like