Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: custom view value for select and autocomplete #5067

Closed
xuanshenbo opened this issue Jun 11, 2017 · 6 comments
Closed

Feature request: custom view value for select and autocomplete #5067

xuanshenbo opened this issue Jun 11, 2017 · 6 comments
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs: discussion Further discussion with the team is needed before proceeding

Comments

@xuanshenbo
Copy link

xuanshenbo commented Jun 11, 2017

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Select and Autocomplete allow custom view values, for example:
https://material.io/guidelines/components/menus.html#menus-usage
capture

This Menu allows icons in addition to text.
I understand the example is a Menu not Select or Autocomplete, but they are under the same category in Material Design

What is the current behavior?

The values are limited to strings, and doesn't allow custom layout inside the Select and Autocomplete dropdown.

What is the use-case or motivation for changing an existing behavior?

As per the example screenshot.

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

Material 2.0.0-beta.6

@xuanshenbo xuanshenbo changed the title Feature request: custom value for select and autocomplete Feature request: custom view value for select and autocomplete Jun 11, 2017
@julianobrasil
Copy link
Contributor

julianobrasil commented Jun 11, 2017

Have you try something like:

<div>
    text to the left
    <div style="float: right">text to the right</div>
</div>

In the autocomplete md-option? It works with text. Maybe it works with icons too (material icons or font awesome).

@julianobrasil
Copy link
Contributor

Take a look at this plunker: https://plnkr.co/edit/v3EoZp?p=preview

image

@xuanshenbo
Copy link
Author

@julianobrasil that looks great thanks!

However I accidentally noticed that your code doesn't work on Firefox 53.0.3

Can you raise a bug for that?

Thanks!

@julianobrasil
Copy link
Contributor

julianobrasil commented Jun 11, 2017

I think it's an issue with nested divs in Firefox. I modified the plunker. This will work both in Chrome, Firefox, Edge and IE:

<div>
      <div style="float: left;">{{ state }}</div>
      <div style="float: right;">
            <i class="material-icons" style="font-size: 15px">add_location</i>
            {{state}}
      </div>  
</div>

@jelbourn jelbourn added discussion feature This issue represents a new feature or feature request rather than a bug or bug fix labels Jun 20, 2017
@mmalerba mmalerba added needs: discussion Further discussion with the team is needed before proceeding and removed discussion labels Mar 3, 2020
@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@jelbourn
Copy link
Member

Closing this since I believe it's doable today (it would just be your mat-option template). Free free to open another issue if that's not the case.

@mmalerba mmalerba removed the needs triage This issue needs to be triaged by the team label Jun 5, 2020
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs: discussion Further discussion with the team is needed before proceeding
Projects
None yet
Development

No branches or pull requests

4 participants