react-component / react-component/slider

Handle tooltip display mark label instead of value

Open
#583 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.1k
Forks
768
Avg merge
11d 22h
Merged PRs (30d)
5

Description

Is there a way to pass the mark label to the handle instead of the value?

Trivial example:

const marks = {
  1: 'One',
  2: 'Two',
  3: 'Three',
  4: 'Four',
  5: 'Five',
};

[...]

const handle = (props) => {
  const { dragging, value, ...otherProps } = props;

  return (
    <Tooltip overlay={value} visible={dragging}>
      <Handle value={value} {...otherProps} />
    </Tooltip>
  );
};

[...]

<Slider
  handle={handle}
  marks={marks}
  min={1}
  max={5}
/>

Results in:
image

I'd like to be able to write this for the handle:

const handle = (props) => {
  const { dragging, label, value, ...otherProps } = props;

  return (
    <Tooltip overlay={label} visible={dragging}>
      <Handle value={value} {...otherProps} />
    </Tooltip>
  );
};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Slider handle customization and the marks data flow referenced in the issue. Check how the handle currently receives value and determine where the corresponding mark label could be exposed. Done means the custom handle can display the mark label instead of the numeric value, with the documented example behaving as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.