-
Notifications
You must be signed in to change notification settings - Fork 3.4k
add floating label to md-select #1586
Comments
Regarding to behavior of this material element, this kind of menus appear above all other in-app elements and floating labels relevant only for input elements. For more understanding look into "Do not" section in component behavior. |
Actually I think it should be an option. If you look at the single-line text fields example in the design spec, there are selects with values both with and without floating labels. Perhaps an explicit |
I'd almost suggest the other way round @marcysutton. If a placeholder is defined within the md-select this is the default value displayed when nothing has been selected. the md-select-label is used when you want to transform a key/value pair from key to value. e.g, in a simple md-select placeholder="Country" when nothing has been selected the placeholder shows 'Country', when a value has been selected the placeholder floats and the selected value (or md-select-label) is displayed in the main content section. |
It seems to me you're referring to the label at the top of the selected option,as shown here: Simple menus (see the "Simple menus" section) |
But anyway, you describing different element. As stated in the specification "Menus are positioned over their emitting elements such that the currently selected menu item appears on top of the emitting element. " . And floating label will not be visible until the menu is open. The element you looking for is the label and the predefined option below. |
I think we may be talking at cross purposes, so here is an example. Imagine an app where a user is arranging travel and they have to select the departure and arrival countries... Once the countries are both selected it is no longer clear to the user which is the departure and which is th arrival country as the labels (placeholders) are no longer visible... Once an option has been selected, it would be great for the placeholder to float in the same way as the md-input-container to make it clear to users what the field is they have selected |
I agree with @marcysutton that it should be an option. When used within a form as a "select", a floating label is necessary so that it looks like other "input" element within the form. However, when used as a "menu" (e.g.: in a toolbar), a floating label might not be necessary. |
@sebastiengiroux - thanks, this is exactly what is needed. To make a form consistent it should be possible to put a floating label on the md-select directive. One thing to highlight though with regards to @marcysutton suggestion. the md-select-label is a great tool to transform the displayed value, I would suggest this is only ever used to display the selected value, transformed as required. The placeholder attribute on the md-select itself it the one to float as this is what describes the content of the select. |
+1 Select and it's multiple variant, are common form items. It would be nice to have the consistent floating label to match inputs and 100% width. I imagine it could be accomplished by a wrapper div, similar to how the md-input-container interacts with md-input. |
+1 |
I agree with @hodeyp that "the md-select-label is a great tool to transform the displayed value". I think that we could achieve the floating label by wrapping the "md-select" within a "md-input-container" (as mentioned by @mtraynham), and still keep the "md-select-label". |
Good discussion here. We certainly need to have our selects in forms with inputs and they should be able to be side-by-side with a similar look. |
It would be great to also have a way to make an input looking like Or simply make <md-autocomplete md-items='item in []'/> It could be used for example to filter elements in a list, or others features where an input is used outside of an usual form. |
When is this enhancement getting released? Any idea ? |
As a temporary workaround to the floating label issue, I was able to get md-select to look similar to an input with a value inside of md-input-container > md-select {
flex: 1;
order: 2;
margin: 0;
} And adding the <md-input-container class="md-input-has-value">
<label>Something</label>
<md-select>...</md-select>
</md-input-container> It doesn't perform the animations when a select has no value and I haven't tried integrating |
@mzbyszynski Thanks for alluding to that. To expand on your temporary workaround, you could probably
I'm under the impression that |
Also one thing to point out, the animation is probably unnecessary because the menu pop-up will cover the full length of the form field. I altered @mzbyszynski's solution to get it working. One unresolved issue, when no value is selected, the
|
@mzbyszynski I am trying the workaround suggested, but the label is under the md-select. Here a plunker http://plnkr.co/edit/aBdqOHKnbw1tkpcWCusI?p=preview |
Looking forward to a milestone. |
@pvsilvestrin http://plnkr.co/edit/fqEfSUXWuroNAO0UbA5O?p=preview You forgot to include the stylesheet. I've made some minor changes:
As I mentioned, you need to have the |
I have had issued putting md-selects inside the md-input-containers. The solution I came up with is a simple directive that I put on the wrapping div of the label/md-select that accomplishes the same thing.... I can share if desired. |
+1 |
+1 |
There's a pull request in for this now #3307 |
Hi guys. I have one small but severe doubt.. this works fine...but when i am scrolling and selecting the input it is being gradually displayed on top and it is changing (the selectable box)...please help me. |
I able to fix it by giving height:auto to the body...but we open the md-select in the browser I am able to scroll. but that should not happen right..when we click on it , it shold not allow srolldown and up ...please help |
+1 |
I am new what you mean by +1, are you adding this issue? |
@vasanthB5 this means plus one vote to have the issue resolved. |
I understand it to mean "I too am experiencing this issue and would like it fixed if at all possible" Sent from Yahoo Mail on Android From:"vasanthB5" notifications@github.com I am new what you mean by +1, are you adding this issue? — |
@vasanthB5 Yes, +1 to resolve this issue. |
+1 |
@jmcpeak it's on master! |
Looks great - thanks Spoke too soon, it is not lining up properly for me - hmmm |
+1 |
Hi guys..can you please tell me should I download any thing that rschmukler had done..to check whether its working or not? |
or should go with what he had stated to do.. |
Download the latest master and try that. Looks great @rschmukler ! |
Can I get the complete min.js / min.css so that I can test it on my side.. |
If you use Bower to get the package (use "master" as version), it will include the minified JS/CSS. |
Bower is indeed the best way to grab the latest. Big ups to @MagicIndustries for all of his work on this! Thanks again. |
I just installed the master version of angular-material, and I'm having a bit of trouble. Previously, the EDIT: I just realized this page might not be the best place to put this question, but as it was working before this change and stopped afterward... If I need to open a new issue about this, please let me know. |
@NeoRyu777 that is a separate issue. #3055, #3167 and a couple others |
@ngraef Thanks, I'll go ahead and put those on my watch list. |
Due to some access restrictions I cannot install node and npm and all....please can anyone tell to get the .min.js/.min.css for this material design updated so that I can just include them and try..:( |
You can get the latest builds here: https://github.com/angular/bower-material |
Hi, In the previous version it was possible to define a custom displayed label. That was useful for multiple select options. Because I don't want the text to enlarge, but instead have a label like : 'selection: 2'. Is there another way to achieve this with the new implementation? I have also an issue, I can have the select to fill the space of the input-container. Thanks a lots it's a great job, I really appreciate the new render. |
I did what @mzbyszynski mentioned on Feb 26. This allows both the code for a select and the rendered page to look very much like a regular input. |
What i have to Pass? |
When an md-select has a value, the placeholder should be used as a floating label to keep consistent with the md-input directive
The text was updated successfully, but these errors were encountered: