angular / angular/components

feat(Menu): Option to have it the same width as the trigger

未关闭
#30,862 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/menu feature P4
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### Feature Description

A possibility to have the https://material.angular.io/cdk/menu/overview take over the width of the container that triggers it.
As an example the grey area should span the full width of the red in the following example:

Image

Currently it seems that you have to provide a fixed width in px. Otherwise it does not work. But you don't always know the exact with of the 'trigger'.

There's an example here: https://vbqdncww.stackblitz.io

In [issue 26336](https://github.com/angular/components/issues/26336) it seems that they are overriding MAT_SELECT_CONFIG to set a `min-width: min-content;`, but have not gotten that to work yet.

### Use Case

It would enable a more consistent styling.

贡献指南

打开贡献指南

调研方向

从 Angular CDK 菜单概览和 StackBlitz 示例开始,以复现当前的尺寸行为;issue 26336 提供了有关菜单宽度配置的相关背景。完成的标准是菜单可以采用触发器容器的宽度,而不要求固定的像素宽度,并且在适当的示例或测试中演示该行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。