Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Custom validation for multiple thumb values #6338

Open
mattrossman opened this issue May 6, 2024 · 0 comments
Open

[Slider] Custom validation for multiple thumb values #6338

mattrossman opened this issue May 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mattrossman
Copy link

Provide a general summary of the feature here

<Slider> does not allow thumbs to cross each other. This makes it impossible to implement our own validation logic when collisions occur. I would like a way to implement custom validation logic for multi-thumb values.

🤔 Expected Behavior?

I expect that my onChange handler will be responsible for validating values, and will not be limited by built-in logic beyond the constraints specified by minValue / maxValue / step

😯 Current Behavior

Sliders enforce that thumb values cannot exceed neighboring values. This ensures that values are ordered, but prohibits custom UX for collisions.

function getThumbMinValue(index: number) {
return index === 0 ? minValue : values[index - 1];
}
function getThumbMaxValue(index: number) {
return index === values.length - 1 ? maxValue : values[index + 1];
}

💁 Possible Solution

Perhaps an additional prop like disableCollision could disable the constraint on neighboring values

🔦 Context

I have two slider thumbs "left" and "right" that define a range, when I drag the left thumb beyond the right thumb I want the left thumb to pull the right thumb along with it. This makes it easier for a user to move the left thumb to a desired value in one movement instead of having to manually shuffle the right value along.

Instead, the "left" thumb halts at the "right" value. If thumbs did not come with prescribed collision logic, I could implement the constraint myself. However, since the right thumb prohibits the left thumb from moving past it, there is no way for me to detect when the user intends to drag further.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants