8
Components

Slider

A customizable and accessible slider component for selecting values.

Introduction

The Slider component is a customizable range selector built with Radix Slider. It allows users to pick a single or range of values using an intuitive sliding handle.


Example: Simple Slider


Installation

Install the slider component:

npx axionjs-ui add slider

File Structure

slider.tsx

Prop Types

PropTypeDefault
defaultValue
number[]
-
max
number
-
step
number
-
className
string
-
otherProps
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
-

Features

  • Customizable Styles:
    • Easily style the slider using utility classes.
  • Single or Range Values:
    • Configure the slider for single or multiple value selection.
  • Keyboard Accessibility:
    • Fully navigable via keyboard controls for inclusive user experiences.

Accessibility

  • Keyboard Support:
    • Navigate and select values using arrow keys.
  • ARIA Attributes:
    • Properly labeled for assistive technologies.
  • Screen Reader Support:
    • Compatible with screen readers for accessibility compliance.

Conclusion

The Slider component is a powerful and flexible tool for implementing range selectors in your application. Its customizable and accessible design ensures a seamless experience for all users.

On this page