Slider
Sliders are particularly useful for adjusting settings where there is a range of values to choose from, such as volume controls, brightness controls, or applying image filters like contrast or saturation. By dragging the slider handle, users can easily and intuitively set the desired value within the available range.
Let's take a closer look at each subcomponent and explore the various functionalities they offer.
Slider
: serves as the wrapper that provides context and functionality for all the other subcomponents. It acts as the parent container for the slider interface.SliderTrack
: represents the empty part of the slider that shows the track. It acts as a container for the SliderFilledTrack component.SliderFilledTrack
: represents the filled part of the slider, indicating the selected value. It is a child component of SliderTrack.SliderThumb
: the handle used to change the slider value. Users can click and drag the thumb along the track to select a specific value. It is a child component of Slider.SliderMark
: represents labels or marks that show names for specific slider values. It can be used to provide additional context or visual cues to the user.These components can be imported as follows:
Examples
Basic Usage
Code
Customizing the Color Scheme
colorScheme="whiteAlpha"
colorScheme="blackAlpha"
colorScheme="gray"
colorScheme="red"
colorScheme="orange"
colorScheme="yellow"
colorScheme="green"
colorScheme="teal"
colorScheme="blue"
colorScheme="cyan"
colorScheme="purple"
colorScheme="pink"
colorScheme="linkedin"
colorScheme="facebook"
colorScheme="messenger"
colorScheme="whatsapp"
colorScheme="twitter"
colorScheme="telegram"
Code
Slider Orientation
Code
Slider Customization
Code
Discrete Sliders
Code
Custom Labels
Inside the Slider component, there are four SliderMark components used as custom labels and marks. Additionally, there is a SliderMark component with dynamic content to display the current value of the slider. It uses the sliderValue state variable as thevalue prop, displaying the current value dynamically.
Code
Using Tooltip
Code
Did you know?
Creative Idea No. 1
Code
Creative Idea No. 2
Code
Creative Idea No. 3
Code
copyright © 2023 IHeartComponents | evanmarie.com
created with love by the I♥️Components team using
Special thanks to Stefan Bohacek / Generative Placeholders.