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.

[DatePicker] Remove helperText default value, document it

See original GitHub issue

Steps to reproduce

function App() {
  const [value, setValue] = React.useState(null);

  return (
    <LocalizationProvider dateAdapter={DateFnsUtils}>
      <DatePicker
        value={value}
        onChange={newValue => {
          setValue(newValue);
        }}
        renderInput={props => <TextField {...props} />}
      />
    </LocalizationProvider>
  );
}

https://codesandbox.io/s/condescending-hoover-m5jk7?file=/index.js:234-580

Expected behavior

Should the helperText have a value by default? It feels strange. I think that we should remove it to:

  1. reduce duplication of information: placeholder + input mask should be good enough.
  2. reduce the height of the input takes by default. It might not fit into people’s layout.
  3. encourage the usage of the helper text for related information regarding the field.

Actual behavior

Capture d’écran 2020-05-06 à 21 17 55

Environment

Tech Version
@material-ui/lab v5.0.0-alpha.16

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:30 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
dmtrKovalenkocommented, May 13, 2020

There is an option. Pass helperText={null}

3reactions
taschettocommented, May 13, 2020

I’m experimenting with 4.0.0-alpha.7 and it’s very good. I understand the purpose on showing the format by default, but my users are all on the same locale and we have a pretty strong date format default. So the helperText with the format is undesirable. +1 for at least having an option to disable.

EDIT:

Also I use the Textfield helperText prop to show validation messages from others sources (like async validations from the server) and the picker forcing it doesn’t allow me to do that anymore.

Thus I think the helperText should be managed by the developer and not by the lib.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[DatePicker] Remove helperText default value, document it
Should the helperText have a value by default? It feels strange. I think that we should remove it to: reduce duplication of information: ......
Read more >
How to remove default selected date in DatePicker materialUI?
When I open the calendar by clicking a textbox for the very first time, I don't want today's date to be selected and...
Read more >
React Date Picker component - MUI X
The date picker let the user select a date. Date pickers are displayed with: Dialogs on mobile; Text field dropdowns on desktop. Basic...
Read more >
Date Picker Control Settings - ProcessMaker Documentation
Enter the default value as text or use a Request variable in mustache syntax.
Read more >
KeyboardDatePicker API - Material-UI Pickers
Name Type Default onChange * (date: DateIOType, value?: string | null) => void value * ParsableDate allowKeyboardControl boolean true
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