Slider: Styling the circular dots?

Created on 19 Jun 2017  ·  14Comments  ·  Source: react-component/slider

Hi,

My code for the slider looks like this:

<Slider.Range min={xMin} max={xMax} defaultValue={defaultValue} range={true} tipFormatter={this.tipFormatter} marks={marks} onAfterChange={this.setBrushValues} trackStyle={[{ backgroundColor: styles.color.main}]} />

But I can't change the colors of the dots, so I can't match the styling 100% to the rest of my page. Do you have any suggestions on what I should do? Thanks!

screen shot 2017-06-19 at 4 30 54 pm

Most helpful comment

handleStyle is the way to go but it dosen't change the :active pseudo class style

All 14 comments

use markStyle,please read the api doc and example.

I don't see any way to style the dot, only the mark text.

my mistake,use handleStyle https://github.com/react-component/slider/blob/master/examples/range.js#L144

do you feel the api doc in readme not describe very clear?

Hi,

I tried this:

<Slider.Range min={xMin} max={xMax} defaultValue={defaultValue} range={true} tipFormatter={this.tipFormatter} marks={marks} onAfterChange={this.setBrushValues} trackStyle={[{ backgroundColor: styles.color.main}]} handleStyle={[{ backgroundColor: 'yellow' }, { backgroundColor: 'gray' }, { backgroundColor: 'red' }]} />

And it only lets me style the big circles, not the small circles.

screen shot 2017-06-20 at 6 02 10 am

Also

<Slider.Range min={xMin} max={xMax} defaultValue={defaultValue} range={true} tipFormatter={this.tipFormatter} marks={marks} onAfterChange={this.setBrushValues} trackStyle={[{ backgroundColor: styles.color.main}]} handleStyle={[{ color: 'red' }, { backgroundColor: 'gray' } ]} />

Doesn't let me change the outside color of the big circles...

@raubreywhite
I can not understand what's your problem. The handleStyle will be applied to the handle props.style, so you can change what ever you like.

I need to change the color of the small blue circles (highlighted here). Also I need to change the handle's outline color (currently light blue).

screen shot 2017-06-20 at 4 28 08 pm

@raubreywhite see the Multi Range with custom track and handle style demo, http://react-component.github.io/slider/examples/range.html, code is at here.

The handleStyle api is a array of style object, so you can change any style you like.

If you still got problems... Please give a codepen demo to show me where you stuck in ,thanks.

I figured it out, I needed to overwrite your css with:

.rc-slider-dot-active {
border-color: #2196f3 !important;
}

Thank you! :-)

nope...

Override css is just one way.

What i say is https://github.com/react-component/slider/blob/master/examples/range.js#L142

 <Range count={3} 
  defaultValue={[20, 40, 60, 80]} 
  pushable
  handleStyle={[{ backgroundColor: 'yellow', borderColor: '#2196f3'  }, { backgroundColor: 'gray' }]}
/>

Yes, but that only colors the inside of the circles, not the outside. And it doesn't color the circles corresponding to the marks.

but that only colors the inside of the circles

Still get confused by you. handleStyle={[{ borderColor: '#2196f3' }] will change the border color.

And it doesn't color the circles corresponding to the marks.

The handleStyle[] will be applied to handle style follow the array index order.

handleStyle is the way to go but it dosen't change the :active pseudo class style

as @MaxiSantos mentioned can we get support to change styles of pseudo classes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ka7eh picture ka7eh  ·  6Comments

ihhha picture ihhha  ·  4Comments

gpinhey picture gpinhey  ·  6Comments

johnb8005 picture johnb8005  ·  6Comments

nmccrea-db picture nmccrea-db  ·  5Comments