ant-design/components/radio/demo/disabled.md

45 lines
720 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 1
title:
zh-CN: 不可用
en-US: disabled
2016-03-31 09:40:55 +08:00
---
2015-07-16 18:23:25 +08:00
## zh-CN
2015-07-16 18:23:25 +08:00
Radio 不可用。
## en-US
Radio unavailable.
```tsx
2022-05-21 22:14:15 +08:00
import { Button, Radio } from 'antd';
import React, { useState } from 'react';
2015-07-16 18:23:25 +08:00
const App: React.FC = () => {
const [disabled, setDisabled] = useState(true);
2018-06-27 15:55:04 +08:00
const toggleDisabled = () => {
setDisabled(!disabled);
2019-05-07 14:57:32 +08:00
};
2018-06-27 15:55:04 +08:00
return (
<>
<Radio defaultChecked={false} disabled={disabled}>
Disabled
</Radio>
<Radio defaultChecked disabled={disabled}>
Disabled
</Radio>
<br />
<Button type="primary" onClick={toggleDisabled} style={{ marginTop: 16 }}>
Toggle disabled
</Button>
</>
);
};
2015-07-16 22:40:49 +08:00
export default App;
```