logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Slider

A Slider component for displaying current value and intervals in range.
가져오기import{ Slider }from"antd";
소스components/slider
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

To input a value in a range.

Examples

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersion
autoFocusWhether get focus when component mountedbooleanfalse
classNamesSemantic structure classNameRecord<SemanticDOM, string>-5.10.0
defaultValueThe default value of slider. When range is false, use number, otherwise, use [number, number]number | [number, number]0 | [0, 0]
disabledIf true, the slider will not be intractablebooleanfalse
keyboardSupport using keyboard to move handlersbooleantrue5.2.0+
dotsWhether the thumb can drag over tick onlybooleanfalse
includedMake effect when marks not null, true means containment and false means coordinativebooleantrue
marksTick mark of Slider, type of key must be number, and must in closed interval [min, max], each mark can declare its own styleobject{ number: ReactNode } | { number: { style: CSSProperties, label: ReactNode } }
maxThe maximum value the slider can slide tonumber100
minThe minimum value the slider can slide tonumber0
rangeDual thumb modebooleanfalse
reverseReverse the componentbooleanfalse
stepThe granularity the slider can step through values. Must greater than 0, and be divided by (max - min) . When step is null but exist marks, the valid point will only be the mark, min and maxnumber | null1
stylesSemantic structure styleRecord<SemanticDOM, React.CSSProperties>-5.10.0
tooltipThe tooltip relate propstooltip-4.23.0
valueThe value of slider. When range is false, use number, otherwise, use [number, number]number | [number, number]-
verticalIf true, the slider will be verticalbooleanfalse
onChangeCompleteFire when mouseup or keyup is fired(value) => void-
onChangeCallback function that is fired when the user changes the slider's value(value) => void-

range

PropertyDescriptionTypeDefaultVersion
draggableTrackWhether range track can be dragbooleanfalse-
editableDynamic edit nodes, can't be used with draggableTrackbooleanfalse5.20.0
minCountThe minimum count of nodesnumber05.20.0
maxCountThe maximum count of nodesnumber-5.20.0

tooltip

PropertyDescriptionTypeDefaultVersion
autoAdjustOverflowWhether to automatically adjust the popup positionbooleantrue5.8.0
openIf true, Tooltip will show always, or it will not show anyway, even if dragging or hoveringboolean-4.23.0
placementSet Tooltip display position. Ref Tooltipstring-4.23.0
getPopupContainerThe DOM container of the Tooltip, the default behavior is to create a div element in body(triggerNode) => HTMLElement() => document.body4.23.0
formatterSlider will pass its value to formatter, and display its value in Tooltip, and hide Tooltip when return value is nullvalue => ReactNode | nullIDENTITY4.23.0

Methods

NameDescriptionVersion
blur()Remove focus
focus()Get focus

Semantic DOM

Design Token

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
controlSize滑动输入高度number10
dotActiveBorderColor圆点激活态边框颜色string#91caff
dotBorderColor圆点边框颜色string#f0f0f0
dotSize滑块圆点尺寸number8
handleActiveColor滑块激活态边框色string#1677ff
handleActiveOutlineColor滑块激活态外框色stringrgba(22, 119, 255, 0.2)
handleColor滑块颜色string#91caff
handleColorDisabled滑块禁用颜色string#bfbfbf
handleLineWidth滑块边框宽度string | number2
handleLineWidthHover滑块边框宽度(悬浮态)string | number2.5
handleSize滑块尺寸number10
handleSizeHover滑块尺寸(悬浮态)number12
railBg轨道背景色stringrgba(0, 0, 0, 0.04)
railHoverBg轨道背景色(悬浮态)stringrgba(0, 0, 0, 0.06)
railSize轨道高度number4
trackBg轨道已覆盖部分背景色string#91caff
trackBgDisabled轨道禁用态背景色stringrgba(0, 0, 0, 0.04)
trackHoverBg轨道已覆盖部分背景色(悬浮态)string#69b1ff

글로벌 토큰어떻게 사용하나요?

Basic
codepen icon
External Link Icon
expand codeexpand code
Slider with icon
codepen icon
External Link Icon
expand codeexpand code
Event
codepen icon
External Link Icon
expand codeexpand code
Vertical
codepen icon
External Link Icon
expand codeexpand code
Reverse
codepen icon
External Link Icon
expand codeexpand code
Multiple handles
codepen icon
External Link Icon
expand codeexpand code
Component Token
codepen icon
External Link Icon
expand codeexpand code
Slider with InputNumber
codepen icon
External Link Icon
expand codeexpand code
Customize tooltip
codepen icon
External Link Icon
expand codeexpand code
Graduated slider
codepen icon
External Link Icon
expand codeexpand code
Control visible of ToolTip
codepen icon
External Link Icon
expand codeexpand code
Draggable track
codepen icon
External Link Icon
expand codeexpand code
Dynamic edit nodes
codepen icon
External Link Icon
expand codeexpand code
5.20.0
Disabled:
0°C26°C37°C100°C
Reversed:
0°C26°C37°C100°C

included=true

0°C26°C37°C100°C
0°C26°C37°C100°C

included=false

0°C26°C37°C100°C

marks & step

0°C26°C37°C100°C

step=null

0°C26°C37°C100°C
  • track
    5.10.0
    범위 선택 아래 점과 점 사이의 선택 막대
  • tracks
    5.10.0
    범위 선택 아래 범위 전체 선택 막대
  • rail
    5.10.0
    배경 레일 요소
  • handle
    5.10.0
    잡기 핸들 요소