You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
342 lines
31 KiB
342 lines
31 KiB
1 year ago
|
"use strict";(self.webpackChunkantd=self.webpackChunkantd||[]).push([[6341],{704773:function(p,o,t){t.r(o);var m=t(502143),_=t(968521),v=t(720719),g=t(28840),Z=t(759907),l=t(828089),h=t(825673),b=t(902068),f=t(574399),x=t(863942),k=t(316073),C=t(24628),w=t(719260),y=t(956140),a=t(127179),i=t(905388),E=t(40428),P=t(606965),D=t(268696),S=t(587302),r=t(424128),T=t(249706),A=t(795127),O=t(116846),M=t(212039),I=t(73024),R=t(553913),c=t(606641),d=t(667294),e=t(370917);function s(){var u=(0,c.eL)(),n=u.texts;return(0,e.tZ)(c.dY,null,(0,e.tZ)(d.Fragment,null,(0,e.tZ)("div",{className:"markdown"},(0,e.tZ)("p",null,n[0].value),(0,e.tZ)("h2",{id:"when-to-use"},(0,e.tZ)(r.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#when-to-use",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"When To Use"),(0,e.tZ)("p",null,n[1].value),(0,e.tZ)("h2",{id:"examples"},(0,e.tZ)(r.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#examples",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"Examples")),(0,e.tZ)(i.Z,{items:[{demo:{id:"components-slider-demo-basic"},previewerProps:{title:"Basic",filename:"components/slider/demo/basic.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React, { useState } from 'react';
|
||
|
import { Slider, Switch } from 'antd';
|
||
|
const App = () => {
|
||
|
const [disabled, setDisabled] = useState(false);
|
||
|
const onChange = (checked) => {
|
||
|
setDisabled(checked);
|
||
|
};
|
||
|
return (
|
||
|
<>
|
||
|
<Slider defaultValue={30} disabled={disabled} />
|
||
|
<Slider range defaultValue={[20, 50]} disabled={disabled} />
|
||
|
Disabled: <Switch size="small" checked={disabled} onChange={onChange} />
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
export default App;
|
||
|
`,description:"<p>Basic slider. When <code>range</code> is <code>true</code>, display as dual thumb mode. When <code>disable</code> is <code>true</code>, the slider will not be interactable.</p>"}},{demo:{id:"components-slider-demo-input-number"},previewerProps:{title:"Slider with InputNumber",filename:"components/slider/demo/input-number.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React, { useState } from 'react';
|
||
|
import { Col, InputNumber, Row, Slider, Space } from 'antd';
|
||
|
const IntegerStep = () => {
|
||
|
const [inputValue, setInputValue] = useState(1);
|
||
|
const onChange = (newValue) => {
|
||
|
setInputValue(newValue);
|
||
|
};
|
||
|
return (
|
||
|
<Row>
|
||
|
<Col span={12}>
|
||
|
<Slider
|
||
|
min={1}
|
||
|
max={20}
|
||
|
onChange={onChange}
|
||
|
value={typeof inputValue === 'number' ? inputValue : 0}
|
||
|
/>
|
||
|
</Col>
|
||
|
<Col span={4}>
|
||
|
<InputNumber
|
||
|
min={1}
|
||
|
max={20}
|
||
|
style={{
|
||
|
margin: '0 16px',
|
||
|
}}
|
||
|
value={inputValue}
|
||
|
onChange={onChange}
|
||
|
/>
|
||
|
</Col>
|
||
|
</Row>
|
||
|
);
|
||
|
};
|
||
|
const DecimalStep = () => {
|
||
|
const [inputValue, setInputValue] = useState(0);
|
||
|
const onChange = (value) => {
|
||
|
if (isNaN(value)) {
|
||
|
return;
|
||
|
}
|
||
|
setInputValue(value);
|
||
|
};
|
||
|
return (
|
||
|
<Row>
|
||
|
<Col span={12}>
|
||
|
<Slider
|
||
|
min={0}
|
||
|
max={1}
|
||
|
onChange={onChange}
|
||
|
value={typeof inputValue === 'number' ? inputValue : 0}
|
||
|
step={0.01}
|
||
|
/>
|
||
|
</Col>
|
||
|
<Col span={4}>
|
||
|
<InputNumber
|
||
|
min={0}
|
||
|
max={1}
|
||
|
style={{
|
||
|
margin: '0 16px',
|
||
|
}}
|
||
|
step={0.01}
|
||
|
value={inputValue}
|
||
|
onChange={onChange}
|
||
|
/>
|
||
|
</Col>
|
||
|
</Row>
|
||
|
);
|
||
|
};
|
||
|
const App = () => (
|
||
|
<Space
|
||
|
style={{
|
||
|
width: '100%',
|
||
|
}}
|
||
|
direction="vertical"
|
||
|
>
|
||
|
<IntegerStep />
|
||
|
<DecimalStep />
|
||
|
</Space>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:'<p>Synchronize with <a href="/components/input-number/">InputNumber</a> component.</p>'}},{demo:{id:"components-slider-demo-icon-slider"},previewerProps:{title:"Slider with icon",filename:"components/slider/demo/icon-slider.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React, { useState } from 'react';
|
||
|
import { FrownOutlined, SmileOutlined } from '@ant-design/icons';
|
||
|
import { Slider } from 'antd';
|
||
|
const IconSlider = (props) => {
|
||
|
const { max, min } = props;
|
||
|
const [value, setValue] = useState(0);
|
||
|
const mid = Number(((max - min) / 2).toFixed(5));
|
||
|
const preColorCls = value >= mid ? '' : 'icon-wrapper-active';
|
||
|
const nextColorCls = value >= mid ? 'icon-wrapper-active' : '';
|
||
|
return (
|
||
|
<div className="icon-wrapper">
|
||
|
<FrownOutlined className={preColorCls} />
|
||
|
<Slider {...props} onChange={setValue} value={value} />
|
||
|
<SmileOutlined className={nextColorCls} />
|
||
|
</div>
|
||
|
);
|
||
|
};
|
||
|
const App = () => <IconSlider min={0} max={20} />;
|
||
|
export default App;
|
||
|
`,description:"<p>You can add an icon beside the slider to make it meaningful.</p>",style:`.icon-wrapper {
|
||
|
position: relative;
|
||
|
padding: 0px 30px;
|
||
|
}
|
||
|
|
||
|
.icon-wrapper .anticon {
|
||
|
position: absolute;
|
||
|
top: -2px;
|
||
|
width: 16px;
|
||
|
height: 16px;
|
||
|
color: rgba(0, 0, 0, 0.25);
|
||
|
font-size: 16px;
|
||
|
line-height: 1;
|
||
|
}
|
||
|
|
||
|
.icon-wrapper .icon-wrapper-active {
|
||
|
color: rgba(0, 0, 0, 0.45);
|
||
|
}
|
||
|
|
||
|
.icon-wrapper .anticon:first-child {
|
||
|
left: 0;
|
||
|
}
|
||
|
|
||
|
.icon-wrapper .anticon:last-child {
|
||
|
right: 0;
|
||
|
}`}},{demo:{id:"components-slider-demo-tip-formatter"},previewerProps:{title:"Customize tooltip",filename:"components/slider/demo/tip-formatter.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const formatter = (value) => \`\${value}%\`;
|
||
|
const App = () => (
|
||
|
<>
|
||
|
<Slider
|
||
|
tooltip={{
|
||
|
formatter,
|
||
|
}}
|
||
|
/>
|
||
|
<Slider
|
||
|
tooltip={{
|
||
|
formatter: null,
|
||
|
}}
|
||
|
/>
|
||
|
</>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>Use <code>tooltip.formatter</code> to format content of <code>Tooltip</code>. If <code>tooltip.formatter</code> is null, hide it.</p>"}},{demo:{id:"components-slider-demo-event"},previewerProps:{title:"Event",filename:"components/slider/demo/event.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const onChange = (value) => {
|
||
|
console.log('onChange: ', value);
|
||
|
};
|
||
|
const onAfterChange = (value) => {
|
||
|
console.log('onAfterChange: ', value);
|
||
|
};
|
||
|
const App = () => (
|
||
|
<>
|
||
|
<Slider defaultValue={30} onChange={onChange} onAfterChange={onAfterChange} />
|
||
|
<Slider
|
||
|
range
|
||
|
step={10}
|
||
|
defaultValue={[20, 50]}
|
||
|
onChange={onChange}
|
||
|
onAfterChange={onAfterChange}
|
||
|
/>
|
||
|
</>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>The <code>onChange</code> callback function will fire when the user changes the slider's value. The <code>onAfterChange</code> callback function will fire when <code>onmouseup</code> fired.</p>"}},{demo:{id:"components-slider-demo-mark"},previewerProps:{title:"Graduated slider",filename:"components/slider/demo/mark.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const marks = {
|
||
|
0: '0\xB0C',
|
||
|
26: '26\xB0C',
|
||
|
37: '37\xB0C',
|
||
|
100: {
|
||
|
style: {
|
||
|
color: '#f50',
|
||
|
},
|
||
|
label: <strong>100\xB0C</strong>,
|
||
|
},
|
||
|
};
|
||
|
const App = () => (
|
||
|
<>
|
||
|
<h4>included=true</h4>
|
||
|
<Slider marks={marks} defaultValue={37} />
|
||
|
<Slider range marks={marks} defaultValue={[26, 37]} />
|
||
|
|
||
|
<h4>included=false</h4>
|
||
|
<Slider marks={marks} included={false} defaultValue={37} />
|
||
|
|
||
|
<h4>marks & step</h4>
|
||
|
<Slider marks={marks} step={10} defaultValue={37} />
|
||
|
|
||
|
<h4>step=null</h4>
|
||
|
<Slider marks={marks} step={null} defaultValue={37} />
|
||
|
</>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>Using <code>marks</code> property to mark a graduated slider, use <code>value</code> or <code>defaultValue</code> to specify the position of thumb. When <code>included</code> is false, means that different thumbs are coordinative. when <code>step</code> is null, users can only slide the thumbs onto marks.</p>",style:`#components-slider-demo-mark h4 {
|
||
|
margin: 0 0 16px;
|
||
|
}
|
||
|
#components-slider-demo-mark .ant-slider-with-marks {
|
||
|
margin-bottom: 44px;
|
||
|
}`}},{demo:{id:"components-slider-demo-vertical"},previewerProps:{title:"Vertical",filename:"components/slider/demo/vertical.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const style = {
|
||
|
display: 'inline-block',
|
||
|
height: 300,
|
||
|
marginLeft: 70,
|
||
|
};
|
||
|
const marks = {
|
||
|
0: '0\xB0C',
|
||
|
26: '26\xB0C',
|
||
|
37: '37\xB0C',
|
||
|
100: {
|
||
|
style: {
|
||
|
color: '#f50',
|
||
|
},
|
||
|
label: <strong>100\xB0C</strong>,
|
||
|
},
|
||
|
};
|
||
|
const App = () => (
|
||
|
<>
|
||
|
<div style={style}>
|
||
|
<Slider vertical defaultValue={30} />
|
||
|
</div>
|
||
|
<div style={style}>
|
||
|
<Slider vertical range step={10} defaultValue={[20, 50]} />
|
||
|
</div>
|
||
|
<div style={style}>
|
||
|
<Slider vertical range marks={marks} defaultValue={[26, 37]} />
|
||
|
</div>
|
||
|
</>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>The vertical Slider.</p>"}},{demo:{id:"components-slider-demo-show-tooltip"},previewerProps:{title:"Control visible of ToolTip",filename:"components/slider/demo/show-tooltip.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const App = () => (
|
||
|
<Slider
|
||
|
defaultValue={30}
|
||
|
tooltip={{
|
||
|
open: true,
|
||
|
}}
|
||
|
/>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>When <code>tooltip.open</code> is <code>true</code>, ToolTip will always show, or ToolTip will not show anyway, even if dragging or hovering.</p>"}},{demo:{id:"components-slider-demo-reverse"},previewerProps:{title:"Reverse",filename:"components/slider/demo/reverse.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React, { useState } from 'react';
|
||
|
import { Slider, Switch } from 'antd';
|
||
|
const App = () => {
|
||
|
const [reverse, setReverse] = useState(true);
|
||
|
return (
|
||
|
<>
|
||
|
<Slider defaultValue={30} reverse={reverse} />
|
||
|
<Slider range defaultValue={[20, 50]} reverse={reverse} />
|
||
|
Reversed: <Switch size="small" checked={reverse} onChange={setReverse} />
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
export default App;
|
||
|
`,description:"<p>Using <code>reverse</code> to render slider reversely.</p>"}},{demo:{id:"components-slider-demo-draggabletrack"},previewerProps:{title:"Draggable track",filename:"components/slider/demo/draggableTrack.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
const App = () => (
|
||
|
<Slider
|
||
|
range={{
|
||
|
draggableTrack: true,
|
||
|
}}
|
||
|
defaultValue={[20, 50]}
|
||
|
/>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>Make range track draggable when set <code>range.draggableTrack</code>.</p>"}},{demo:{id:"components-slider-demo-component-token"},previewerProps:{debug:!0,title:"Component Token",filename:"components/slider/demo/component-token.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { ConfigProvider, Slider } from 'antd';
|
||
|
import React from 'react';
|
||
|
const style = {
|
||
|
display: 'inline-block',
|
||
|
height: 300,
|
||
|
marginLeft: 70,
|
||
|
};
|
||
|
const marks = {
|
||
|
0: '0\xB0C',
|
||
|
26: '26\xB0C',
|
||
|
37: '37\xB0C',
|
||
|
100: {
|
||
|
style: {
|
||
|
color: '#f50',
|
||
|
},
|
||
|
label: <strong>100\xB0C</strong>,
|
||
|
},
|
||
|
};
|
||
|
const App = () => (
|
||
|
<ConfigProvider
|
||
|
theme={{
|
||
|
components: {
|
||
|
Slider: {
|
||
|
controlSize: 20,
|
||
|
railSize: 4,
|
||
|
handleSize: 22,
|
||
|
handleSizeHover: 18,
|
||
|
dotSize: 8,
|
||
|
handleLineWidth: 6,
|
||
|
handleLineWidthHover: 2,
|
||
|
railBg: '#9f3434',
|
||
|
railHoverBg: '#8d2424',
|
||
|
trackBg: '#b0b0ef',
|
||
|
trackHoverBg: '#c77195',
|
||
|
handleColor: '#e6f6a2',
|
||
|
handleActiveColor: '#d22bc4',
|
||
|
dotBorderColor: '#303030',
|
||
|
dotActiveBorderColor: '#918542',
|
||
|
trackBgDisabled: '#1a1b80',
|
||
|
},
|
||
|
},
|
||
|
}}
|
||
|
>
|
||
|
<Slider defaultValue={30} disabled />
|
||
|
<Slider
|
||
|
range={{
|
||
|
draggableTrack: true,
|
||
|
}}
|
||
|
defaultValue={[20, 50]}
|
||
|
/>
|
||
|
<div style={style}>
|
||
|
<Slider vertical defaultValue={30} />
|
||
|
</div>
|
||
|
<div style={style}>
|
||
|
<Slider vertical range step={10} defaultValue={[20, 50]} />
|
||
|
</div>
|
||
|
<div style={style}>
|
||
|
<Slider vertical range marks={marks} defaultValue={[26, 37]} />
|
||
|
</div>
|
||
|
</ConfigProvider>
|
||
|
);
|
||
|
export default App;
|
||
|
`,description:"<p>Component Token Debug.</p>"}}]}),(0,e.tZ)("div",{className:"markdown"},(0,e.tZ)("h2",{id:"api"},(0,e.tZ)(r.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#api",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"API"),(0,e.tZ)(l.Z,{className:"component-api-table"},(0,e.tZ)("thead",null,(0,e.tZ)("tr",null,(0,e.tZ)("th",null,n[2].value),(0,e.tZ)("th",null,n[3].value),(0,e.tZ)("th",null,n[4].value),(0,e.tZ)("th",null,n[5].value),(0,e.tZ)("th",null,n[6].value))),(0,e.tZ)("tbody",null,(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[7].value),(0,e.tZ)("td",null,n[8].value),(0,e.tZ)("td",null,n[9].value),(0,e.tZ)("td",null,n[10].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[11].value),(0,e.tZ)("td",null,n[12].value,(0,e.tZ)("code",null,n[13].value),n[14].value),(0,e.tZ)("td",null,n[15].value),(0,e.tZ)("td",null,n[16].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[17].value),(0,e.tZ)("td",null,n[18].value),(0,e.tZ)("td",null,n[19].value),(0,e.tZ)("td",null,n[20].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[21].value),(0,e.tZ)("td",null,n[22].value),(0,e.tZ)("td",null,n[23].value),(0,e.tZ)("td",null,n[24].value),(0,e.tZ)("td",null,n[25].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[26].value),(0,e.tZ)("td",null,n[27].value),(0,e.tZ)("td",null,n[28].value),(0,e.tZ)("td",null,n[29].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[30].value),(0,e.tZ)("td",null,n[31].value,(0,e.tZ)("code",null,n[32].value),n[33].value),(0,e.tZ)("td",null,n[34].value),(0,e.tZ)("td",null,n[35].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[36].value),(0,e.tZ)("td",null,n[37].value,(0,e.tZ)("code",null,n[38].value),n[39].value),(0,e.tZ)("td",null,n[40].value),(0,e.tZ)("td",null,n[41].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[42].value),(0,e.tZ)("td",null,n[43].value),(0,e.tZ)("td",null,n[44].value),(0,e.tZ)("td",null,n[45].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[46].value),(0,e.tZ)("td",null,n[47].value),(0,e.tZ)("td",null,n[48].value),(0,e.tZ)("td",null,n[49].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[50].value),(0,e.tZ)("td",null,n[51].value),(0,e.tZ)("td",null,n[52].value),(0,e.tZ)("td",null,n[53].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[54].value),(0,e.tZ)("td",null,n[55].value),(0,e.tZ)("td",null,n[56].value),(0,e.tZ)("td",null,n[57].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[58].value),(0,e.tZ)("td",null,n[59].value,(0,e.tZ)("code",null,n[60].value),n[61].value,(0,e.tZ)("code",null,n[62].value),n[63].value),(0,e.tZ)("td",null,n[64].value),(0,e.tZ)("td",null,n[65].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[66].value),(0,e.tZ)("td",null,n[67].value),(0,e.tZ)("td",null,(0,e.tZ)(r.Z,{to:"#tooltip",sourceType:"Link"},n[68].value)),(0,e.tZ)("td",null,n[69].value),(0,e.tZ)("td",null,n[70].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[71].value),(0,e.tZ)("td",null,n[72].value,(0,e.tZ)("code",null,n[73].value),n[74].value),(0,e.tZ)("td",null,n[75].value),(0,e.tZ)("td",null,n[76].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[77].value),(0,e.tZ)("td",null,n[78].value),(0,e.tZ)("td",null,n[79].value),(0,e.tZ)("td",null,n[80].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[81].value),(0,e.tZ)("td",null,n[82].value),(0,e.tZ)("td",null,n[83].value),(0,e.tZ)("td",null,n[84].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[85].value),(0,e.tZ)("td",null,n[86].value),(0,e.tZ)("td",null,n[87].value),(0,e.tZ)("td",null,n[88].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[89].value),(0,e.tZ)("td",null,n[90].value),(0,e.tZ)("td",null,n[91].value),(0,e.tZ)("td",null,n[92].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[93].value),(0,e.tZ)("td",null,n[94].value),(0,e.tZ)("td",null,n[95].value),(0,e.tZ)("td",null,n[96].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[97].va
|