Skip to content

Commit 6e982d4

Browse files
authored
Merge pull request #431 from facultyai/select-placeholder
Add custom select placeholder text
2 parents 3126d23 + a75963f commit 6e982d4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/components/input/Select.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ const Select = props => {
4343
value={value}
4444
bsSize={props.bs_size}
4545
>
46-
<option value="" disabled hidden></option>
46+
<option value="" disabled hidden>
47+
{props.placeholder}
48+
</option>
4749
{props.options &&
4850
props.options.map(option => (
4951
<option
@@ -62,7 +64,8 @@ const Select = props => {
6264
Select.defaultProps = {
6365
value: '',
6466
persisted_props: ['value'],
65-
persistence_type: 'local'
67+
persistence_type: 'local',
68+
placeholder: ''
6669
};
6770

6871
Select.propTypes = {
@@ -90,6 +93,11 @@ Select.propTypes = {
9093
*/
9194
key: PropTypes.string,
9295

96+
/**
97+
* Placeholder text to display before a selection is made.
98+
*/
99+
placeholder: PropTypes.string,
100+
93101
/**
94102
* The value of the currently selected option.
95103
*/

0 commit comments

Comments
 (0)