Skip to content

feat(material/button): add collapsed option for extended FAB#33065

Open
jexjws wants to merge 4 commits intoangular:mainfrom
FairyLightsStudio:add-expanded-option-for-extendedFAB
Open

feat(material/button): add collapsed option for extended FAB#33065
jexjws wants to merge 4 commits intoangular:mainfrom
FairyLightsStudio:add-expanded-option-for-extendedFAB

Conversation

@jexjws
Copy link
Copy Markdown

@jexjws jexjws commented Apr 10, 2026

Description

Adds a new @Input() collapsed property to the extended MatFabButton.

This enables developers to dynamically collapse an extended FAB into a traditional circular FAB visually (hiding the text label with an animated transition while preserving the icon).
By default, collapsed is unconditionally false for all extended FABs to preserve backward compatibility.

Related changes:

  • Included animations using M3 motion tokens (md-sys-motion-values).
  • Added unit tests to verify the application of the mat-mdc-extended-fab-collapsed class.
  • Updated button.md documentation.
  • Added interactive examples to the dev-app button demo.

Screenshots

Expanded (Default) image
Collapsed image

Related issues

Fixes #33041

Adds the `expanded` input to the extended FAB component, allowing developers to collapse the extended FAB down to a regular circular shape while hiding the text label via animations. By default, `expanded` is `true`.
@pullapprove pullapprove bot requested review from andrewseguin and crisbeto April 10, 2026 06:24
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: material/button labels Apr 10, 2026
@jexjws jexjws marked this pull request as draft April 10, 2026 06:44
@jexjws jexjws force-pushed the add-expanded-option-for-extendedFAB branch from f8b9d52 to 362f2a0 Compare April 10, 2026 07:11
@jexjws jexjws marked this pull request as ready for review April 10, 2026 07:35
@Input({transform: booleanAttribute}) extended: boolean = false;

/** Whether the extended-FAB is currently expanded. Has no effect on non-extended FABs. */
@Input({transform: booleanAttribute}) expanded: boolean = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from the extended input above?

Copy link
Copy Markdown
Author

@jexjws jexjws Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When toggling the extended option, it can present an expand-collapse animation.

2026-04-10.00-40-20.mp4

I referred to the Jetpack Compose API interface. In this implementation, ExtendedFloatingActionButton is specifically used to represent the Extended FAB, which corresponds to Angular Material's <button matFab extended>. The additional expanded parameter was inspired by the practice of adding an expanded parameter to ExtendedFloatingActionButton

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jexjws I see this follows the Android Compose naming, but expanded still feels a bit too close to extended in Angular and may be confusing to users. Would collapsed be clearer here, or something more explicit like showLabel?

Copy link
Copy Markdown
Author

@jexjws jexjws Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jexjws Would collapsed be clearer here

good👍

@jexjws jexjws changed the title feat(material/button): add expanded option for extended FAB feat(material/button): add collapsed option for extended FAB Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: material/button detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants