Skip to content

Commit

Permalink
Added EditableText input type field (#3235)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhys authored and giladgray committed Dec 14, 2018
1 parent f29ca79 commit ab3078a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/components/editable-text/editableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export interface IEditableTextProps extends IIntentProps, IProps {
*/
selectAllOnFocus?: boolean;

/**
* The type of input that should be shown, when not `multiline`.
*/
type?: string;

/** Text value of controlled input. */
value?: string;

Expand Down Expand Up @@ -116,6 +121,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
minWidth: 80,
multiline: false,
placeholder: "Click to Edit",
type: "text",
};

private valueElement: HTMLSpanElement;
Expand Down Expand Up @@ -280,7 +286,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
};

private maybeRenderInput(value: string) {
const { maxLength, multiline, placeholder } = this.props;
const { maxLength, multiline, type, placeholder } = this.props;
if (!this.state.isEditing) {
return undefined;
}
Expand All @@ -301,7 +307,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
return multiline ? (
<textarea ref={this.refHandlers.input} {...props} />
) : (
<input ref={this.refHandlers.input} type="text" {...props} />
<input ref={this.refHandlers.input} type={type} {...props} />
);
}

Expand Down

1 comment on commit ab3078a

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added EditableText input type field (#3235)

Previews: documentation | landing | table

Please sign in to comment.