2021-11-26 18:15:59 +08:00
|
|
|
---
|
|
|
|
order: 3.2
|
|
|
|
title:
|
|
|
|
zh-CN: 表单标签可换行
|
|
|
|
en-US: label can wrap
|
|
|
|
version: 4.18.0
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
使用 `labelWrap` 可以开启 `label` 换行。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Turn on `labelWrap` to wrap label if text is long.
|
|
|
|
|
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Button, Form, Input } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2021-11-26 18:15:59 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2021-11-26 18:15:59 +08:00
|
|
|
<Form
|
|
|
|
name="wrap"
|
|
|
|
labelCol={{ flex: '110px' }}
|
|
|
|
labelAlign="left"
|
|
|
|
labelWrap
|
|
|
|
wrapperCol={{ flex: 1 }}
|
|
|
|
colon={false}
|
|
|
|
>
|
|
|
|
<Form.Item label="正常标签文案" name="username" rules={[{ required: true }]}>
|
|
|
|
<Input />
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
<Form.Item label="超长标签文案超长标签文案" name="password" rules={[{ required: true }]}>
|
|
|
|
<Input />
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
<Form.Item label=" ">
|
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
|
Submit
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
);
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
export default App;
|
2021-11-26 18:15:59 +08:00
|
|
|
```
|