> For the complete documentation index, see [llms.txt](https://voit.gitbook.io/voitdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://voit.gitbook.io/voitdocs/components/slider.md).

# Slider

Sliders allow users to adjust values within a specified range by dragging a handle along a track. They provide a quick and intuitive way to set values for inputs.

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FwmGunAhR73czd21Nsv6T%2FFrame%2045.png?alt=media&amp;token=3efb9318-1202-4ac5-89d6-01e4a6d87fa8" alt=""><figcaption></figcaption></figure>

## Overview

Sliders are ideal for visually representing and adjusting a continuous value, allowing for intuitive interaction within defined limits.

{% embed url="<https://www.figma.com/design/4NwKhd4dwRhRF5Zpiooi69/Components?node-id=2581-193082&t=0Thv0LIO2gFzE3eo-4>" %}

## When to use

* Use when you need to let users adjust a value smoothly, such as brightness or volume settings.&#x20;
* Best used when a range of values needs to be selected or modified within set limits.&#x20;
* Use when you want to display instant feedback to the user as they adjust the value along the slider.&#x20;
* Use when you need to allow the user to set a minimum and maximum range, such as setting price filters.

## When not to use

* Avoid sliders when the user needs to input a precise number, where a text input field is better.&#x20;
* Don’t use sliders for selecting distinct or predefined options, such as choosing a list of items.&#x20;
* Don’t use sliders when there is an overwhelming range of values that may cause the user difficulty in making fine adjustments.&#x20;
* Avoid using sliders when screen space is limited and fine adjustments may be difficult to control.&#x20;
* Do not use a slider for static information display, such as showing a progress bar or indicator.

## Types

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FKxwjLncqy8OlEi70MIf9%2Ftype.png?alt=media&amp;token=70d3ad70-023d-4b64-9214-55fe46397a31" alt=""><figcaption></figcaption></figure>

## Anatomy

1. **Knob:** Draggable element that users move to set the value.&#x20;
2. **Selected Range:** Portion of the track that visually shows the selected value.&#x20;
3. **Track:** Visual bar that defines the full range of values.

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FdT2soDF85FfpU7BUSsgI%2Fanatomy.png?alt=media&amp;token=8d35dc8f-759a-4297-a4f4-7d308f94929f" alt=""><figcaption></figcaption></figure>

## Styles

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FBHjzS4G5FvxzsqQl4Ko8%2Fstyles.png?alt=media&amp;token=26be1a95-8987-4e7e-a0b9-d440ce1fe13c" alt=""><figcaption></figcaption></figure>

## Slider Value

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2Fu4Fb80V4v3f2dAZvPFoj%2Fslider%20value.png?alt=media&amp;token=5e2429c5-426d-47ae-823a-a04104fba8fd" alt=""><figcaption></figcaption></figure>

## Size

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FlF9VFZXhUT32byy10QYH%2Fsize.png?alt=media&amp;token=aeb5dc13-3c04-4fae-a549-1971c0f536ac" alt=""><figcaption></figcaption></figure>

| Size      | Knob (px) | Track Height (px) |
| --------- | --------- | ----------------- |
| Small-16  | 16        | 16                |
| Medium-18 | 16        | 18                |
| Large-24  | 20        | 24                |

## Accessibility

* **Keyboard Accessibility:** Sliders should be operable via keyboard inputs, with users able to increment or decrement values using arrow keys or step controls.&#x20;
* **Visible Focus States:** Ensure that sliders have a clear focus state to aid in keyboard navigation for users relying on assistive technologies.&#x20;
* **Value Labels and Feedback:** Always provide textual or numerical feedback near the slider to clearly communicate the value as it changes.&#x20;
* **Adjustable Step Intervals:** Provide step-based control for users who may need to make more precise adjustments, making sure each step is clearly defined.&#x20;
* **Clear Visual Indicators:** Ensure both the handle and track of the slider are easily distinguishable for users with visual impairments.

## Example

* **Volume Control:** A slider used to adjust audio output levels on a media player.&#x20;
* **Brightness Adjustment:** Used for modifying screen brightness or lighting intensity in settings menus.&#x20;
* **Range Selector for Price Filter:** A dual-handle slider used to set a minimum and maximum price range on e-commerce websites.&#x20;
* **Zoom Controls:** For applications where users need to zoom in or out, like maps or photo editors.&#x20;
* **Time Range in Video Playback:** Allows users to select a start and end time for trimming a video or audio clip.
