material icon indicating copy to clipboard operation
material copied to clipboard

md-datepicker should support md-input-container and floating label

Open kuhnroyal opened this issue 11 years ago • 115 comments

Currently the datepicker doesn't align well with other input fields. It would be nice if we can do something like

<md-input-container>
    <label>Date</label>
    <md-datepicker ng-model="myDate"></md-datepicker>
</md-input-container>

and have everything well aligned with other form fields. Also the icon should be optional.

kuhnroyal avatar Aug 19 '15 10:08 kuhnroyal

Possibly dupe of #3234 for the issue with md-input for the alignment.

jelbourn avatar Aug 19 '15 21:08 jelbourn

+1 When used in md-input-container it seems that the class md-input-has-value is not added which causes text color to be transparent

dterbeest avatar Aug 21 '15 10:08 dterbeest

+1

All input should have the same behavior, and with the current version if we don't define an external label and the field is already set there's no way to know what the date is for (place holder not visible anymore)

Thanks.

no-more avatar Sep 09 '15 10:09 no-more

This is going to be addressed along with #3234 for 0.12 as the two issues are interrelated.

jelbourn avatar Sep 14 '15 23:09 jelbourn

In case this helps, this is my SASS hack to line-up md-datepicker with other inputs that have icons. Also, as people mentioned don't put it inside a md-input-container.

form {
  md-datepicker {
    position: relative;
    left: -16px;

    .md-datepicker-input-container{
      margin-left: 0;
    }
    .md-datepicker-button.md-icon-button {
      margin-right: 0;
    }
  }
}

arlowhite avatar Sep 16 '15 22:09 arlowhite

+1

@arlowhite Thanks for sharing. I got something similar. This one handles the height difference too, though not without consequences as noted:

// Match styling of md-datepicker with other inputs using md-no-float and icons: https://github.com/angular/material/issues/4233
// TODO: The popup does not open from the correct location anymore
// TODO: The popup 'input mask' element is transparent on the left and other input elements (including the icon) are visible in the background.
md-datepicker {
    padding-top: 3px;
    > button.md-datepicker-button.md-icon-button.md-button {
        margin-left: 0px;
        margin-right: 0px;
        width: 30px;
        height: 30px;
        line-height: 30px;
        min-height: 30px;
    }
    > div.md-datepicker-input-container {
        margin-left: 8px;
        padding-bottom: 4px;
    }
    &.md-datepicker-open > div.md-datepicker-input-container > input.md-datepicker-input { // Stop the jumping on open
        height: inherit;
        margin-left: 20px;
        // tabindex needs to be -1: https://github.com/angular/material/issues/4755
    }
}

ghost avatar Sep 21 '15 17:09 ghost

+1

guilhermecvm avatar Oct 31 '15 23:10 guilhermecvm

+1

Judis avatar Nov 02 '15 13:11 Judis

It is not clear to me from following the various threads related to md-datepicker whether or not it should be coded as described in the original post of this issue. It certainly looks like the right way to go, but doesn't work correctly in rc3. Is it going to be fixed in rc4? I would like to be able to use this syntax and know that it will work in the future.

kpgarrod avatar Nov 09 '15 14:11 kpgarrod

@kpgarrod the syntax in the description doesn't work at the moment, this issue is about getting this syntax in

kuhnroyal avatar Nov 09 '15 16:11 kuhnroyal

@kpgarrod The documentation always gives the canonical usage of the component.

jelbourn avatar Nov 09 '15 18:11 jelbourn

@kuhnroyal @jelborn Thanks. I understand that. My point is that I would like to know if there is an imminent plan for the implementation of this change, if indeed the change has been accepted. The datepicker doesn't work for me as is, so I was looking at alternative datepickers. If this change and the one enabling the selection of years were implemented, I would be able to use this datepicker which is obviously preferable. It is just not clear to me whether that is going to happen in rc4 or not.

kpgarrod avatar Nov 09 '15 18:11 kpgarrod

+1

ghost avatar Nov 17 '15 16:11 ghost

There's no way to know what the date is for (place holder not visible anymore).

cleever avatar Nov 20 '15 17:11 cleever

+1

isyun avatar Nov 20 '15 19:11 isyun

+1

michaelkrog avatar Nov 26 '15 22:11 michaelkrog

+1

vladimir-novoseltsev avatar Nov 30 '15 10:11 vladimir-novoseltsev

+1

snowping avatar Dec 01 '15 16:12 snowping

+1

rbosneag avatar Dec 02 '15 12:12 rbosneag

+1

rudzikdawid avatar Dec 02 '15 13:12 rudzikdawid