Skip to content

Commit a260035

Browse files
committed
add input placeholder
1 parent d7b8c31 commit a260035

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Example extends Component {
4545
| loading | bool | show loading flag |
4646
| className | string | class name |
4747
| values | array | default values |
48+
| placeholder | array | input placeholder |
4849

4950
## License
5051

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface ReactCodeInputProps {
1212
values?: string[];
1313
disabled?: boolean;
1414
required?: boolean;
15+
placeholder?: string[];
1516
}
1617

1718
declare const ReactCodeInput: React.ComponentClass<ReactCodeInputProps>

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export default class ReactCodeInput extends Component {
2525
className: PropTypes.string,
2626
values: PropTypes.arrayOf(PropTypes.string),
2727
disabled: PropTypes.bool,
28-
required: PropTypes.bool
28+
required: PropTypes.bool,
29+
placeholder: PropTypes.arrayOf(PropTypes.string)
2930
};
3031

3132
static defaultProps = {
@@ -35,7 +36,8 @@ export default class ReactCodeInput extends Component {
3536
fieldHeight: 54,
3637
autoFocus: true,
3738
disabled: false,
38-
required: false
39+
required: false,
40+
placeholder: []
3941
};
4042

4143
constructor(props) {
@@ -229,6 +231,7 @@ export default class ReactCodeInput extends Component {
229231
onFocus={this.onFocus}
230232
disabled={this.props.disabled}
231233
required={this.props.required}
234+
placeholder={this.props.placeholder[index]}
232235
/>
233236
))}
234237
</div>

0 commit comments

Comments
 (0)