Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast template theme not applied to vertical sliders #3003

Closed
TheoMathurin opened this issue Dec 10, 2021 · 2 comments · Fixed by #3045
Closed

Fast template theme not applied to vertical sliders #3003

TheoMathurin opened this issue Dec 10, 2021 · 2 comments · Fixed by #3045
Milestone

Comments

@TheoMathurin
Copy link
Contributor

TheoMathurin commented Dec 10, 2021

Panel 0.12.1

With Fast templates, the corresponding theme is not applied to sliders when the vertical orientation is set. The slider then has the default Bokeh appearance. I think all sliders are affected.

import panel as pn
import panel.widgets as pnw

horizontal = pnw.FloatSlider(name='Horizontal', value=0, step=0.05, start=0, end=1)
vertical = pnw.FloatSlider(name='Vertical', value=0, step=0.05, start=0, end=1, orientation='vertical')

template = pn.template.FastListTemplate(
    title="FastListTemplate",
    main=[horizontal, vertical]).servable()

image

@TheoMathurin TheoMathurin changed the title Fast template style not applied to vertical sliders Fast template theme not applied to vertical sliders Dec 10, 2021
@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Dec 27, 2021

Hi @TheoMathurin

You can use the below css as a workaround. I will make a PR with this.

import panel as pn
import panel.widgets as pnw

CSS = """
.bk-root .noUi-vertical {
  margin-top: 15px;
  width: calc(var(--track-width) * 1px);
  background-color: var(--neutral-outline-rest);
  border-radius: calc(var(--corner-radius) * 1px);
}
.bk-root .noUi-target.noUi-vertical {
    margin-top: 10px;
}
.bk-root .noUi-vertical .noUi-handle {
    border: none;
    width: 12px;
    height: 12px;
    background: var(--neutral-foreground-rest);
    border-radius: calc(var(--corner-radius) * 1px);
    box-shadow: none;
}
"""
pn.config.raw_css.clear()
pn.config.raw_css.append(CSS)
pn.extension()

horizontal = pnw.FloatSlider(name='Horizontal', value=0, step=0.05, start=0, end=1)
vertical = pnw.FloatSlider(name='Vertical', value=0, step=0.05, start=0, end=1, orientation='vertical')

template = pn.template.FastListTemplate(
    title="FastListTemplate",
    main=[horizontal, vertical]).servable()

image

@TheoMathurin
Copy link
Contributor Author

Thank you very much for the workaround and the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants