-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RangeControls: Improve UI + UX #19916
Changes from all commits
a05b713
8f11bca
78d2813
99e409d
9ae09dd
bbb0398
40fac8c
0687ac9
327dbcb
7b21afc
f6aefdf
8deb219
7afa6db
165f4d5
be4847b
704e4f6
66c86e6
dbbbbcc
f064832
19a0c50
5a79f68
3c29316
25aeca1
36ea3d8
63e8329
0d571e8
2acb222
0e23ded
3c405af
3fbd9c7
baff972
2cad85d
4d3c112
110831f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,14 @@ If this property is true, a button to reset the the slider is rendered. | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### disabled | ||
|
||
Disables the `input`, preventing new values from being applied. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### initialPosition | ||
|
||
If no value exists this prop contains the slider starting position. | ||
|
@@ -160,13 +168,41 @@ If no value exists this prop contains the slider starting position. | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### value | ||
|
||
The current value of the range slider. | ||
#### marks | ||
|
||
- Type: `Number` | ||
- Required: Yes | ||
- Platform: Web | Mobile | ||
Renders a visual representation of `step` ticks. Custom mark indicators can be provided by an `Array`. | ||
|
||
Example: | ||
|
||
```jsx | ||
const marks = [ | ||
{ | ||
value: 0, | ||
label: '0', | ||
Comment on lines
+181
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's a common use case that the label would be the same as value, could we make it optional and fall back to a stringified There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if it's common yet :). |
||
}, | ||
{ | ||
value: 1, | ||
label: '1', | ||
}, | ||
{ | ||
value: 8, | ||
label: '8', | ||
}, | ||
{ | ||
value: 10, | ||
label: '10', | ||
}, | ||
]; | ||
|
||
const MyRangeControl() { | ||
return (<RangeControl marks={ marks } min={ 0 } max={ 10 } step={ 1 } />) | ||
} | ||
``` | ||
|
||
- Type: `Array|Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### onChange | ||
|
||
|
@@ -193,6 +229,54 @@ The maximum value accepted. If higher values are inserted onChange will not be c | |
- Required: No | ||
- Platform: Web | Mobile | ||
|
||
#### renderTooltipContent | ||
|
||
A way to customize the rendered UI of the value. Example: | ||
|
||
```jsx | ||
const customTooltipContent = value => `${value}%` | ||
|
||
const MyRangeControl() { | ||
return (<RangeControl renderTooltipContent={ customTooltipContent } />) | ||
} | ||
``` | ||
|
||
- Type: `Function` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### showTooltip | ||
|
||
Forcing the Tooltip UI to show or hide. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### step | ||
|
||
The stepping interval between `min` and `max` values. Step is used both for user interface and validation purposes. | ||
|
||
- Type: `Number` | ||
- Required: No | ||
- Platform: Web | ||
|
||
#### value | ||
|
||
The current value of the range slider. | ||
|
||
- Type: `Number` | ||
- Required: Yes | ||
- Platform: Web | Mobile | ||
|
||
#### withInputField | ||
|
||
Determines if the `input` number field will render next to the RangeControl. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
- Platform: Web | ||
Comment on lines
+276
to
+278
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to describe the default here, since it might be unexpected that the default is |
||
|
||
#### icon | ||
|
||
An icon to be shown above the slider next to it's container title. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?