Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datepicker] - add ok and cancel button #1795

Closed
2 tasks done
hadasmaimon opened this issue May 20, 2020 · 7 comments
Closed
2 tasks done

[Datepicker] - add ok and cancel button #1795

hadasmaimon opened this issue May 20, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@hadasmaimon
Copy link

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I don't know why I don't find how to add the ok cancel button (It works in the past)
image

Expected Behavior 🤔

expected to have the ok and cancel buttons.
image

Context 🔦

image

Your Environment 🌎

Tech Version
Material-UI v 4.0.0-alpha.7
React
Browser
TypeScript
etc.
@hadasmaimon hadasmaimon changed the title [Datepicker] [Datepicker] - add ok and cancel button May 20, 2020
@oliviertassinari oliviertassinari transferred this issue from mui/material-ui May 20, 2020
@dmtrKovalenko
Copy link
Member

There is no way to display dialog buttons on the desktop with <DatePicker />.
The only option is to use MobileDatePicker.

@oliviertassinari
Copy link
Member

oliviertassinari commented May 20, 2020

A couple of buttons and there use cases that come to mind for the date picker:

  • "OK" when we don't want the "autoOK" behavior
  • "Today" bottom when we get lost
  • "Clear" if we want to reset the value to null

That could potentially be useful. I don't know if it's something that should be built-in, or only provide a customization point for doing it.

@dmtrKovalenko
Copy link
Member

We could think about some option to render anything after the calendar. It could be helpful for buttons or displaying related helper information for users. Something like renderBottomInfo.

For instance react-dates have the following prop

<DateRangePickerWrapper calendarInfoPosition="bottom" renderCalendarInfo={renderCalendarInfo} autoFocus />

http://airbnb.io/react-dates/?path=/story/drp-calendar-props--with-info-panel-bottom

@oliviertassinari
Copy link
Member

oliviertassinari commented May 20, 2020

A random thought on the possible API:

<DatePicker
  renderPopup={(props) => {
    <div>
      <StaticDatePicker {...props} />
      <Button>OK</Button>
    </div>
  }}
/>

@hadasmaimon
Copy link
Author

good thanks!

@Jesusz0r
Copy link

Jesusz0r commented Jun 2, 2020

how can I override the 'OK' and 'Cancel' text from KeyboardDatePicker?

@hadasmaimon
Copy link
Author

hadasmaimon commented Jun 2, 2020

What do you want to do? do you want to change the ok text? if yes use the okLabel
image

okLabel='Done'

@oliviertassinari oliviertassinari added the enhancement New feature or request label Jun 15, 2020
Jenselme pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Jun 26, 2020
This allows us to render anything after the calendar (buttons, text…)
by passing the renderCalendarInfo props to DateRangePicker.
Jenselme pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Sep 7, 2020
This allows us to render anything after the calendar (buttons, text…)
by passing the renderCalendarInfo props to DateRangePicker.
Jenselme pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Sep 7, 2020
Jenselme pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Sep 8, 2020
This allows us to render anything after the calendar (buttons, text…)
by passing the renderCalendarInfo props to DateRangePicker.
Jenselme pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Sep 8, 2020
Ruffle pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Jan 18, 2021
This allows us to render anything after the calendar (buttons, text…)
by passing the renderCalendarInfo props to DateRangePicker.
Ruffle pushed a commit to BureauxLocaux/material-ui-pickers that referenced this issue Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants