Fomantic-ui: Diffrent styling for the slider module

Created on 31 Jul 2020  路  8Comments  路  Source: fomantic/Fomantic-UI

Feature Request

I am using the slider module and it works perfectly and I wonder if there is any way to change the position of the labels being displayed on the slider.

For example, I want something like this:
request

And we have this:
given

I have tried some modifications at one of my demo servers and here is the link to the page.

having

On the page, I have a filter slider named SYMM. which has a Very Good label, and unfortunately, my CSS skill is not so good that's why it been overlapped by the slider nodes.

So to avoid my confusing CSS codes I like to ask if there is any way to have the slider as I want?

lancss typusage

Most helpful comment

Couldn't we add a class to the labels to allow them to appear above or below the slider, rather than using override?

Something like .labels.bottom.aligned? Could we also potentially apply to a label itself, so the labels could potentially rotate (if wanted) to be above or below, eg .labels .label.bottom.aligned (top/above alignment could be default for comparability)

All 8 comments

You can override as following in slider.overrides:

.ui.labeled.slider > .labels .label {
    display: inline-flex;
    position: absolute;
    transform: translate(-50%, -100%);
    white-space: nowrap;
}

Here's the overrides for slider in default theme (https://github.com/fomantic/Fomantic-UI/blob/develop/src/themes/default/modules/slider.overrides).

Here's the result with white-space: nowrap.
FUI

Of course, long label is not good to use when you've too many options with narrow spaces between them.

@ko2in , Thank you for the fast reply.

I will try this one and update you by tomorrow morning.

Once again, thanks.

I think adding this variation to FUI is valuable, since long text labels like this poll seem very common use case.

Yes. It sounds reasonable. Will you prepare PR? Or should I submit this?

Couldn't we add a class to the labels to allow them to appear above or below the slider, rather than using override?

Something like .labels.bottom.aligned? Could we also potentially apply to a label itself, so the labels could potentially rotate (if wanted) to be above or below, eg .labels .label.bottom.aligned (top/above alignment could be default for comparability)

@jamessampford The class for aligning the label at either top or the bottom sounds an extremely good idea and that will be much easy for backend devs like me.

Thank you guys, that one fixed my issue and I wonder if there is some way to avoid CSS of other libraries being effecting the CSS of the FU/SU.

Anyway, you guys were helpful, and adding PR will surely helpful to others in the future.

Implemented by #1631

Was this page helpful?
0 / 5 - 0 ratings

Related issues

murbanowicz picture murbanowicz  路  5Comments

jamessampford picture jamessampford  路  3Comments

kawaji picture kawaji  路  3Comments

GammaGames picture GammaGames  路  4Comments

Puspendert picture Puspendert  路  3Comments