diff --git a/README.md b/README.md index fb6e96b..133dda4 100644 --- a/README.md +++ b/README.md @@ -134,5 +134,6 @@ selectAllOnFocus | false | Selects all text on focus or does not prefix | '' | Currency prefix suffix | '' | Currency suffix autoFocus | false | Autofocus +placeHolder | '' | Placeholder text ***Note:** Enabling any mask-related features such as prefix, suffix or separators with an inputType="number" or "tel" could trigger errors. Most of those characters would be invalid in such input types. diff --git a/src/index.js b/src/index.js index fa27abf..8ad60ae 100644 --- a/src/index.js +++ b/src/index.js @@ -263,6 +263,7 @@ class CurrencyInput extends Component { onChange={this.handleChange} onFocus={this.handleFocus} onMouseUp={this.handleFocus} + placeholder={this.propsplaceHolder} {...this.state.customProps} /> ) @@ -287,7 +288,8 @@ CurrencyInput.propTypes = { allowEmpty: PropTypes.bool, prefix: PropTypes.string, suffix: PropTypes.string, - selectAllOnFocus: PropTypes.bool + selectAllOnFocus: PropTypes.bool, + placeHolder: PropTypes.string }; @@ -303,7 +305,8 @@ CurrencyInput.defaultProps = { allowNegative: false, prefix: '', suffix: '', - selectAllOnFocus: false + selectAllOnFocus: false, + placeHolder: '', }; diff --git a/test/index.spec.js b/test/index.spec.js index cbe41f0..c6ce100 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -53,6 +53,7 @@ describe('react-currency-input', function(){ value="123456789" inputType="tel" id="currencyInput" + placeHolder='placeHolderText' autoFocus={true} /> );