Skip to content

<mat-optgroup> component with image #11489

@super-jb

Description

@super-jb

Bug, feature request, or proposal:

Proposal: allow component to have an icon / image besides the text

What is the expected behavior?

Something like:

<mat-optgroup *ngFor="let group of categories | async" [label]="group.category">
   <img src="{{group.symbol}}" />
   <mat-option *ngFor="let elem of group.elements" [value]="elem">
      {{ elem }}
    </mat-option>
</mat-optgroup>

What is the current behavior?

Currently, component renders as a label

<mat-optgroup *ngFor="let group of categories | async" [label]="group.category">
   <mat-option *ngFor="let elem of group.elements" [value]="elem">
      {{ elem }}
    </mat-option>
</mat-optgroup>

What are the steps to reproduce?

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

In my case, trying to group elements into categories, and I'd like to display each category icon / image alongside the text

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

All

Is there anything else we should know?

Not that I'm aware

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions