🌹 Graz - George Design System stands in solidarity with the victims and families affected by the tragic school shooting in Graz. Our hearts go out to all those impacted by this senseless act of violence.

InputSlider Deprecated

Archived article

Sliders are required to have unique IDs and are ordinary range inputs of class .g-slider. The colour the left part will take is given via the data-color property:

Loading demo…

HINT The slider requires JavaScript to work, otherwise the coloured left area will not match the thumb (round thingy). A simple jQuery implementation would be:

jsfunction sliderColor(id) {
    const slider = $(`#${id}`);

    const defaultColor = '#f4f6fA';
    const color = slider.data('color') === undefined ? defaultColor : slider.data('color');

    const min = slider.prop('min');
    const max = slider.prop('max');
    const val = slider.val();

    let pct = (100.0 * (val - min)) / (max - min);
    pct = pct < 2 ? 2 : pct;
    pct = pct > 98 ? 98 : pct;

    const backgrounds = [
        `-moz-linear-gradient(left, ${color} 0%, ${color} ${pct}%, ${defaultColor} ${pct}%)`,
        `-webkit-linear-gradient(left, ${color} 0%, ${color} ${pct}%, ${defaultColor} ${pct}%)`,
        `-o-linear-gradient(left, ${color} 0%, ${color} ${pct}%, ${defaultColor} ${pct}%)`,
        `linear-gradient(left, ${color} 0%, ${color} ${pct}%, ${defaultColor} ${pct}%)`,
    ];

    $(`<style>#${id}::-moz-range-track             {background-image:${backgrounds[0]}}</style>`).appendTo('head');
    $(`<style>#${id}::-webkit-slider-runnable-track{background-image:${backgrounds[1]}}</style>`).appendTo('head');
    $(`<style>#${id}::-webkit-slider-runnable-track{background-image:${backgrounds[2]}}</style>`).appendTo('head');
    $(`<style>#${id}::-ms-fill-lower               {background:${color}}</style>`).appendTo('head');
}
$('.g-slider').on("change mousemove", () => { sliderColor( this.id ); }); // enable slider colors
$('.g-slider').trigger("change"); // set initial color
Rules For Designers
  • The slider’s bar covers 100% width, has a height of 6px, fully rounded corners and a 1px outline.
  • The slider’s thumb is a 28px circle featuring an 1px outline.
  • All outlines are colour $color-gray-200 (#e4eaf0), the thumb and the empty bar is filled using $color-gray-100 (#eef0f4).
  • The left/filled part of the slider is $color-blue-300 (#135ee2).
  • The legend below the slider is ordinary paragraph text. It has a spacing of 15px to the bar.