react-input-range icon indicating copy to clipboard operation
react-input-range copied to clipboard

Ability to style min/max slider handles differently

Open jedrichards opened this issue 7 years ago • 6 comments

Would you be open to a PR that added some additional classnames onto the slider handles that enabled the min/max handles to be styled differently?

E.g., at https://github.com/davidchin/react-input-range/blob/master/src/js/input-range/slider.jsx#L258

className={this.props.classNames.slider + ' ' + this.props.classNames.minSlider}

We need this feature for a commercial project, so could cook up a PR quite swiftly if you're open to it.

jedrichards avatar Mar 10 '17 17:03 jedrichards

You can do it by using CSS with the first-of-type tag.

.input-range__track .input-range__slider-container:first-of-type .input-range__slider{

cedricve avatar Mar 31 '17 08:03 cedricve

Ah thanks. Yes, we're doing a similar workaround at the moment.

It would be easier/better to have a single dedicated classname though, since complex selectors and pseudo-classes like :first-of-type etc. are brittle and not resilient to structural DOM changes.

Would be happy to put together a PR. Or else feel free to close, since there are workarounds.

jedrichards avatar Mar 31 '17 09:03 jedrichards

True, if we have time to implement it. But I can live with the first-of-type solution for my specific situation.

cedricve avatar Mar 31 '17 09:03 cedricve

I think passing custom Label and Track components into the main component would accomplish this and any other customization that the users might dream of. I'd like the handles to show the value only when it's being dragged, but, alas, it doesn't seem to be possible currently.

guncha avatar Dec 20 '17 23:12 guncha

i want to be able to use slider one in multiple instances. but when I do so, each slider moves at the same time.

jamesnewman12 avatar Jun 24 '18 19:06 jamesnewman12

It cannot with with first of type, because last clicked handle is a last children.

tomasztomys avatar Jul 13 '20 18:07 tomasztomys