Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2503 from matrix-org/travis/settings/placeholders
Browse files Browse the repository at this point in the history
Default a Field's placeholder to the label
  • Loading branch information
turt2live authored Jan 25, 2019
2 parents 3301c35 + d819095 commit 7a2cc3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/views/elements/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Field extends React.PureComponent {
type: PropTypes.string,
// The field's label string.
label: PropTypes.string,
// The field's placeholder string.
// The field's placeholder string. Defaults to the label.
placeholder: PropTypes.string,
// The type of field to create. Defaults to "input". Should be "input" or "select".
// To define options for a select, use <Field><option ... /></Field>
Expand Down Expand Up @@ -55,6 +55,7 @@ export default class Field extends React.PureComponent {
// Set some defaults for the element
extraProps.type = extraProps.type || "text";
extraProps.ref = "fieldInput";
extraProps.placeholder = extraProps.placeholder || extraProps.label;

const element = this.props.element || "input";
const fieldInput = React.createElement(element, extraProps, this.props.children);
Expand Down

0 comments on commit 7a2cc3a

Please sign in to comment.