react-component / react-component/slider

Alternative for trackStyle and handleStyle

Open
#1,056 0 comments 1 reaction 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

I have a usecase like this where I want to provide different color and styling to different tracks and handles so I used trackStyle and handleStyle as array

 <Slider
        value={values}
        step={1}
        range={{ maxCount: 4 }}
        allowCross={false}
        marks={marks}
        dots={false}
        trackStyle={[
          { backgroundColor: "green", height: height },
          { backgroundColor: "yellow", height: height },
          { backgroundColor: "red", height: height },
        ]}
        onChange={handleChange}
        handleStyle={[
          { display: "none" },
          handleStyle,
          handleStyle,
          { display: "none" },
        ]}
        railStyle={{ height: height }}
        handleRender={handleRender}
        activeDotStyle={{ display: "none" }}
      />

But now both these properties are deprecated, and we have to use styles.track or styles.handle for this but I'm not able to identify how to provide multiple values in styles.track since it takes a simple object.
Partial<Record<SemanticName, React.CSSProperties>>;

Can we do something in this case?

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 reviewing the Slider API and the type definition for styles.track and styles.handle, then compare them with the deprecated trackStyle and handleStyle props shown in the issue. Determine whether multiple per-track and per-handle values are supported or require an API change; done means the use case has a documented, working approach or a clearly specified replacement.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.