[DatePicker] Remove helperText default value, document it
See original GitHub issueSteps 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:
- reduce duplication of information: placeholder + input mask should be good enough.
- reduce the height of the input takes by default. It might not fit into people’s layout.
- encourage the usage of the helper text for related information regarding the field.
Actual behavior
Environment
Tech | Version |
---|---|
@material-ui/lab | v5.0.0-alpha.16 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:30 (22 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is an option. Pass
helperText={null}
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.