mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 17:09:46 +08:00
35 lines
735 B
TypeScript
35 lines
735 B
TypeScript
|
import React from 'react';
|
||
|
import { Slider } from 'antd';
|
||
|
import type { SliderMarks } from 'antd/es/slider';
|
||
|
|
||
|
const marks: SliderMarks = {
|
||
|
0: '0°C',
|
||
|
26: '26°C',
|
||
|
37: '37°C',
|
||
|
100: {
|
||
|
style: {
|
||
|
color: '#f50',
|
||
|
},
|
||
|
label: <strong>100°C</strong>,
|
||
|
},
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<>
|
||
|
<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;
|