forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Translation of Input component and its demos. (ant-design#2789)
- Loading branch information
Showing
9 changed files
with
120 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
--- | ||
order: 6 | ||
title: 适应文本高度的文本域 | ||
title: | ||
zn-CN: 适应文本高度的文本域 | ||
en-US: Autosizing the height to fit the content | ||
--- | ||
|
||
## zh-CN | ||
|
||
`autosize` 属性适用于 `textarea` 节点,并且只有高度会自动变化。另外 `autosize` 可以设定为一个对象,指定最小行数和最大行数。 | ||
|
||
## en-US | ||
|
||
`autosize` prop for a `textarea` type of `Input` makes the height to automatically adjust based on the content. | ||
An options object can be provided to `autosize` to specify the minimum and maximum number of lines the textarea will automatically adjust. | ||
|
||
|
||
````jsx | ||
import { Input } from 'antd'; | ||
|
||
ReactDOM.render( | ||
<div> | ||
<Input type="textarea" placeholder="自适应内容高度" autosize /> | ||
<Input type="textarea" placeholder="Autosize height based on content lines" autosize /> | ||
<div style={{ margin: '24px 0' }} /> | ||
<Input type="textarea" placeholder="有最大高度和最小高度" autosize={{ minRows: 2, maxRows: 6 }} /> | ||
<Input type="textarea" placeholder="Autosize height with minimum and maximum number of lines" autosize={{ minRows: 2, maxRows: 6 }} /> | ||
</div> | ||
, mountNode); | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
category: Components | ||
chinese: 输入框 | ||
type: Form Controls | ||
english: Input | ||
--- | ||
|
||
A basic widget for getting the user input is a text field. | ||
Keyboard and mouse can be used for providing or changing data. | ||
|
||
## When to Use | ||
|
||
- A user input in a form field is needed. | ||
- A search input is required. | ||
|
||
## API | ||
|
||
### Input | ||
|
||
| Property | Description | Type | Available Values | Default | | ||
|----------------|-----------------------|----------|------------------|---------------| | ||
| type | The type of input. For a multi-line input, the 'textarea' value can be used. | string | 'text' or 'textarea' | 'text' | | ||
| id | The identifier. | number or string | | | | ||
| value | The content value. | any | | | | ||
| defaultValue | The initial value. | any | | | | ||
| size | The size of the input box. The implicit value is 'default'. Note: in the context of a form, the 'large' size is used. | string | {'large','default','small'} | 'default' | | ||
| disabled | Tell if the input is disabled. | bool | | false | | ||
| addonBefore | The label text displayed before (on the left side of) the input field. | node | | | | ||
| addonAfter | The label text displayed after (on the right side of) the input field. | node | | | | ||
| onPressEnter | The callback function that is triggered when pressing Enter key. | function(e) | | | | ||
| autosize | Height autosize feature, available when type="textarea". | bool or object | `true` or `{ minRows: 2, maxRows: 6 }` | false | | ||
|
||
> When `Input` is used in a `Form.Item` context, if the `Form.Item` has the `id` and `options` props defined | ||
then `value`, `defaultValue`, and `id` props are automatically set. | ||
|
||
#### Input.Group | ||
|
||
| Property | Description | Type | Available Values | Default | | ||
|-----------|----------------------------------|--------|-----------------------------|-----------| | ||
| size | The size of `Input.Group` specifies the size of the included `Input` fields. | string | {'large','default','small'} | 'default' | | ||
|
||
```html | ||
<Input.Group className={string}> | ||
<Input /> | ||
<Input /> | ||
</Input.Group> | ||
``` |
File renamed without changes.