Slider
React Bootstrap 5 Slider
The React Bootstrap 5 Slider is a component that allows users to choose a value from a set of options on a sliding bar. The React Bootstrap 5 Slider simplifies controlling the volume of sound on a video or the progress of a video you're watching extremely simpler.
Applications of a React Bootstrap 5 slider:
- Brightness
- Volume increase/decrease
- Video Progression.
Importing the React Bootstrap 5 Slider Component
Import CDBSlider
into your project to use the Contrast React Bootstrap 5 Slider component.
import { CDBSlider } from 'cdbreact';
Default Slider
import React from 'react';import { CDBSlider, CDBContainer } from 'cdbreact';
const Slider = () => { return ( <CDBContainer> <CDBSlider value={value} setValue={setValue} style={{ width: '100%' }} /> </CDBContainer> );};export default Slider;
API Reference: Contrast React Bootstrap 5 Slider Props
This section will elaborate on the props available with the React Bootstrap 5 Slider component. You'll learn what these props do, how to use them, and what their default values are.
Other CDBSlider
prop options are included in the table below.
Name | Type | Default | Description | Example |
---|---|---|---|---|
className | String | Adds custom classes | <CDBSlider className="myClass" ... /> | |
value | Number or String | Slider's value - useful for additional data binding and edge use-cases | <CDBSlider value={49} ... /> | |
tag | String | div | Changes default input tag | <CDBSlider tag="input" ... /> |
disable | Boolean | false | Disables Slider component | <CDBSlider disabled .../> |
min | Number | 0 | Sets the lowest Slider's value | <CDBSlider min={10} ... /> |
max | Number | 100 | Sets the highest Slider's value | <CDBSlider max={70} ... /> |
step | Number | 1 | Specifies the interval between valid values in a number-based input. | <CDBSlider step={0.1} ... /> |
size | String | Changes size of slider component. Choose from lg and sm | <CDBSlider size="sm" ... /> | |
variant | String | dark | Changes default slider color; available values: [blue, red, teal, dark-grey, dark, blue-grey, amber, purple] | <CDBSlider variant="red" ... /> |
onChange | function | Returns slider value, on onChange event | <CDBSlider onChange={handleChange} ... /> | |
onAfterChange | function | executes a function after Change event | <CDBSlider onAfterChange={handleAfterChange} ... /> | |
tooltip | String | Displays the current value of the slider. Can choose from auto , on or off | <CDBSlider tooltip="on" ... /> | |
tooltipPlacement | String | Selects where to place tooltip. Can choose from top or bottom | <CDBSlider tooltipPlacement="top" ... /> | |
tooltipLabel | function | Sets the label of the tooltip | <CDBSlider tooltipLabel={yourFunction} ... /> | |
tooltipStyle | Object | Customize the style of the tooltip | <CDBSlider tooltipStyle={{ color: "red"}} ... /> |
Trying to build out all user interfaces and components for your website or web app from scratch can become a very tedious task. A huge reason why we created Contrast Bootstrap to help reduce the amount of time we spend doing that, so we can focus on building some other aspects of the project. Contrast Bootstrap PRO consists of a UI Kit featuring over 10000+ component variants. Together with a template of 5 admin dashboards and 23+ additional multipurpose pages template for building almost any type of website or web app. You can view a demo and learn more about Contrast by clicking here.Download the free react template

Contrast Bootstrap PRO was built using the most popular CSS framework Bootstrap to help build your next landing, admin SAAS, prelaunch etc project with a clean, prebuilt and well documented template and UI components.Learn more about Contrast