Skip to content

Commit 38e57a4

Browse files
committed
Add README
1 parent 13d21c8 commit 38e57a4

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,58 @@
1+
# react-input-range
12

3+
`InputRange` is a React component allowing users to input a numeric value within a predefined range. It can accept a single value, or a range of values (start/end). By default, basic styles are applied, but can be overridden depending on your design requirements.
4+
5+
## Installation
6+
7+
1. Install `react-input-range` using npm. `npm install react-input-range`
8+
2. Import `react-input-range.css` to apply the default styling.
9+
3. Import `react-input-range.js` to use `InputRange` component.
10+
11+
## Usage
12+
If accepting a range of values:
13+
14+
```{js}
15+
import React from 'react';
16+
import InputRange from 'react-input-range';
17+
18+
const values = {
19+
min: 2,
20+
max: 10
21+
};
22+
23+
function onChange(component, values) {
24+
console.log(values);
25+
}
26+
27+
React.render(
28+
<InputRange maxValue={20} minValue={0} values={values} onChange={onChange} />,
29+
document.getElementById('input-range')
30+
);
31+
```
32+
33+
If accepting a single value:
34+
35+
```{js}
36+
const value = 10;
37+
38+
React.render(
39+
<InputRange maxValue={20} minValue={0} value={value} onChange={onChange} />,
40+
document.getElementById('input-range')
41+
);
42+
```
43+
44+
### Options
45+
Property | Type | Description
46+
:-----------------------|:----------------|:----------------------------------
47+
ariaLabelledby |string |`aria-labelledby` attribute
48+
maxValue |number |Maximum value it can accept
49+
minValue |number |Minimum value it can accept
50+
name |string |Name of `form` input
51+
onChange |Function |`onChange` callback
52+
step |number |Increment/decrement value
53+
value |number |Default value
54+
values |Array.\<number\> |Default range of values
55+
56+
## Development
57+
58+
Run with `npm start`

0 commit comments

Comments
 (0)