react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

[Request] Add a direction prop to set which way the picker opens

Open MrLeebo opened this issue 8 years ago • 11 comments

This is a new feature request. If you position the Datetime control towards the bottom of the page, the picker will appear below it and off the page entirely, forcing the user to scroll before they can make a selection. I hope it would not be too much trouble to add a direction prop which could take oneOf(['up', 'down', 'left', 'right']) and position the picker in that direction relative to the input.

<Datetime direction="up" />

MrLeebo avatar Oct 19 '16 19:10 MrLeebo

Hi @MrLeebo. I've also had the specific problem you are mentioning, you can solve it using JS. Maybe even HTML using an anchor? But about your suggestion, I think the idea is good. If you'd like to create the code I'd be happy to review the PR.

simeg avatar Oct 19 '16 20:10 simeg

I created the issue because I don't think I have time to learn the repo and implement this right now, but if that changes I will open up a PR.

MrLeebo avatar Oct 20 '16 14:10 MrLeebo

+1

Will also try to spin up a PR...

danosborne avatar Nov 09 '16 17:11 danosborne

A tip: use react-date-playground for development (check the README).

simeg avatar Nov 09 '16 18:11 simeg

Hacked for 5 mins and opened the PR above. Are people happy with the approach?

If so I will tidy it up and actually follow the contributing guidelines etc. ;-)

danosborne avatar Nov 10 '16 09:11 danosborne

For me direction prop is misleading. I understand direction as left-to-right or right-to-left settings. Maybe position is better idea for name of this feature?

Krzyku avatar Jun 02 '17 18:06 Krzyku

I agree. Bootstrap Popover/Tooltip/Overlay uses prop placement with values top, bottom, left and right. Can we use the same prop name with top and bottom?

bjbrewster avatar Oct 01 '17 22:10 bjbrewster

placement sounds good to me. Will try to find time for looking into this soon.

simeg avatar Nov 05 '17 21:11 simeg

any updates?

kostiantyn-solianyk avatar Nov 23 '18 16:11 kostiantyn-solianyk

Is there a workaround to get the date picker above the input field?

Bramgus12 avatar Feb 05 '21 08:02 Bramgus12

To move the date picker above the input, just add bottom: 100%; style to the . rdtPicker class. (Caveat in case it matters: this is version 2.14.0 pictured.)

Screen Shot 2022-09-06 at 11 19 39 AM

jvnlwn avatar Sep 06 '22 15:09 jvnlwn