whoisandy / react-rangeslider

A lightweight responsive react range slider component.A fast & lightweight react component as a drop in replacement for HTML5 input range slider element.

Home Page:https://whoisandy.github.io/react-rangeslider/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Increase space between slider and labels

jzillmann opened this issue · comments

Following code:

<Slider
                             min={ 0 }
                             max={ 50 }
                             value={ value }
                             step={ 5 }
                             onChange={ this.changeValue.bind(this) }
                             labels={ { 0: '0%', 5: '5%', 10: '10%', 20: '20%', 50: '50%' } }
                             format={ (value) => value + '%' } />

produces the following slider:
slider

It can be seen live at http://jmh.morethan.io/#twoRunsExample

Now the question... How can i increase the space between slider and labels? It looks a bit off in case the slider knob is at a label...

Hi @jzillmann
You can easily increase the space between slider and labels by changing the top CSS property:

.rangeslider__label-list .rangeslider__label {
  position: absolute;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
  top: 35px; // change this property
}

@StefanFeser Thanks, works like a charm!