Material-ui: [Slider] Reverse Slider

Created on 28 Aug 2019  路  13Comments  路  Source: mui-org/material-ui

This is actually duplicate of #763 which was closed without explanation
Business use case is when you want the values in the upper range of slider to be selected.
Something like this https://jqueryui.com/slider/#rangemax
I didn't find a way to override this through styling because the rail element is rendered over the whole width of the slider and track element is rendered over it making it impossible to specify opacity on it.

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 馃挕


Enable passing prop to slider (or make component style-able) to accommodate having darker part on the right side of the selection

Examples 馃寛

https://jqueryui.com/slider/#rangemax

Motivation 馃敠

User can select the minimum interest rate to receive notification for. Interest rates go from 2-10% and you want to receive notification if the interest rate is in the range from slider value up to 10

Slider enhancement

Most helpful comment

track?: false | 'normal' | 'inverted'; 

?

All 13 comments

The range API of jQuery looks great. I think that we could implement it. We already have one part of the problem raised in #16631 (false)

range?: false | 'min' | 'max'; // (min as the current default)

@damir-sirola Would it be a problem that you are interested in solving in the core of the library?

range risks being confused as having something to do with the range slider. Perhaps:

track?: false | 'before' | 'after'; // ('before' as the current default)`

?

range risks being confused as having something to do with the range slider.

@mbrookes This is very true. No objection with the proposed alternative 馃憤.

I could give it a try. Any idea how the component should behave with range slider? Should it even be enabled then?

@damir-sirola I think that the prop should be ignored with a range slider. But then, I think that it means that we need to rethink the API.

Agreed, I don't think it makes sense for range to track outside area

Agreed, I don't think it makes sense for range to track outside area

Hum, maybe it does. What about the use case of a pass-band and stop-band filters?

Hmm, we'll need a better name for the prop then 馃檪

Back to our drawing board.

track?: false | 'normal' | 'inverted'; 

?

Hello

I'll push up a PR which might help with this.

I've added
track?: 'normal' | 'inverted'
which enables us to reverse the styling of the rail/track/marks.
I've used axisProps to return a different offset/leap, this solves any opacity issues.

With regards, #16631 (false) to only highlight the current mark.
You could not use this with 'inverted' option, so I assume this should be a separate prop ?

@slipmat The current proposal is as follows. Does it answer your question?

<Slider value={40} track="normal"

Capture d鈥檈虂cran 2019-10-03 a虁 11 18 01

<Slider value={40} track="inverted"

Capture d鈥檈虂cran 2019-10-03 a虁 11 18 51

<Slider value={40} track={false}

Capture d鈥檈虂cran 2019-10-03 a虁 11 17 27

<Slider value={[40, 50]} track="normal"

Capture d鈥檈虂cran 2019-10-03 a虁 11 18 30

<Slider value={[40, 50]} track="inverted"

Capture d鈥檈虂cran 2019-10-03 a虁 11 20 40

<Slider value={[40, 50]} track={false}

Capture d鈥檈虂cran 2019-10-03 a虁 11 19 40

Was this page helpful?
0 / 5 - 0 ratings

Related issues

celiao picture celiao  路  54Comments

chadobado picture chadobado  路  119Comments

illogikal picture illogikal  路  75Comments

gndplayground picture gndplayground  路  54Comments

NonameSLdev picture NonameSLdev  路  56Comments