md-datepicker should support md-input-container and floating label
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.
Possibly dupe of #3234 for the issue with md-input for the alignment.
+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
+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.
This is going to be addressed along with #3234 for 0.12 as the two issues are interrelated.
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;
}
}
}
+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
}
}
+1
+1
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 the syntax in the description doesn't work at the moment, this issue is about getting this syntax in
@kpgarrod The documentation always gives the canonical usage of the component.
@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.
+1
There's no way to know what the date is for (place holder not visible anymore).
+1
+1
+1
+1
+1
+1