question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shmaxcommented, Apr 9, 2018

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.

0reactions
oliviertassinaricommented, Apr 10, 2018

I have added the waiting for users upvotes tag. 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configurable "empty" value for TextField / Select · Issue #10973
I should be able to designate values other than empty string to trigger "no selection" behaviors when using <TextField> in select mode. Current ......
Read more >
Material-ui Textfield null value for zero - Stack Overflow
My problem is that when the value number zero passes, it's considered as a false value and renders an empty string. I want...
Read more >
TextField API - Material UI - MUI
Name Type Default autoComplete string autoFocus bool false classes object
Read more >
UITextField | Apple Developer Documentation
Configure the keyboard-related attributes of the text field. ... If the selection range can't be applied to the current text, no selection is...
Read more >
<input>: The Input (Form Input) element - HTML
A push button with no default behavior displaying the value of the value attribute, empty by default. ... A check box allowing single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found