mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
45 lines
720 B
Markdown
45 lines
720 B
Markdown
---
|
|
order: 1
|
|
title:
|
|
zh-CN: 不可用
|
|
en-US: disabled
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
Radio 不可用。
|
|
|
|
## en-US
|
|
|
|
Radio unavailable.
|
|
|
|
```tsx
|
|
import { Button, Radio } from 'antd';
|
|
import React, { useState } from 'react';
|
|
|
|
const App: React.FC = () => {
|
|
const [disabled, setDisabled] = useState(true);
|
|
|
|
const toggleDisabled = () => {
|
|
setDisabled(!disabled);
|
|
};
|
|
|
|
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>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
```
|