lara-light-indigo

Slider

Slider is a component to provide input using dragging of a handle.

Basic:
Input: 50
Step: 20
Decimal Step: 30.5
Range: [20, 80]
Vertical: 50
Import via Module

import { Slider } from 'primereact/slider';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/slider/slider.min.js"></script>
 
Getting Started

Slider is used as a controlled input with value and onChange properties.


<Slider value={value} onChange={(e) => setValue(e.value)} />
 
Range

Range slider provides two handles to define two values. Enable range property and bind an array to implement a range slider.


<Slider value={rangeValues} onChange={(e) => setRangeValues(e.value)} range />
 
Orientation

Default layout of slider is horizontal, use orientation property for the alternative vertical mode.


<Slider value={value} onChange={(e) => setValue(e.value)} orientation="vertical" />
 
Properties
NameTypeDefaultDescription
idstringnullUnique identifier of the element.
valuenumber0Value of the component.
animatebooleanfalseWhen enabled, displays an animation on click of the slider bar.
minnumber0Mininum boundary value.
maxnumber100Maximum boundary value.
orientationstringhorizontalOrientation of the slider, valid values are horizontal and vertical.
stepnumber1Step factor to increment/decrement the value.
rangebooleanfalseWhen speficed, allows two boundary values to be picked.
stylestringnullInline style of the component.
classNamestringnullStyle class of the element.
disabledbooleanfalseWhen present, it specifies that the component should be disabled.
tabIndexnumbernullIndex of the element in tabbing order.
ariaLabelledBystringnullEstablishes relationships between the component and label(s) where its value should be one or more element IDs.
Events
NameParametersDescription
onChangeevent.originalEvent: Slide event
event.value: New value.
Callback to invoke on value change via slide.
onSlideEndevent.originalEvent: Slide event
event.value: New value.
Callback to invoke when slide ends.
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-sliderContainer element
p-slider-handleHandle element.
Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma