Skip to content

feat(mat-select): In MatSelectConfig add a new possible value for panelwith: 'GrowIfLargerThanTriggerWidth' #31760

@Yanal-Yves

Description

@Yanal-Yves

Feature Description

Currently MatSelectConfig offers the panelWidth property with 3 possible values :

  1. 'auto' - The panel will match the trigger width.
  2. A specific value (ex : 40px)
  3. null - The panel will grow to match the longest option's text.

What I need is a mix between auto and null :

  1. If the longest option's text is bigger than the trigger width, the panel would grow to match the longest option's text.
  2. If the longest option's text is smaller than the trigger width, the panel would match the trigger width

I suggest to name this new behavior: GrowIfLargerThanTriggerWidth

Use Case

If the options of the MatSelect are data driven (ex: coming from a database), we cannot define a specific width for the panel. None of the possible values of panelWidth offer a satisfying result :

Ex1: panelWidth: 'auto', with small options
Image

Ex2: ``panelWidth: 'null', with large options
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/selectfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions