useSlider() and useSliderState() for a Slider component
See original GitHub issueI’d like to implement useSlider()
for @react-aria and useSliderState()
for @react-stately. I believe the first step is to draft an RFC?
Before I get started, though, if folks from the Spectrum team had already thought about what the API would look like, it’d be very helpful to get a brain dump first!
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (12 by maintainers)
Top Results From Across the Web
useSliderState – React Stately
Provides state management for a slider component. Stores values for all thumbs, formats values for localization, and provides methods to update the position...
Read more >Unstyled React Slider component and hook - MUI Base
The useSlider hook lets you apply the functionality of a slider to a fully custom component. It returns props to be placed on...
Read more >React slider tutorial using react-slider - LogRocket Blog
Learn how to create different sliders using react-slider, a React headless component that's easy to build and customize.
Read more >useSlider – React Aria - NET
useSlider. Provides the behavior and accessibility implementation for a slider component representing one or more values.
Read more >Learn What is Reactjs Slider Component & How to Use It
map() function. import React, {useState} from 'react'. import './Slider.css'. import dataSlider from '.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi all! Finally got around to pulling together a draft PR for this 😄
You’ll find it in #809
I built the react-aria and react-stately hooks, and a few toy components using those hooks, and some Storybook stories, so we can get a feel for how the component interactions work, and what the DX is like in using these hooks.
@chungwu You’re close. I would use a
label
for thediv
withid="label"
and have itsfor
/htmlFor
attribute point to theid
attribute on the firstinput
, which could be assigned on the React component, but if not be generated internally. Eachinput
should havearia-labelledby="label THE-GENERATED-ID-FOR-THE-INPUT"
. So that the Min should announce as “label Minimum”, and the Max should announce as “label Maximum”.Modified version:
Small hint, put thumb-knob after the input so you can render the focused style using adjacent CSS selector.