mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
fix: should support Input[addon] in Form[inline], close: #3524
This commit is contained in:
parent
af3c1aac96
commit
1ed434a695
@ -14,7 +14,7 @@ title:
|
|||||||
Inline form is often used for login.
|
Inline form is often used for login.
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Form, Input, Button, Checkbox } from 'antd';
|
import { Form, Icon, Input, Button, Checkbox } from 'antd';
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
let Demo = React.createClass({
|
let Demo = React.createClass({
|
||||||
@ -27,26 +27,22 @@ let Demo = React.createClass({
|
|||||||
const { getFieldDecorator } = this.props.form;
|
const { getFieldDecorator } = this.props.form;
|
||||||
return (
|
return (
|
||||||
<Form inline onSubmit={this.handleSubmit}>
|
<Form inline onSubmit={this.handleSubmit}>
|
||||||
<FormItem
|
<FormItem>
|
||||||
label="Account"
|
|
||||||
>
|
|
||||||
{getFieldDecorator('userName')(
|
{getFieldDecorator('userName')(
|
||||||
<Input placeholder="Please input the account" />
|
<Input addonBefore={<Icon type="user" />} placeholder="Please input the account" />
|
||||||
)}
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem>
|
||||||
label="Password"
|
|
||||||
>
|
|
||||||
{getFieldDecorator('password')(
|
{getFieldDecorator('password')(
|
||||||
<Input type="password" placeholder="Please input the password" />
|
<Input addonBefore={<Icon type="lock" />} type="password" placeholder="Please input the password" />
|
||||||
)}
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem>
|
<FormItem>
|
||||||
{getFieldDecorator('agreement')(
|
{getFieldDecorator('agreement')(
|
||||||
<Checkbox>Remember me</Checkbox>
|
<Checkbox>Remember me</Checkbox>
|
||||||
)}
|
)}
|
||||||
</FormItem>
|
|
||||||
<Button type="primary" htmlType="submit">Submit</Button>
|
<Button type="primary" htmlType="submit">Submit</Button>
|
||||||
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -62,6 +62,7 @@ input[type="checkbox"] {
|
|||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
margin-bottom: @form-item-margin-bottom;
|
margin-bottom: @form-item-margin-bottom;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
// nested FormItem
|
// nested FormItem
|
||||||
& > &,
|
& > &,
|
||||||
|
@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
&-addon,
|
&-addon,
|
||||||
&-wrap {
|
&-wrap {
|
||||||
width: 1%;
|
width: 1px; // To make addon/wrap as small as possible
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user