Skip to content

Alternative for trackStyle and handleStyle #1056

@harshv-shopflo

Description

@harshv-shopflo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions