export const title = "Slider components" export const description = "Free and open-source React slider components built for modern applications and websites. These sliders are built using React Aria and styled with Tailwind CSS." export const links = { github: "https://github.com/untitleduico/react/tree/main/components/base/slider", rac: "https://react-spectrum.adobe.com/react-aria/Slider.html" } import * as Demos from "@/components/base/slider/slider.demo.tsx";
## Installation You can add this slider component using our CLI or manually: ```bash npx untitledui@latest add slider ``` Copy the files below into your project: Great! Now you can start using the slider components in your project by just copy/pasting our examples below. ## Slider examples Below are examples and variations of this slider component: ### Default {{ tocOnly:true }}
### Bottom label {{ tocOnly:true }}
### Top floating {{ tocOnly:true }}
### Single thumb {{ tocOnly:true }}
## API reference \"$\" + value}`.", }, { question: "How do I set the minimum, maximum and step?", answer: "Use React Aria's `minValue`, `maxValue` and `step` props. `minValue` defaults to `0` and `maxValue` defaults to `100`.", }, { question: "How do I control the slider value?", answer: "Pass `value` and `onChange` for controlled state, or `defaultValue` for uncontrolled state. For a range slider, both are arrays. Use `onChangeEnd` if you only need the final value after the user stops dragging.", }, { question: "Can I use the slider with a keyboard?", answer: "Yes. Each thumb is focusable with Tab and shows a focus ring. The arrow keys move the focused thumb by `step`, Page Up and Page Down move it in larger increments, and Home and End jump to its minimum or maximum. In a range slider, a thumb can't move past the other thumb.", }, ]} />