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.

SingleDatePicker: Can't Set Input Width to 100% of Container

See original GitHub issue

Hi,

I’m using the SingleDatePicker component and need to have the input stretch to 100% of the width of the container my form is in (which is a fluid container, so I can’t use a px/em-based value). The sass variable that appears designed for setting the input’s width, $react-dates-width-input, doesn’t seem to cover this case, because the .DateInput is inside a .SingleDatePicker, which has display: inline-block. Setting the variable to 100% gives the .DateInput a width of 100%, but that’s not 100% of the .SingleDatePicker’s container, due to the inline-block.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

6reactions
dknellcommented, May 2, 2018

@kimfucious I was able to fix the showDefaultInputIcon={true} and block bug by overriding the css (below is sass, so adjust accordingly):

.SingleDatePicker {
    .DateInput__block {
        width: 100%;
        padding-right: 42px;
    }

    .SingleDatePickerInput_calendarIcon {
        position: absolute;
        right: 0;
        padding: 0 10px;
        line-height: 50px;
    }
}
5reactions
majapwcommented, Nov 30, 2017

This is now very easy in v15.3.0 by just setting the block prop on the SDP or the DRP 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

SingleDatePicker: Can't Set Input Width to 100% of Container
Hi, I'm using the SingleDatePicker component and need to have the input stretch to 100% of the width of the container my form...
Read more >
react-datepicker input width will not adjust to 100%
I would just like to make the input width 100% of its containing div. Expected behavior. The width should expand to the width...
Read more >
React custom datepicker: Step-by-step - LogRocket Blog
Set up a robust and attractive datepicker in React that acts as an alternative to the native HTML5 datepicker input element.
Read more >
Date Range Picker for Bootstrap
The Date Range Picker is attached to a text input. It will use the current value of the input to initialize, and update...
Read more >
Datepicker font control - Dash Python - Plotly Community Forum
You may be able to do this by setting the font-size of the parent component with something ... How can the input date...
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