Skip to content

Add multi-range support #133

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

Merged
merged 10 commits into from
Aug 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ slider ui component for react

<img src="https://t.alipayobjects.com/images/T1wO8fXd4rXXXXXXXX.png" width="550"/>

<img src="http://i.giphy.com/l46Cs36c9HrHMExoc.gif"/>


## Feature

Expand Down Expand Up @@ -104,15 +106,21 @@ ReactDOM.render(<Rcslider />, container);
</tr>
<tr>
<td>range</td>
<td>boolean</td>
<td>boolean or number</td>
<td>false</td>
<td>Determines the type of slider. If range is `true`, two handles will be rendered in order to select a range.</td>
<td>Determines the type of slider. If range is `true`, two handles will be rendered in order to select a range. If range is a number, multiple handles will be rendered (number + 1). Using `range={true}` is equivalent to `range={1}`.</td>
</tr>
<tr>
<td>allowCross</td>
<td>boolean</td>
<td>true</td>
<td>When `range` is `true`, `allowCross` could be set as `true` to allow those two handles cross.</td>
<td>When `range` is `true`, `allowCross` could be set as `true` to allow those handles to cross.</td>
</tr>
<tr>
<td>pushable</td>
<td>boolean or number</td>
<td>true</td>
<td>When `range` is `true`, `pushable` could be set as `true` to allow pushing of surrounding handles when moving an handle. When set to a number, the number will be the minimum ensured distance between handles. Example: <img src="http://i.giphy.com/l46Cs36c9HrHMExoc.gif"/></td>
</tr>
<tr>
<td>vertical</td>
Expand All @@ -122,15 +130,15 @@ ReactDOM.render(<Rcslider />, container);
</tr>
<tr>
<td>defaultValue</td>
<td>number or [number, number]</td>
<td>number or [number, number, ...]</td>
<td>0 or [0, 0]</td>
<td>Set initial positions of handles. If range is `false`, the type of `defaultValue` should be `number`. Otherwise, `[number, number]`</td>
<td>Set initial positions of handles. If range is `false`, the type of `defaultValue` should be `number`. Otherwise, `[number, number, ...]`</td>
</tr>
<tr>
<td>value</td>
<td>number or [number, number]</td>
<td>number or [number, number, ...]</td>
<td></td>
<td>Set current positions of handles. If range is `false`, the type of `defaultValue` should be `number`. Otherwise, `[number, number]`</td>
<td>Set current positions of handles. If range is `false`, the type of `defaultValue` should be `number`. Otherwise, `[number, number, ...]`</td>
</tr>
<tr>
<td>handle</td>
Expand Down
4 changes: 4 additions & 0 deletions examples/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ ReactDOM.render(
<p>Controlled Range</p>
<Slider range value={[20, 40]} />
</div>
<div style={style}>
<p>Multi Range</p>
<Slider range={3} value={[20, 40, 60, 80]} />
</div>
<div style={style}>
<p>Customized Range</p>
<CustomizedRange />
Expand Down
Loading