Skip to content

Commit

Permalink
Pass arbitrary props to the tel input element
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Dec 8, 2016
1 parent 4a444fd commit 5e2d4f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/TelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ class TelInput extends Component {
handleOnBlur: PropTypes.func,
autoFocus: PropTypes.bool,
autoComplete: PropTypes.string,
inputProps: PropTypes.object,
};

render() {
return (
<input type="tel" autoComplete={this.props.autoComplete}
<input
{...this.props.inputProps}
type="tel"
autoComplete={this.props.autoComplete}
className={this.props.className}
disabled={this.props.disabled ? 'disabled' : false}
readOnly={this.props.readonly ? 'readonly' : false}
Expand Down
4 changes: 4 additions & 0 deletions src/containers/IntlTelInputApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default class IntlTelInputApp extends Component {
// whether to use fullscreen flag dropdown for mobile useragents
useMobileFullscreenDropdown: true,
autoComplete: 'off',
// pass through arbitrary props to the tel input element
telInputProps: {},
};

static propTypes = {
Expand Down Expand Up @@ -90,6 +92,7 @@ export default class IntlTelInputApp extends Component {
autoComplete: PropTypes.string,
style: PropTypes.object,
useMobileFullscreenDropdown: PropTypes.bool,
telInputProps: PropTypes.object,
};

constructor(props) {
Expand Down Expand Up @@ -1126,6 +1129,7 @@ export default class IntlTelInputApp extends Component {
placeholder={this.state.placeholder}
autoFocus={this.props.autoFocus}
autoComplete={this.props.autoComplete}
inputProps={this.props.telInputProps}
/>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ <h2>Props</h2>
<td><code>true</code></td>
<td>Render fullscreen flag dropdown when mobile useragent is detected. The dropdown element is rendered as a direct child of <code>document.body</code></td>
</tr>
<tr>
<th scope="row">telInputProps</th>
<td><code>{}</code></td>
<td>Pass through arbitrary props to the tel input element.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 5e2d4f9

Please sign in to comment.