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

[Feature Request] VNumberInput dynamic step size #19779

Open
lukasberbuer opened this issue May 8, 2024 · 0 comments
Open

[Feature Request] VNumberInput dynamic step size #19779

lukasberbuer opened this issue May 8, 2024 · 0 comments
Assignees
Labels
C: VNumberInput T: enhancement Functionality that enhances existing features

Comments

@lukasberbuer
Copy link

Problem to solve

The step prop currently only takes a number. This works well for linear scaled numbers.
I would like to use a dynamic step size (for a logarithmic scaled value):

  • increment: multiply value by 2
  • decrement: divide value by 2

Proposed solution

The prop could take a callable which returns the computed step size, e.g.:

enum StepDirection {
  Up = 1,
  Down = -1,
}
type StepFunc = (value: number, direction: StepDirection) => number;

const logStep = (value: number, direction: StepDirection) => {
  switch (direction) {
  case StepDirection.Up:
    return value;
  case StepDirection.Down:
    return -0.5 * value;
  }
};
@yuwu9145 yuwu9145 self-assigned this May 18, 2024
@yuwu9145 yuwu9145 added T: enhancement Functionality that enhances existing features C: VNumberInput and removed S: triage labels May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VNumberInput T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

2 participants