🤩
Windframe Import update is finally here!

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.

js
import { CDBSlider } from 'cdbreact';

Default Slider

js
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.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classes<CDBSlider className="myClass" ... />
valueNumber or StringSlider's value - useful for additional data binding and edge use-cases<CDBSlider value={49} ... />
tagStringdivChanges default input tag<CDBSlider tag="input" ... />
disableBooleanfalseDisables Slider component<CDBSlider disabled .../>
minNumber0Sets the lowest Slider's value<CDBSlider min={10} ... />
maxNumber100Sets the highest Slider's value<CDBSlider max={70} ... />
stepNumber1Specifies the interval between valid values in a number-based input.<CDBSlider step={0.1} ... />
sizeStringChanges size of slider component. Choose from lg and sm<CDBSlider size="sm" ... />
variantStringdarkChanges default slider color; available values: [blue, red, teal, dark-grey, dark, blue-grey, amber, purple]<CDBSlider variant="red" ... />
onChangefunctionReturns slider value, on onChange event<CDBSlider onChange={handleChange} ... />
onAfterChangefunctionexecutes a function after Change event<CDBSlider onAfterChange={handleAfterChange} ... />
tooltipStringDisplays the current value of the slider. Can choose from auto, on or off<CDBSlider tooltip="on" ... />
tooltipPlacementStringSelects where to place tooltip. Can choose from top or bottom<CDBSlider tooltipPlacement="top" ... />
tooltipLabelfunctionSets the label of the tooltip<CDBSlider tooltipLabel={yourFunction} ... />
tooltipStyleObjectCustomize 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

ad-banner

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