Configurable "empty" value for TextField / Select
See original GitHub issue- [x ] I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
I should be able to designate values other than empty string to trigger “no selection” behaviors when using <TextField> in select mode.
Current Behavior
The <TextField> component only expands its label when a <MenuItem> with value "" is selected.
Context
The models managed by my back end APIs often have a specific value to indicate that no selection has been made, particularly for non-string values. Sometimes it’s -1, other times it’s “unknown”. Of course there is nothing stopping me from adding MenuItems with these values to my layout, but the TextField has special behaviors (eg. enlarging the label component) that only trigger when a MenuItem with an empty string value is selected.
So: what do you think about providing something like an emptyValue configuration property? By default, of course, it would be set to empty string.
If you don’t actively object to the idea I’ll open a PR. Let me know what you think, and thank you for your time.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
Tell you what; I’ll post some before and after code this evening so we can make sure we both have the same understanding. Maybe you can show me where I’m being silly.
I have added the
waiting for users upvotestag. I’m closing the issue as I’m not sure people are looking for such abstraction. So please upvote this issue if you are. We will prioritize our effort based on the number of upvotes.