components icon indicating copy to clipboard operation
components copied to clipboard

md-select does not show title/description/placeholder

Open ceverke opened this issue 9 years ago • 7 comments

Bug, feature request, or proposal:

I use the md-select component. Unfortunatelly,, the placeholer is not captioned when the component is loaded. It's only shown when an item is selected.

What is the expected behavior?

When the following example is loaded, I expect to see the caption "Favorite food" above the component see here: https://material.angular.io/components/select/examples

What is the current behavior?

see here: https://material.angular.io/components/select/examples

What are the steps to reproduce?

see description above

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material 2.0.0-beta.8

ceverke avatar Sep 21 '17 10:09 ceverke

I can see the placeholder perfectly fine on the examples page.

pjmagee avatar Sep 21 '17 11:09 pjmagee

@pjmagee I think @ceverke confuses placeholders with labels. 'Favorite food' is a placeholder.

donroyco avatar Sep 21 '17 11:09 donroyco

I'm sorry for confusing. After an item is selected, then "Favorite food" can be read in small letters above the component (as some kind of label). But in my case it's desired to have the small caption (label) of the component already after loading the page (before an item is selected).

ceverke avatar Sep 21 '17 12:09 ceverke

(or is it a feature of the component because otherweise the placeholder would be displayed twice??)

ceverke avatar Sep 21 '17 14:09 ceverke

This behaviour is described in the material design guidelines

  • Labels/placeholder rest above the line when the text field is empty.
  • Labels/placeholder float upward when the text field is in focus or filled.

But you can use the option floatPlaceholder="always" of md-form-field for your needs.

<md-form-field floatPlaceholder="always">
    <input mdInput #testInput placeholder="Name">
</md-form-field>

ghd8 avatar Sep 21 '17 16:09 ghd8

OK, sorry... didn't realy read about it... sorry

ceverke avatar Sep 21 '17 17:09 ceverke

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.