All Projects → react-component → Slider

react-component / Slider

Licence: mit
React Slider

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Less
1899 projects

Projects that are alternatives of or similar to Slider

tailwind-antd-react-kit
UI Components and helpers for frontend development using Tailwind + Ant Design and React.js
Stars: ✭ 27 (-98.99%)
Mutual labels:  react-components, antd
React Awesome Query Builder
User-friendly query builder for React
Stars: ✭ 682 (-74.56%)
Mutual labels:  antd, react-components
Deep-Viz-Website
The Deep-Viz Components' display website ( Base on React + Dva + Ant-Design) 组件库Deep-Viz的展示网站
Stars: ✭ 12 (-99.55%)
Mutual labels:  react-components, antd
Awesome Uikit
Collect JS Frameworks, Web components library and Admin Template.
Stars: ✭ 1,136 (-57.63%)
Mutual labels:  antd, react-components
react-admin-nest
React和Ant Design和 Nest.js 和 Mysql 构建的后台通用管理系统。持续更新。
Stars: ✭ 123 (-95.41%)
Mutual labels:  react-components, antd
Ant Design Mobile
Fluent and powerful mobile component library based on React.
Stars: ✭ 9,489 (+253.94%)
Mutual labels:  antd, react-components
React Antd Admin
Management system with react and ant-design.
Stars: ✭ 190 (-92.91%)
Mutual labels:  antd
Eth Hot Wallet
Ethereum wallet with erc20 support / web wallet - built using react, web3, eth-lightwallet
Stars: ✭ 205 (-92.35%)
Mutual labels:  antd
React Vtree
React component for efficiently rendering large tree structures
Stars: ✭ 185 (-93.1%)
Mutual labels:  react-components
Griffith
A React-based web video player
Stars: ✭ 2,287 (-14.7%)
Mutual labels:  react-components
Yoshino
A themable React component library!Flexible Lightweight PC UI Components built on React! Anyone can generate easily all kinds of themes by it!
Stars: ✭ 216 (-91.94%)
Mutual labels:  react-components
Ant Plus
🔺 Ant Design 表单简化版
Stars: ✭ 212 (-92.09%)
Mutual labels:  antd
Nano Component
Fast & simple React component styles in under 1kb
Stars: ✭ 202 (-92.47%)
Mutual labels:  react-components
Reactour
Tourist Guide into your React Components
Stars: ✭ 2,782 (+3.77%)
Mutual labels:  react-components
Antd Img Crop
🔪 An image cropper for Ant Design Upload
Stars: ✭ 207 (-92.28%)
Mutual labels:  antd
Alldemo
🍑 2020全栈学习Demo大合集 包含最新 hooks TS 等 还有umi+dva,数据可视化等实战项目 (持续更新中)
Stars: ✭ 189 (-92.95%)
Mutual labels:  antd
Next Blog
基于react(ssr)服务端框架next.js和antd-design搭建的个人博客
Stars: ✭ 214 (-92.02%)
Mutual labels:  antd
React Materials
Migrate to: https://github.com/alibaba-fusion/materials
Stars: ✭ 189 (-92.95%)
Mutual labels:  react-components
React Ui Library Tutorial
📚React组件库搭建指南
Stars: ✭ 201 (-92.5%)
Mutual labels:  react-components
Client
一叶客户端源代码
Stars: ✭ 212 (-92.09%)
Mutual labels:  antd

rc-slider

Slider UI component for React

NPM version dumi build status Test coverage Dependencies DevDependencies npm download bundle size

Install

rc-slider

Example

npm start and then go to http://localhost:8000

Online examples: https://slider.react-component.now.sh/

Usage

import Slider, { Range } from 'rc-slider';
import 'rc-slider/assets/index.css';

export default () => (
  <>
    <Slider />
    <Range />
  </>
);

Compatibility

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

API

createSliderWithTooltip(Slider | Range) => React.Component

An extension to make Slider or Range support Tooltip on handle.

const Slider = require('rc-slider');
const createSliderWithTooltip = Slider.createSliderWithTooltip;
const Range = createSliderWithTooltip(Slider.Range);

Online demo

