• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

Slider

Slider is used to provide input in various ways.

Slider Tag Documentation

Slider is used to provide input with various customization options like orientation, display modes and skinning.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
animate boolean false true Boolean value to enable/disable the animated move when background of slider is clicked.
converter Converter false EL expression resolves to a converter instance or literal converter ID defining a component converter.
converterMessage String false
disabled boolean false false Disables or enables the component.
display String false Id of the component to display the slider value.
displayTemplate String false String template to use when updating the display. Valid placeholders are {value}, {min} and {max}.
for String false Id of the input text that the slider will be used for.
immediate boolean false false When set true, process validations logic is executed at apply request values phase for this component.
maxValue double false 100.0 Maximum value of the slider.
minValue double false 0.0 Minimum value of the slider.
onSlide String false Client side callback to execute during sliding.
onSlideEnd String false Client side callback to execute when slide ends.
onSlideStart String false Client side callback to execute when slide begins.
range String false min When set `true`, two handles are provided for selection a range. Another types `false` for disable range style and `max` for shows range handle to the slider max.
readonly boolean false false Flag indicating that this component will prevent changes by the user.
required boolean false false Marks component as required.
requiredMessage String false
step double false 1.0 Fixed pixel increments that the slider move in.
style String false Inline style of the component.
styleClass String false Style class of the component.
submittedValue Object false
touchable Boolean false Enable touch if supported by device. NULL uses global default or primefaces.TOUCHABLE. Default: globally enabled.
type String false horizontal Sets the type of the slider, "horizontal" or "vertical".
validator Validator false A method expression referring to a method validating the input.
validatorMessage String false
value Object false Value of the component.
valueChangeListener ValueChangeListener false A method binding expression referring to a method for handling a valuchangeevent.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc
Basic
Basic Min Range
Basic Max Range
InputText Slider with Decimal Value
InputNumber Slider
Spinner Slider
Hidden Input Slider with Display Value
Set ratio to %0.2
Slider with Step Factor
Vertical Slider
Ajax Slider
Range Slider
Between 30 and 80

Usage


<div class="card">
    <h:form>
        <p:growl id="growl" showDetail="true"/>

        <h5 class="mt-0">Basic</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="txt" value="#{sliderView.number1}"/>
            <p:slider for="txt" range="false"/>
        </h:panelGrid>

        <h5 class="mt-0">Basic Min Range</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="sliderTxtMin" value="#{sliderView.number1}"/>
            <p:slider for="sliderTxtMin"/>
        </h:panelGrid>

        <h5 class="mt-0">Basic Max Range</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="sliderTxtMax" value="#{sliderView.number1}"/>
            <p:slider for="sliderTxtMax" range="max"/>
        </h:panelGrid>

        <h5>InputText Slider with Decimal Value </h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="decimal" value="#{sliderView.number2}"/>
            <p:slider for="decimal" minValue="0.2" maxValue="7.1" step="0.1" range="max"/>
        </h:panelGrid>

        <h5>InputNumber Slider</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputNumber id="nmb1" value="#{sliderView.number3}" symbol=" €"
                           valueChangeListener="#{sliderView.onInputChanged}">
                <p:ajax process="@this" update="growl"/>
            </p:inputNumber>
            <p:slider for="nmb1"/>
        </h:panelGrid>

        <h5>Spinner Slider</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:spinner id="spinner1" value="#{sliderView.number3}" min="0" max="1000" stepFactor="50"
                       suffix=" €" valueChangeListener="#{sliderView.onInputChanged}">
                <p:ajax process="@this" update="growl"/>
            </p:spinner>
            <p:slider for="spinner1" minValue="0" maxValue="1000" step="50"/>
        </h:panelGrid>

        <h5>Hidden Input Slider with Display Value</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <h:outputText id="output" value="Set ratio to %#{sliderView.number2}"/>
            <h:inputHidden id="txt2" value="#{sliderView.number4}"/>
            <p:slider for="txt2" display="output" style="width: 200px" displayTemplate="Set ratio to %{value}"/>
        </h:panelGrid>

        <h5>Slider with Step Factor</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="txt3" value="#{sliderView.number5}"/>
            <p:slider for="txt3" step="10" maxValue="70"/>
        </h:panelGrid>

        <h5>Vertical Slider</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="txt4" value="#{sliderView.number6}"/>
            <p:slider for="txt4" type="vertical"/>
        </h:panelGrid>

        <h5>Ajax Slider</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <p:inputText id="txt5" value="#{sliderView.number7}"/>
            <p:slider for="txt5">
                <p:ajax event="slideEnd" listener="#{sliderView.onSlideEnd}" update="growl"/>
            </p:slider>
        </h:panelGrid>

        <h5>Range Slider</h5>
        <h:panelGrid columns="1" style="margin-bottom: 10px">
            <h:outputText id="displayRange" value="Between #{sliderView.number8} and #{sliderView.number9}"/>
            <p:slider for="txt6,txt7" display="displayRange" style="width: 400px" range="true"
                      displayTemplate="Between {min} and {max}"/>
        </h:panelGrid>
        <h:inputHidden id="txt6" value="#{sliderView.number8}"/>
        <h:inputHidden id="txt7" value="#{sliderView.number9}"/>
    </h:form>
</div>