docs: the translation of Input-number (#2707)

This commit is contained in:
ryangun 2016-08-18 15:46:11 +08:00 committed by Benjy Cui
parent f21033c316
commit 0723b9664c
10 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,18 @@
---
order: 0
title: basic
---
Numeric-only input box.
````jsx
import { InputNumber } from 'antd';
function onChange(value) {
console.log('changed', value);
}
ReactDOM.render(
<InputNumber min={1} max={10} defaultValue={3} onChange={onChange} />
, mountNode);
````

View File

@ -0,0 +1,18 @@
---
order: 3
title: decimals
---
A numeric-only input box whose values can be increased or decreased using a decimal step. The number of decimals (also known as precision) is determined by the step prop.
````jsx
import { InputNumber } from 'antd';
function onChange(value) {
console.log('changed', value);
}
ReactDOM.render(
<InputNumber min={1} max={10} step={0.1} onChange={onChange} />
, mountNode);
````

View File

@ -0,0 +1,35 @@
---
order: 2
title: disabled
---
Click the button to toggle between available and disabled states.
````jsx
import { InputNumber, Button } from 'antd';
const Test = React.createClass({
getInitialState() {
return {
disabled: true,
};
},
toggle() {
this.setState({
disabled: !this.state.disabled,
});
},
render() {
return (
<div>
<InputNumber min={1} max={10} disabled={this.state.disabled} defaultValue={3} />
<div style={{ marginTop: 20 }}>
<Button onClick={this.toggle} type="primary">Toggle disabled</Button>
</div>
</div>
);
},
});
ReactDOM.render(<Test />, mountNode);
````

View File

@ -0,0 +1,29 @@
---
order: 1
title: Three sizes
---
There are three sizes available to a numeric input box. By default, the size is `28px`. The two additional sizes are `large` and `small` which means `32px` and `22px`, respectively.
````jsx
import { InputNumber } from 'antd';
function onChange(value) {
console.log('changed', value);
}
ReactDOM.render(
<div>
<InputNumber size="large" min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber size="small" min={1} max={100000} defaultValue={3} onChange={onChange} />
</div>
, mountNode);
````
````css
.ant-input-number {
margin-right: 10px;
}
````

View File

@ -0,0 +1,27 @@
---
category: Components
chinese: 数字输入框
type: Form Controls
english: InputNumber
---
Enter a number within certain range with the mouse or keyboard.
## When to use
When a numeric value needs to be provided.
## API
Property, e.g.
| member | description | type | default |
|-------------|----------------|--------------------|--------------|
| min | min value | Number | -Infinity |
| max | max vale | Number | Infinity |
| value | current value | Number | |
| step | The number to which the current value is increased or decreased. It can be an integer or decimal. | Number or String | 1 |
| defaultValue | initial value | Number | |
| onChange | The callback triggered when the value is changed. | Function | |
| disabled | disable the input | Boolean | false |
| size | width of input box | String | none |