angular / angular/components

feat(button): add `expanded` state to extended FAB for smooth collapse/expand transitions

Aperta
#33,041 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub
area: material/button feature gemini-triaged P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

### Feature Description

According to the [Material Design 3 specs](https://m3.material.io/components/extended-fab/guidelines), an extended FAB should be able to smoothly transition between an extended state (capsule shape with text) and a collapsed state (circular shape with icon only) depending on scroll interactions or limited screen space.

I propose adding a new `[expanded]="boolean"` (default `true`) property specifically for the Extended FAB.

* The `extended` property defines the `mat-fab` as an Extended FAB rather than a standard FAB.
* The `expanded` property defines its visual **state** (expanded capsule vs. collapsed circle).

This would apply the necessary CSS transitions when the text label visually disappears in the collapsed state.

### Use Case

I want to implement an expandable/collapsible [Navigation Rail](https://m3.material.io/components/navigation-rail/overview).

When a user interacts with a Navigation Rail to expand/collapse it, the top FAB within that rail should smoothly animate between a collapsed regular FAB and an extended FAB with a text label. Currently, because `mat-fab` lacks an animatable `expanded` state, developers cannot easily recreate this fluid interaction without writing complex custom CSS overrides to hack the fab-label.

Having a native `[expanded]` property would allow developers to seamlessly bind the FAB's state to the Navigation Rail's drawer state, providing a polished and spec-compliant Material 3 experience out of the box.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dall’implementazione dell’extended FAB di Angular Material (`mat-fab`) e dalla sua proprietà `extended` esistente. Verifica il comportamento attuale di rendering di extended e collapsed, quindi definisci il completamento come uno stato `expanded` impostato su true per impostazione predefinita, che transiziona tra la capsula contenente testo e il FAB circolare con la sola icona, secondo il comportamento di Material Design 3 descritto nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.