-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add stretchTabs
to MatTabsConfig
#26644
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -566,6 +566,10 @@ export class MatTabGroup extends _MatTabGroupBase { | |||
defaultConfig && defaultConfig.fitInkBarToContent != null | |||
? defaultConfig.fitInkBarToContent | |||
: false; | |||
this.stretchTabs = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should default to true
on the MDC-based tabs and false
on the legacy ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe all I needed to do is change the default value from false
to true
as _stretchTabs
is set to true
earlier in the file here when there is no defaultConfig supplied, correct?
@joelkesler the change is almost ready to go, but it needs to be rebased. |
Done ✅ |
…/tabs/tab-group.ts
I also ran the recommended formatting command from the lint check:
I am not sure what to do about the other failing checks. Let me know if there is more I can do! |
For the linting check you'd have to change the commit message to start with For the API golden failure you need to run |
Done ✅ |
@@ -566,6 +566,8 @@ export class MatTabGroup extends _MatTabGroupBase { | |||
defaultConfig && defaultConfig.fitInkBarToContent != null | |||
? defaultConfig.fitInkBarToContent | |||
: false; | |||
this.stretchTabs = | |||
defaultConfig && defaultConfig.stretchTabs != null ? defaultConfig.stretchTabs : true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not this? I'm just wondering.
defaultConfig?.stretchTabs ?? true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, I was copying the way it was done in the file already, with my thinking that it was the quickest way to get the change approved and merged :)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR for issue #26645
The new Material component updates changed how tabs present when used. Tabs now stretch to fill the header.
For those of us who wish to preserve the old behaviour, adding the
stretchTabs
settings toMatTabsConfig
will be incredibly helpful to let us set the behaviour universally instead of updating each and every instance.Ex:
Cheers!