Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextField] Forward name props to the input #6469

Merged
merged 2 commits into from
Apr 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/src/pages/component-api/TextField/TextField.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ Props
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| className | string | | The CSS class name of the root element. |
| disabled | bool | | If `true`, the input will be disabled. |
| disabled | bool | | Disabled attribute of the `<Input />` element. If `true`, the input will be disabled. |
| error | bool | | Whether the label should be displayed in an error state. |
| id | string | | |
| inputClassName | string | | The CSS class name of the input element. |
| inputClassName | string | | The CSS class name of the `<Input />` element. |
| inputProps | object | | Properties applied to the internal `<Input />` component. |
| label | node | | The label text. |
| labelClassName | string | | The CSS class name of the label element. |
| name | string | | Name attribute of the `<Input />` element. |
| required | bool | false | Whether the label should be displayed as required (asterisk). |
| type | string | | Type of the input element. It should be a valid HTML5 input type. |
| value | union:&nbsp;string<br>&nbsp;number<br> | | The input value, required for a controlled component. |
| type | string | | Type attribute of the `<Input />` element. It should be a valid HTML5 input type. |
| value | union:&nbsp;string<br>&nbsp;number<br> | | Value attribute of the `<Input />` element, required for a controlled component. |

Any other properties supplied will be spread to the root element.
14 changes: 10 additions & 4 deletions src/TextField/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class TextField extends Component {
*/
className: PropTypes.string,
/**
* If `true`, the input will be disabled.
* Disabled attribute of the `<Input />` element. If `true`, the input will be disabled.
*/
disabled: PropTypes.bool,
/**
Expand All @@ -36,7 +36,7 @@ export default class TextField extends Component {
*/
id: PropTypes.string,
/**
* The CSS class name of the input element.
* The CSS class name of the `<Input />` element.
*/
inputClassName: PropTypes.string,
/**
Expand All @@ -51,16 +51,20 @@ export default class TextField extends Component {
* The CSS class name of the label element.
*/
labelClassName: PropTypes.string,
/**
* Name attribute of the `<Input />` element.
*/
name: PropTypes.string,
/**
* Whether the label should be displayed as required (asterisk).
*/
required: PropTypes.bool,
/**
* Type of the input element. It should be a valid HTML5 input type.
* Type attribute of the `<Input />` element. It should be a valid HTML5 input type.
*/
type: PropTypes.string,
/**
* The input value, required for a controlled component.
* Value attribute of the `<Input />` element, required for a controlled component.
*/
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
Expand Down Expand Up @@ -89,6 +93,7 @@ export default class TextField extends Component {
inputProps,
label,
labelClassName,
name,
required,
type,
value,
Expand All @@ -110,6 +115,7 @@ export default class TextField extends Component {
<Input
className={inputClassName}
value={value}
name={name}
type={type}
disabled={disabled}
{...inputProps}
Expand Down