1.0.5 • Published 5 years ago

@rn-components-kit/slider v1.0.5

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

Slider

NPM version

English | 中文

Sliders allow users to select a value from a fixed set of options. It supports the following features:

  • horizontal and vertical two directions
  • one or two thumbs two modes
  • customized style for track and thumb
  • friendly tooltip and fully customized tip formatter

How to use

npm install @rn-components-kit/slider --save
PreviewCode
Demo1 Code
Demo2 Code
Demo3 Code
Demo4 Code

Props

Reference

Props

style

Allows you to customize style

TypeRequiredDefault
objectno-

min

The minimum value that thumb can slide to

TypeRequiredDefault
numberno0

max

The maximum value that thumb can slide to

TypeRequiredDefault
numberno100

step

The granularity the slider can step through values. (Must greater than 0, and be divided by (max - min))

TypeRequiredDefault
numberno1

defaultValue

The initial value when first render slider

TypeRequiredDefault
number | number[]no-

multi

Determines whether one or two thumbs in slider

TypeRequiredDefault
booleannofalse

vertical

Determines whether slider is horizontal or vertical

TypeRequiredDefault
booleannofalse

showTip

Determines whether tooltip is shown

TypeRequiredDefault
enum('never', 'onTap', 'always')nofalse

tipContainerStyle

Allows you to customize tooltip's container style (e.g. size, backgroundColor)

TypeRequiredDefault
objectno-

tipTextStyle

Allows you to customize tooltip's text style (e.g. fontSize, color)

TypeRequiredDefault
objectno-

trackColor

Color of track

TypeRequiredDefault
stringno'#DDD'

selectedTrackColor

Color of track's selected part

TypeRequiredDefault
stringno'#40A9FF'

thumbStyle

Allows you to customize thumb's style (e.g. color, size, shadow)

TypeRequiredDefault
objectno-

renderThumb

() => void

Allows you to fully customize thumb module

TypeRequiredDefault
functionno-

tipFormatter

(value: number) => string

Slider will pass value to tipFormatter, and display its return value in tooltip

TypeRequiredDefault
functionnovalue => value.toString()

onValueChange

(value: number) => void

A callback will be triggered when slider's value changes

TypeRequiredDefault
functionno() => {}

onBeginSliding

() => void

A callback will be triggered when slider starts to slide

TypeRequiredDefault
functionno() => {}

onEndSliding

() => void

A callback will be triggered when slider ends to slide

TypeRequiredDefault
functionno() => {}
1.0.5

5 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