Material-ui: [DatePickerDialog] Expose DatePickerDialog and allow it to be controlled via a prop

Created on 3 Aug 2016  Â·  4Comments  Â·  Source: mui-org/material-ui

The DatePickerDialog is a very nice date picker component. Currently, it's only available to be used internally in the DatePicker component. It would be nice to have it as a component that can be used by consumers of material-ui, not just internally.

I also think that the open state should be controlled via a prop. It's pretty nasty to have the component only be able to opened / closed via instance methods.

duplicate

Most helpful comment

That's not true.

Nowhere in Material Design does it say that the DatePicker must be linked to a TextField as is done in material-ui. The spec you linked to actually only shows the DatePicker as a standalone dialog. It's completely unrelated to the TextField.

By linking the DatePickerDialog to the TextField you eliminate certain ways of calling up the DatePicker and displaying it's value, and it's not defined in the spec that I should not be able to use the DatePicker outside of the context of a TextField.

You've chosen to call them DatePicker and DatePickerDialog, but in reality DatePickerDialog is the actual component that's defined in the spec. DatePicker in material-ui is forcibly linking the DatePickerDialog to a TextField which is not referenced as a component or pattern anywhere in the Material Design spec.

All 4 comments

@clayne11 There is no such component as DatePickerDialog defined in Google's Material Design. It is just there to support the DatePicker in MUI. So, I think there is no need for making DatePickerDialog as a separate component. It would just be redundant. Here's a useful link: https://material.google.com/components/pickers.html#

The second part of the issue should be resolved after this PR: https://github.com/callemall/material-ui/pull/4961

That's not true.

Nowhere in Material Design does it say that the DatePicker must be linked to a TextField as is done in material-ui. The spec you linked to actually only shows the DatePicker as a standalone dialog. It's completely unrelated to the TextField.

By linking the DatePickerDialog to the TextField you eliminate certain ways of calling up the DatePicker and displaying it's value, and it's not defined in the spec that I should not be able to use the DatePicker outside of the context of a TextField.

You've chosen to call them DatePicker and DatePickerDialog, but in reality DatePickerDialog is the actual component that's defined in the spec. DatePicker in material-ui is forcibly linking the DatePickerDialog to a TextField which is not referenced as a component or pattern anywhere in the Material Design spec.

@clayne11 I'm closing this issue as a duplicate #4587. Still, I pretty much agree with you.
I'm gonna open an umbrella issue regarding how we could improve the composability.

By the way, I'm really impressed by https://www.casalova.com. That's the best Material-UI app I have seen so far ✨ . I think that it would be great to add it to the _Showcase_ section fo the docs.
I also feel like it's the right timing to create a _Featured_ section.
cc @callemall/material-ui.

Thanks! You're more than welcome to add our app to the _Featured_ section. I'll pass on the nice comment to our designer, she'll be happy to hear that :)

Was this page helpful?
0 / 5 - 0 ratings