1.0.17 • Published 3 years ago

react-ion-slider v1.0.17

Weekly downloads
417
License
MIT
Repository
github
Last release
3 years ago

NPM JavaScript Style Guide

Table of Contents

About The Project

Ion-rangeslider react module, this module mapping ion-rangeslider properties to props.

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
npm install npm@latest -g
  • react
npm install --save react react-dom

Installation

  1. Npm install

    npm install --save react-ion-slider
    yarn add react-ion-slider --save

Usage

Get Started

Normal

  1. Before using react-ion-slider please import module
import IonRangeSlider from 'react-ion-slider'
  1. Implement below codes in the react render method
  <IonRangeSlider type={} min={} max={} from={} to={} step={} values={} keyboard={} />
  1. Update options manually without componentDidMount
<IonRangeSlider ref={r => this.ionSlider = r} />

this.ionSlider.update({skin: 'flat', min: 100, max: 500, from: 120, to: 240, type: 'double'})

Next.js

  1. Before using react-ion-slider please import jquery module in your HEAD
<Head>
        <title>Create Next App</title>
        <link rel="icon" href="/favicon.ico" />
        <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossOrigin="anonymous"></script>
</Head>
  1. Please load using dynamic import
const IonRangeSlider = dynamic(() => import('react-ion-slider'),{ssr: false})

Supported Props

OptionDefaultsTypeDescription
Basic setup
type"single"stringChoose slider type, could be single - for one handle, or double for two handles
min10numberSet slider minimum value
max100numberSet slider maximum value
fromminnumberSet start position for left handle (or for single handle)
tomaxnumberSet start position for right handle
Advanced setup
step1numberSet sliders step. Always > 0. Could be fractional.
values[]arraySet up your own array of possible slider values. They could be numbers or strings. If the values array is set up, min, max and step param, are no longer can be changed.
keyboardTRUEbooleanActivates keyboard controls. Move left: ←, ↓, A, S. Move right: →, ↑, W, D.
Grid setup
gridFALSEbooleanEnables grid of values.
grid_marginTRUEbooleanSet left and right grid borders.
grid_num4numberNumber of grid units.
grid_snapFALSEbooleanSnap grid to sliders step (step param). If activated, grid_num will not be used.
Interval control
drag_intervalFALSEbooleanAllow user to drag whole range. Only in double type
min_intervalnumberSet minimum diapason between sliders. Only in double type
max_intervalnumberSet maximum diapason between sliders. Only in double type
Handles control
from_fixedFALSEbooleanFix position of left (or single) handle.
from_minminnumberSet minimum limit for left handle.
from_maxmaxnumberSet the maximum limit for left handle
from_shadowFALSEbooleanHighlight the limits for left handle
to_fixedFALSEbooleanFix position of right handle.
to_minminnumberSet the minimum limit for right handle
to_maxmaxnumberSet the maximum limit for right handle
to_shadowFALSEbooleanHighlight the limits for right handle
UI control
skin"flat"stringChoose UI skin to use
hide_min_maxFALSEbooleanHides min and max labels
hide_from_toFALSEbooleanHide from and to labels
force_edgesFALSEbooleanSlider will be always inside it's container.
extra_classesstringTraverse extra CSS-classes to slider container
blockFALSEbooleanLocks slider and makes it inactive (visually). input is NOT disabled. Can still be send with forms.
Prettify numbers
prettify_enabledTRUEbooleanImprove readability of long numbers. 10000000 → 10 000 000
prettify_separator" "stringSet up your own separator for long numbers. 10 000, 10.000, 10-000 etc.
prettifynullfunctionSet up your own prettify function. Can be anything. For example, you can set up unix time as slider values and than transform them to cool looking dates.
prefixstringSet prefix for values. Will be set up right before the number: $100
postfixstringSet postfix for values. Will be set up right after the number: 100k
max_postfixstringSpecial postfix, used only for maximum value. Will be showed after handle will reach maximum right position. For example 0 — 100+
decorate_bothTRUEbooleanUsed for "double" type and only if prefix or postfix was set up. Determine how to decorate close values. For example: $10k — $100k or $10 — 100k
values_separator" — "stringSet your own separator for close values. Used for double type. Default: 10 — 100. Or you may set: 10 to 100, 10 + 100, 10 → 100 etc.
Data control
input_values_separator" ; "stringSeparator for double values in input value property. Default FROM;TO. Only for double type
disableFALSEbooleanLocks slider and makes it inactive. inputis disabled too. Invisible to forms.
Callbacks
scopenullobjectScope for callbacks. Pass any object. Callback will be executed like this: onChange.call(scope);
onStartnullfunctionCallback. Is called on slider start.
onChangenullfunctionCallback. IS called on each values change.
onFinishnullfunctionCallback. Is called than user releases handle.
onUpdatenullfunctionCallback. Is called than slider is modified by external methods update or reset.

Ref Functions

OptionDefaultsTypeDescription
updatenullfunctionYou can update options manually

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

GiPyeong Lee - @gipyeong - gipyeong.lee@gmail.com

Project Link: https://github.com/gipyeong-lee/react-ion-slider

Reference

Best Readme Template

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago