How to increase the width of an AngularJS Material datepicker
Asked Answered
P

4

6

I have something like this:

Screenshot of 2 inputs (A "Date of recruitment" date picker input and a "months" input)

How is it possible to make the line under the "Date of recruitment" and the "down array" adapt to half of the layout as in flex="50" for example. It is pretty easy for normal input fields.

Current markup:

<md-content layout-padding> 
 <form> 
  <div layout-gt-xs="row"> 
   <md-input-container class="md-block" flex-gt-xs> 
      <label> date </label> 
      <md-datepicker ng-model="cv.contract.dateOfRecruitment"></md-datepicker> 
   </md-input-container>
   <md-input-container class="md-block" flex-gt-xs> 
      <label> months </label> 
          <input required ng-model="cv.contract.months" ng-pattern="/^[1-9][0-9]*$/" /> 
   </md-input-container> 
  </div>
 </form> 
</md-content>
Prothesis answered 13/9, 2016 at 10:58 Comment(2)
Can you share the markup you are using currently pleaseUndercut
Yeah sorry, I have added the markup to the question.Prothesis
E
1

See these tickets:

This feature won't be implemented due to layout troubles. But there's a workaround solution described here

Eat answered 10/6, 2017 at 14:16 Comment(0)
C
1

There is no official documentation. You could consider using custom CSS.

Try to add width: 100% to the container of the date picker. It will increase width certainly. Of course, it assumes that the parent container of date picker is divided by half-width(50%) each other.

Carpentaria answered 13/11, 2019 at 14:4 Comment(0)
S
0

Adding this property as !important worked for me

mat-form-field {
  width: 100px !important;
}
Sedimentation answered 13/11, 2019 at 13:47 Comment(0)
P
0

You can set the size of the datepicker:

<input class="md-datepicker-input md-input" id="input_58" size="50">
Purvey answered 12/3, 2020 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.