After Range or Slider was wrapped by createSliderWithTooltip, it will have the following props:

Name Type Default Description
tipFormatter (value: number): React.ReactNode value => value A function to format tooltip's overlay
tipProps Object {
placement: 'top',
prefixCls: 'rc-slider-tooltip',
overlay: tipFormatter(value)
}
A function to format tooltip's overlay

Common API

The following APIs are shared by Slider and Range.

Name Type Default Description
className string '' Additional CSS class for the root DOM node
min number 0 The minimum value of the slider
max number 100 The maximum value of the slider
marks {number: ReactNode} or{number: { style, label }} {} Marks on the slider. The key determines the position, and the value determines what will show. If you want to set the style of a specific mark point, the value should be an object which contains style and label properties.
step number or null 1 Value to be added or subtracted on each step the slider makes. Must be greater than zero, and max - min should be evenly divisible by the step value.
When marks is not an empty object, step can be set to null, to make marks as steps.
vertical boolean false If vertical is true, the slider will be vertical.
handle (props) => React.ReactNode A handle generator which could be used to customized handle.
included boolean true If the value is true, it means a continuous value interval, otherwise, it is a independent value.
reverse boolean false If the value is true, it means the component is rendered reverse.
disabled boolean false If true, handles can't be moved.
dots boolean false When the step value is greater than 1, you can set the dots to true if you want to render the slider with dots.
onBeforeChange Function NOOP onBeforeChange will be triggered when ontouchstart or onmousedown is triggered.
onChange Function NOOP onChange will be triggered while the value of Slider changing.
onAfterChange Function NOOP onAfterChange will be triggered when ontouchend or onmouseup is triggered.
minimumTrackStyle Object please use trackStyle instead. (only used for slider, just for compatibility , will be deprecate at [email protected] )
maximumTrackStyle Object please use railStyle instead (only used for slider, just for compatibility , will be deprecate at [email protected])
handleStyle Array[Object] | Object [{}] The style used for handle. (both for slider(Object) and range(Array of Object), the array will be used for multi handle following element order)
trackStyle Array[Object] | Object [{}] The style used for track. (both for slider(Object) and range(Array of Object), the array will be used for multi track following element order)
railStyle Object {} The style used for the track base color.
dotStyle Object {} The style used for the dots.
activeDotStyle Object {} The style used for the active dots.

Slider

Name Type Default Description
defaultValue number 0 Set initial value of slider.
value number - Set current value of slider.
startPoint number undefined Track starts from this value. If undefined, min is used.
tabIndex number 0 Set the tabIndex of the slider handle.
ariaLabelForHandle string - Set the aria-label attribute on the slider handle.
ariaLabelledByForHandle string - Set the aria-labelledby attribute on the slider handle.
ariaValueTextFormatterForHandle (value) => string - A function to set the aria-valuetext attribute on the slider handle. It receives the current value of the slider and returns a formatted string describing the value. See WAI-ARIA Authoring Practices 1.1 for more information.

Range

Name Type Default Description
defaultValue number[] [0, 0] Set initial positions of handles.
value number[] Set current positions of handles.
tabIndex number[] [0, 0] Set the tabIndex of each handle.
ariaLabelGroupForHandles Array[string] - Set the aria-label attribute on each handle.
ariaLabelledByGroupForHandles Array[string] - Set the aria-labelledby attribute on each handle.
ariaValueTextFormatterGroupForHandles Array[(value) => string] - A function to set the aria-valuetext attribute on each handle. It receives the current value of the slider and returns a formatted string describing the value. See WAI-ARIA Authoring Practices 1.1 for more information.
count number 1 Determine how many ranges to render, and multiple handles will be rendered (number + 1).
allowCross boolean true allowCross could be set as true to allow those handles to cross.
pushable boolean or number false pushable could be set as true to allow pushing of surrounding handles when moving a handle. When set to a number, the number will be the minimum ensured distance between handles. Example:
draggableTrack boolean false Open the track drag. open after click on the track will be invalid.

SliderTooltip

The Tooltip Component that keep following with content.

Development

npm install
npm start

Test Case

npm run test

Coverage

npm run coverage

License

rc-slider is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].