angular / angular/components

feat(mat-select): add smart panel width based on trigger and largest option size

Open
#29,569 1 comment 3 reactions 0 assignees View on GitHub
area: material/select feature P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Feature Description

Currently `panelWidth` can be one of three:
1. Trigger width
2. Largest option width
3. Custom provided width in numbers

What I am missing is - minimum width as trigger width and grow until max option size (if needed)

### Use Case

When having dynamic options texts sometimes they might be larger than trigger width and I want the largest option behavior.
Sometimes they are smaller than trigger width and I want the trigger width behavior to avoid really small select panels.
Which means I actually need: min panel width = trigger width with potential grow (not shrink!) to the largest option width.

Can be with a new `panelWidth` option or even `minPanelWidth` input (can have a complimenting `maxPanelWidth` too for completeness)

Contributor guide

Open the contributing guide

Research direction

Start by reading mat-select's existing panelWidth handling and the trigger-width and largest-option behaviors described in the issue. Define and implement an API or option that keeps the panel at least as wide as the trigger while allowing it to grow to the largest option, then verify the behavior for both wider and narrower options.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.