ant-design/components/input/demo/presuffix.md

43 lines
812 B
Markdown
Raw Normal View History

---
order: 8
title:
zh-CN: 前缀和后缀
en-US: prefix and suffix
---
## zh-CN
在输入框上添加前缀或后缀图标。
## en-US
2020-06-17 10:58:24 +08:00
Add a prefix or suffix icons inside input.
```tsx
import { InfoCircleOutlined, UserOutlined } from '@ant-design/icons';
2022-05-21 22:14:15 +08:00
import { Input, Tooltip } from 'antd';
import React from 'react';
2019-03-26 22:27:46 +08:00
const App: React.FC = () => (
<>
<Input
placeholder="Enter your username"
2019-12-23 20:07:56 +08:00
prefix={<UserOutlined className="site-form-item-icon" />}
suffix={
<Tooltip title="Extra information">
<InfoCircleOutlined style={{ color: 'rgba(0,0,0,.45)' }} />
</Tooltip>
}
/>
<br />
<br />
<Input prefix="¥" suffix="RMB" />
<br />
<br />
<Input prefix="¥" suffix="RMB" disabled />
</>
2019-05-07 14:57:32 +08:00
);
export default App;
2019-05-07 14:57:32 +08:00
```