From 5abe68800e71b2b2864b16530568c8b872127718 Mon Sep 17 00:00:00 2001 From: mirrorgo Date: Thu, 26 Sep 2024 18:57:25 +1000 Subject: [PATCH 1/2] feat: add optional id prop to Slider component --- src/Slider.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Slider.tsx b/src/Slider.tsx index 90d278b0d..7f32f49dd 100644 --- a/src/Slider.tsx +++ b/src/Slider.tsx @@ -54,6 +54,8 @@ export interface SliderProps { classNames?: SliderClassNames; styles?: SliderStyles; + id?: string; + // Status disabled?: boolean; keyboard?: boolean; @@ -126,6 +128,8 @@ const Slider = React.forwardRef>((prop classNames, styles, + id, + // Status disabled = false, keyboard = true, @@ -575,6 +579,7 @@ const Slider = React.forwardRef>((prop })} style={style} onMouseDown={onSliderMouseDown} + id={id} >
Date: Thu, 26 Sep 2024 19:02:57 +1000 Subject: [PATCH 2/2] docs: update README to include id prop for Slider component --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 998cb99c3..b3b11271f 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ The following APIs are shared by Slider and Range. | className | string | `''` | Additional CSS class for the root DOM node | | min | number | `0` | The minimum value of the slider | | max | number | `100` | The maximum value of the slider | +| id | string | `''` | Unique identifier for the component, used for accessibility | | marks | `{number: ReactNode}` or`{number: { style, label }}` | `{}` | Marks on the slider. The key determines the position, and the value determines what will show. If you want to set the style of a specific mark point, the value should be an object which contains `style` and `label` properties. | | step | number or `null` | `1` | Value to be added or subtracted on each step the slider makes. Must be greater than zero, and `max` - `min` should be evenly divisible by the step value.
When `marks` is not an empty object, `step` can be set to `null`, to make `marks` as steps. | | vertical | boolean | `false` | If vertical is `true`, the slider will be vertical. |