-
Notifications
You must be signed in to change notification settings - Fork 77
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
Enhancement: Custom labels for slider handles and ticks #4004
Labels
4 - verified
Issues that have been released and confirmed resolved.
ArcGIS Online
Issues logged by ArcGIS Online team members.
c-slider
Issues that pertain to the calcite-slider component
enhancement
Issues tied to a new feature or request.
estimate - 8
Requires input from team, consider smaller steps.
low risk
Issues with low risk for consideration in low risk milestones
p - high
Issue should be addressed in the current milestone, impacts component or core functionality
Milestone
Comments
This came up in a Community question as well. |
This was referenced Apr 24, 2024
jcfranco
added a commit
that referenced
this issue
Apr 24, 2024
**Related Issue:** #4004 ## Summary Adds `labelFormatter` prop to allow customization of handle and tick labels. ```ts interface CalciteSlider { /** * Formatter for custom handle/ticks labels. * * If the returned value is a string, it will get used in the label, * and if it is `undefined`, it will use the default, formatted label. */ labelFormatter( // the associated label value value: number, // the label type type: "min" | "max" | "value" | "tick" // the default formatter (configured with corresponding locale, numbering system and group separator defaultFormatter: (value: number): string; ): string | undefined; } ```
Installed and assigned for verification. |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
4 - verified
Issues that have been released and confirmed resolved.
ArcGIS Online
Issues logged by ArcGIS Online team members.
c-slider
Issues that pertain to the calcite-slider component
enhancement
Issues tied to a new feature or request.
estimate - 8
Requires input from team, consider smaller steps.
low risk
Issues with low risk for consideration in low risk milestones
p - high
Issue should be addressed in the current milestone, impacts component or core functionality
Description
Currently the slider supports a
labelHandles
prop which shows the numeric value of each handle above the slider. There are many cases where the numeric value is not user friendly, and we'd like the ability to set a custom handle text.Acceptance Criteria
API should allow for dynamically updating the custom handle text in response to changes. We propose adding this via an additional prop
formatLabels
which accepts a function:This function returns a string and must be synchronous. Each time we render a tick label or a handle label, we call this function if available and render the resulting string instead. If this function is not defined or doesn't return a string, the original value is used.
Relevant Info
I can work on a solution to this for review as we need this for the current release.
This is a more abstract solution to #557 (closed due to inactivity) and is semi related to #2584 as it's the same concept for for handles rather than ticks.
Please respond with thoughts on the API and especially naming as this is a rather esoteric prop concept.
Which Component
calcite-slider
Example Use Case
There are lots of applications of this capability:
The text was updated successfully, but these errors were encountered: