ant-design/components/slider/demo/basic.md
2022-05-23 14:37:16 +08:00

44 lines
915 B
Markdown

---
order: 0
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
基本滑动条。当 `range``true` 时,渲染为双滑块。当 `disabled``true` 时,滑块处于不可用状态。
## en-US
Basic slider. When `range` is `true`, display as dual thumb mode. When `disable` is `true`, the slider will not be interactable.
```tsx
import { Slider, Switch } from 'antd';
import React, { useState } from 'react';
const App: React.FC = () => {
const [disabled, setDisabled] = useState(false);
const onChange = (checked: boolean) => {
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;
```
<style>
.code-box-demo .ant-slider {
margin-bottom: 16px;
}
</style>