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.

Positioning of react-date-picker

See original GitHub issue

Hi,

I am using this library and like it for it’s simplicity and easy to use features. And now am stuck at one point. Check the image attached date picker

As you can see the top part is hidden behind my menu bar.

How can I position it to open somewhere else or modify the css myself to adjust it’s position.

I have made a reusable component using this date picker, code is below:

import React from 'react';
import DatePicker from 'react-date-picker';

const CustomDatePicker = ({dtVal, handleChange}) => {
  return (
      <>
        <DatePicker
          onChange={handleChange}
          value={dtVal}
          clearIcon={null}
          format="dd/MM/yyyy"
          className="mr-2"
        />
     </>
  );
};

export default CustomDatePicker;

And it is being used like this:

<LabelContainer className="mr-2"> Visited On:</LabelContainer>
<CustomDatePicker 
  calendarClassName="calender-custom-position" 
  className="ml-4" 
  dtVal={visitDate}
  handleChange={onDateChange}
/>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
sullyslegacycommented, Mar 11, 2020

I agree had to add

.react-date-picker__calendar--open {
  top: 100% !important;
  bottom: unset !important;
}

so Date Picker always shows under input

1reaction
benesva4commented, Nov 24, 2020

Try to give it position: fixed;

Read more comments on GitHub >

github_iconTop Results From Across the Web

I want to change the position of the calendar · Issue #1246
The calendar is hidden on the smartphone. Can you adjust the position? ... The react-datepicker library uses react-popper found here:.
Read more >
I'm having trouble with react-datepicker position
@emi yes, I've tried that but the className for the datepicker, which is .react-datepicker-popper does not apply the z-index property.
Read more >
React Suite DatePicker Usage Placement
The placement prop of the React Suite DatePicker component defines the position of the DatePicker. It takes these values – 'bottomStart', ' ...
Read more >
React Datepicker crafted by HackerOne
A simple and reusable datepicker component for React. Installation. The package can be installed via NPM: npm install react-datepicker --save. Or by using...
Read more >
react-datepicker float position - Code Examples & ...
react -datepicker float position ... Have the same issue. Want to move it left depends on input position. Someone know how to do...
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