Skip to content

Commit

Permalink
feat: Add multi-range support (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
bayov authored and benjycui committed Aug 12, 2016
1 parent 36210b3 commit 4b2f6f2
Show file tree
Hide file tree
Showing 4 changed files with 298 additions and 157 deletions.
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

0 comments on commit 4b2f6f2

Please sign in to comment.