- Toggle
+ Toggle
Mode:
diff --git a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html
index f82321e94337..a9f781c61e00 100644
--- a/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html
+++ b/src/components-examples/material/sidenav/sidenav-open-close/sidenav-open-close-example.html
@@ -7,7 +7,7 @@
sidenav.opened
- sidenav.toggle()
+ sidenav.toggle()
Events:
@for (e of events; track e) {
diff --git a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html
index e34c05948d25..0c7cc03247ba 100644
--- a/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html
+++ b/src/components-examples/material/sidenav/sidenav-responsive/sidenav-responsive-example.html
@@ -1,7 +1,7 @@
@if (shouldRun) {
- menu
+ menu
Responsive App
diff --git a/src/components-examples/material/slide-toggle/slide-toggle-forms/slide-toggle-forms-example.html b/src/components-examples/material/slide-toggle/slide-toggle-forms/slide-toggle-forms-example.html
index 1a63b3ba0c78..c1cb6520ec57 100644
--- a/src/components-examples/material/slide-toggle/slide-toggle-forms/slide-toggle-forms-example.html
+++ b/src/components-examples/material/slide-toggle/slide-toggle-forms/slide-toggle-forms-example.html
@@ -9,7 +9,7 @@
Enable Wifi
Accept Terms of Service
-
Save Settings
+
Save Settings
Slide Toggle inside of a Reactive form
@@ -21,5 +21,5 @@
Form Group Status: {{formGroup.status}}
-
Save Settings
+
Save Settings
diff --git a/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example-snack.html b/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example-snack.html
index 1bb8371b6c39..93aca7adb0a2 100644
--- a/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example-snack.html
+++ b/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example-snack.html
@@ -2,6 +2,6 @@
Pizza party!!!
- 🍕
+ 🍕
diff --git a/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example.html b/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example.html
index e320fa99a099..b54de6e3b7e6 100644
--- a/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example.html
+++ b/src/components-examples/material/snack-bar/snack-bar-annotated-component/snack-bar-annotated-component-example.html
@@ -3,6 +3,6 @@
-
+
Pizza party
diff --git a/src/components-examples/material/snack-bar/snack-bar-component/snack-bar-component-example.html b/src/components-examples/material/snack-bar/snack-bar-component/snack-bar-component-example.html
index e320fa99a099..b54de6e3b7e6 100644
--- a/src/components-examples/material/snack-bar/snack-bar-component/snack-bar-component-example.html
+++ b/src/components-examples/material/snack-bar/snack-bar-component/snack-bar-component-example.html
@@ -3,6 +3,6 @@
-
+
Pizza party
diff --git a/src/components-examples/material/snack-bar/snack-bar-overview/snack-bar-overview-example.html b/src/components-examples/material/snack-bar/snack-bar-overview/snack-bar-overview-example.html
index bc311ebcf18a..7f4d73a6d4db 100644
--- a/src/components-examples/material/snack-bar/snack-bar-overview/snack-bar-overview-example.html
+++ b/src/components-examples/material/snack-bar/snack-bar-overview/snack-bar-overview-example.html
@@ -8,4 +8,4 @@
-Show snack-bar
+Show snack-bar
diff --git a/src/components-examples/material/snack-bar/snack-bar-position/snack-bar-position-example.html b/src/components-examples/material/snack-bar/snack-bar-position/snack-bar-position-example.html
index 2329a7ddd860..1b80165f1841 100644
--- a/src/components-examples/material/snack-bar/snack-bar-position/snack-bar-position-example.html
+++ b/src/components-examples/material/snack-bar/snack-bar-position/snack-bar-position-example.html
@@ -16,6 +16,6 @@
-
+
Pool party!
diff --git a/src/components-examples/material/stepper/stepper-animations/stepper-animations-example.html b/src/components-examples/material/stepper/stepper-animations/stepper-animations-example.html
index 641a2591160c..6db1217e8f65 100644
--- a/src/components-examples/material/stepper/stepper-animations/stepper-animations-example.html
+++ b/src/components-examples/material/stepper/stepper-animations/stepper-animations-example.html
@@ -11,7 +11,7 @@
- Next
+ Next
@@ -22,8 +22,8 @@
- Back
- Next
+ Back
+ Next
@@ -31,8 +31,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-editable/stepper-editable-example.html b/src/components-examples/material/stepper/stepper-editable/stepper-editable-example.html
index 8074ec807df1..8dc4135bc166 100644
--- a/src/components-examples/material/stepper/stepper-editable/stepper-editable-example.html
+++ b/src/components-examples/material/stepper/stepper-editable/stepper-editable-example.html
@@ -1,4 +1,4 @@
-
+
{{!isEditable ? 'Enable edit mode' : 'Disable edit mode'}}
@@ -15,7 +15,7 @@
- Next
+ Next
@@ -28,8 +28,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -37,8 +37,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-errors/stepper-errors-example.html b/src/components-examples/material/stepper/stepper-errors/stepper-errors-example.html
index 0b015da0eece..8f24359835e3 100644
--- a/src/components-examples/material/stepper/stepper-errors/stepper-errors-example.html
+++ b/src/components-examples/material/stepper/stepper-errors/stepper-errors-example.html
@@ -8,7 +8,7 @@
Go to a different step to see the error state
-
Next
+
Next
@@ -22,8 +22,8 @@
Go to a different step to see the error state
-
Back
-
Next
+
Back
+
Next
@@ -31,8 +31,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-header-position/stepper-header-position-example.html b/src/components-examples/material/stepper/stepper-header-position/stepper-header-position-example.html
index 7f092843f2f7..06c357bdd644 100644
--- a/src/components-examples/material/stepper/stepper-header-position/stepper-header-position-example.html
+++ b/src/components-examples/material/stepper/stepper-header-position/stepper-header-position-example.html
@@ -6,7 +6,7 @@
- Next
+ Next
@@ -17,8 +17,8 @@
- Back
- Next
+ Back
+ Next
@@ -26,8 +26,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html
index c108f1673094..3a63f1e68ea3 100644
--- a/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html
+++ b/src/components-examples/material/stepper/stepper-intl/stepper-intl-example.html
@@ -24,7 +24,7 @@
/>
- Next
+ Next
@@ -42,8 +42,8 @@
/>
- Back
- Next
+ Back
+ Next
@@ -51,8 +51,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-label-position-bottom/stepper-label-position-bottom-example.html b/src/components-examples/material/stepper/stepper-label-position-bottom/stepper-label-position-bottom-example.html
index 29eb1459cb98..d2ba6100b717 100644
--- a/src/components-examples/material/stepper/stepper-label-position-bottom/stepper-label-position-bottom-example.html
+++ b/src/components-examples/material/stepper/stepper-label-position-bottom/stepper-label-position-bottom-example.html
@@ -9,7 +9,7 @@
- Next
+ Next
@@ -23,8 +23,8 @@
- Back
- Next
+ Back
+ Next
@@ -33,8 +33,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-lazy-content/stepper-lazy-content-example.html b/src/components-examples/material/stepper/stepper-lazy-content/stepper-lazy-content-example.html
index a632ac1dcf22..e5ff21d24375 100644
--- a/src/components-examples/material/stepper/stepper-lazy-content/stepper-lazy-content-example.html
+++ b/src/components-examples/material/stepper/stepper-lazy-content/stepper-lazy-content-example.html
@@ -3,20 +3,20 @@
Step 1
This content was rendered lazily
- Next
+ Next
Step 2
This content was also rendered lazily
- Back
- Next
+ Back
+ Next
Step 3
This content was rendered eagerly
- Back
+ Back
diff --git a/src/components-examples/material/stepper/stepper-optional/stepper-optional-example.html b/src/components-examples/material/stepper/stepper-optional/stepper-optional-example.html
index 2200fa240961..d177ccc2db90 100644
--- a/src/components-examples/material/stepper/stepper-optional/stepper-optional-example.html
+++ b/src/components-examples/material/stepper/stepper-optional/stepper-optional-example.html
@@ -1,4 +1,4 @@
-
+
{{!isOptional ? 'Enable optional steps' : 'Disable optional steps'}}
@@ -11,7 +11,7 @@
- Next
+ Next
@@ -26,8 +26,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -35,8 +35,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-overview/stepper-overview-example.html b/src/components-examples/material/stepper/stepper-overview/stepper-overview-example.html
index 7b54eb4358a6..a7f6fd0ad978 100644
--- a/src/components-examples/material/stepper/stepper-overview/stepper-overview-example.html
+++ b/src/components-examples/material/stepper/stepper-overview/stepper-overview-example.html
@@ -1,4 +1,4 @@
-
+
{{!isLinear ? 'Enable linear mode' : 'Disable linear mode'}}
@@ -10,7 +10,7 @@
- Next
+ Next
@@ -24,8 +24,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -33,8 +33,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html b/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html
index cba6751334d8..31429d631cc5 100644
--- a/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html
+++ b/src/components-examples/material/stepper/stepper-responsive/stepper-responsive-example.html
@@ -17,7 +17,7 @@
- Next
+ Next
@@ -29,8 +29,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -41,8 +41,8 @@
- Back
- Next
+ Back
+ Next
@@ -50,7 +50,7 @@
Done
You are now done.
- Back
+ Back
diff --git a/src/components-examples/material/stepper/stepper-states/stepper-states-example.html b/src/components-examples/material/stepper/stepper-states/stepper-states-example.html
index aa47cb1f8832..cce56f30f5c4 100644
--- a/src/components-examples/material/stepper/stepper-states/stepper-states-example.html
+++ b/src/components-examples/material/stepper/stepper-states/stepper-states-example.html
@@ -7,7 +7,7 @@
- Next
+ Next
@@ -20,8 +20,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -29,8 +29,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
@@ -41,15 +41,15 @@
Put down your phones.
- Next
+ Next
Socialize with each other.
- Back
- Next
+ Back
+ Next
diff --git a/src/components-examples/material/stepper/stepper-vertical/stepper-vertical-example.html b/src/components-examples/material/stepper/stepper-vertical/stepper-vertical-example.html
index 288be64f8d2e..1f3aeadb108e 100644
--- a/src/components-examples/material/stepper/stepper-vertical/stepper-vertical-example.html
+++ b/src/components-examples/material/stepper/stepper-vertical/stepper-vertical-example.html
@@ -1,4 +1,4 @@
-
+
{{!isLinear ? 'Enable linear mode' : 'Disable linear mode'}}
@@ -10,7 +10,7 @@
- Next
+ Next
@@ -23,8 +23,8 @@
required>
- Back
- Next
+ Back
+ Next
@@ -32,8 +32,8 @@
Done
You are now done.
- Back
- Reset
+ Back
+ Reset
diff --git a/src/components-examples/material/table/table-dynamic-array-data/table-dynamic-array-data-example.html b/src/components-examples/material/table/table-dynamic-array-data/table-dynamic-array-data-example.html
index 9e0cf9a588b7..d3613b45a00c 100644
--- a/src/components-examples/material/table/table-dynamic-array-data/table-dynamic-array-data-example.html
+++ b/src/components-examples/material/table/table-dynamic-array-data/table-dynamic-array-data-example.html
@@ -1,9 +1,9 @@
- OPEN
+ OPEN
-OPEN TEMPLATE
+OPEN TEMPLATE
Template snack bar: {{message}}
diff --git a/src/dev-app/stepper/stepper-demo.html b/src/dev-app/stepper/stepper-demo.html
index 1dd2a5e94cda..0e476433d30a 100644
--- a/src/dev-app/stepper/stepper-demo.html
+++ b/src/dev-app/stepper/stepper-demo.html
@@ -8,7 +8,7 @@
Vertical
-
+
Toggle label position
@@ -46,7 +46,7 @@ Linear Stepper Demo using a single form
This field is required
- Next
+ Next
@@ -61,8 +61,8 @@ Linear Stepper Demo using a single form
The input is invalid.
- Back
- Next
+ Back
+ Next
@@ -70,8 +70,8 @@ Linear Stepper Demo using a single form
Confirm your information
Everything seems correct.
- Done
- Reset
+ Done
+ Reset
@@ -96,7 +96,7 @@ Linear Horizontal Stepper Demo using a different form for each step
This field is required
- Next
+ Next
@@ -110,8 +110,8 @@ Linear Horizontal Stepper Demo using a different form for each step
The input is invalid
- Back
- Next
+ Back
+ Next
@@ -121,8 +121,8 @@ Linear Horizontal Stepper Demo using a different form for each step
Confirm your information
Everything seems correct.
- Done
- Reset
+ Done
+ Reset
@@ -143,7 +143,7 @@ Vertical Stepper Demo
- Next
+ Next
@@ -156,8 +156,8 @@ Vertical Stepper Demo
- Back
- Next
+ Back
+ Next
@@ -170,8 +170,8 @@ Vertical Stepper Demo
- Back
- Next
+ Back
+ Next
@@ -179,7 +179,7 @@ Vertical Stepper Demo
Confirm your information
Everything seems correct.
- Done
+ Done
@@ -197,7 +197,7 @@ Horizontal Stepper Demo with Text Label
- Next
+ Next
@@ -207,8 +207,8 @@ Horizontal Stepper Demo with Text Label
- Back
- Next
+ Back
+ Next
@@ -218,15 +218,15 @@ Horizontal Stepper Demo with Text Label
- Back
- Next
+ Back
+ Next
Everything seems correct.
- Done
+ Done
@@ -241,8 +241,8 @@ Horizontal Stepper Demo with Templated Label
- Back
- Next
+ Back
+ Next
}
diff --git a/src/dev-app/table-scroll-container/table-scroll-container-demo.html b/src/dev-app/table-scroll-container/table-scroll-container-demo.html
index 69229922693e..793c0ac074d8 100644
--- a/src/dev-app/table-scroll-container/table-scroll-container-demo.html
+++ b/src/dev-app/table-scroll-container/table-scroll-container-demo.html
@@ -1,6 +1,6 @@
- Add table
- Remove table
+ Add table
+ Remove table
diff --git a/src/dev-app/timepicker/timepicker-demo.html b/src/dev-app/timepicker/timepicker-demo.html
index 52abf423e2d6..c53b657f650d 100644
--- a/src/dev-app/timepicker/timepicker-demo.html
+++ b/src/dev-app/timepicker/timepicker-demo.html
@@ -18,7 +18,7 @@
Basic timepicker
Dirty: {{control.dirty}}
Touched: {{control.touched}}
Errors: {{control.errors | json}}
-
Assign a random value
+
Assign a random value
diff --git a/src/dev-app/toolbar/toolbar-demo.html b/src/dev-app/toolbar/toolbar-demo.html
index e665bd38f656..7969e7a1c6dd 100644
--- a/src/dev-app/toolbar/toolbar-demo.html
+++ b/src/dev-app/toolbar/toolbar-demo.html
@@ -9,20 +9,20 @@
-
+
menu
Default Toolbar
- Text
- Text
-
+ Text
+ Text
+
code
-
+
code
@@ -30,34 +30,34 @@
-
+
menu
Primary Toolbar
- Text
- Accent
- Stroked
+ Text
+ Accent
+ Stroked
-
+
menu
Accent Toolbar
- Text
- Flat
-
+ Text
+ Flat
+
done
-
+
done
diff --git a/src/dev-app/virtual-scroll/virtual-scroll-demo.html b/src/dev-app/virtual-scroll/virtual-scroll-demo.html
index 76c17f993488..950ecaabb0bf 100644
--- a/src/dev-app/virtual-scroll/virtual-scroll-demo.html
+++ b/src/dev-app/virtual-scroll/virtual-scroll-demo.html
@@ -46,7 +46,7 @@
Fixed size
Offset
-
Go to offset
@@ -54,7 +54,7 @@
Fixed size
Index
-
Go to index
diff --git a/src/dev-app/youtube-player/youtube-player-demo.html b/src/dev-app/youtube-player/youtube-player-demo.html
index 209eb6ec08e6..d5986bf2d4db 100644
--- a/src/dev-app/youtube-player/youtube-player-demo.html
+++ b/src/dev-app/youtube-player/youtube-player-demo.html
@@ -16,7 +16,7 @@
Basic Example
Start at 30s
- Make fullscreen
+ Make fullscreen
>(ElementRef);
_ngZone = inject(NgZone);
_animationMode = inject(ANIMATION_MODULE_TYPE, {optional: true});
+ protected readonly _config = inject(MAT_BUTTON_CONFIG, {optional: true});
private readonly _focusMonitor = inject(FocusMonitor);
private _cleanupClick: (() => void) | undefined;
private _renderer = inject(Renderer2);
@@ -179,22 +157,12 @@ export class MatButtonBase implements AfterViewInit, OnDestroy {
constructor() {
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
- const config = inject(MAT_BUTTON_CONFIG, {optional: true});
- const element: HTMLElement = this._elementRef.nativeElement;
- const classList = (element as HTMLElement).classList;
+ const element = this._elementRef.nativeElement;
this._isAnchor = element.tagName === 'A';
- this.disabledInteractive = config?.disabledInteractive ?? false;
- this.color = config?.color ?? null;
+ this.disabledInteractive = this._config?.disabledInteractive ?? false;
+ this.color = this._config?.color ?? null;
this._rippleLoader?.configureRipple(element, {className: 'mat-mdc-button-ripple'});
-
- // For each of the variant selectors that is present in the button's host
- // attributes, add the correct corresponding MDC classes.
- for (const {attribute, mdcClasses} of HOST_SELECTOR_MDC_CLASS_PAIR) {
- if (element.hasAttribute(attribute)) {
- classList.add(...mdcClasses);
- }
- }
}
ngAfterViewInit() {
diff --git a/src/material/button/button.md b/src/material/button/button.md
index 4ed6d42af291..5f57cea1c3d5 100644
--- a/src/material/button/button.md
+++ b/src/material/button/button.md
@@ -1,5 +1,5 @@
Angular Material buttons are native `` or `` elements enhanced with Material Design
-styling and ink ripples.
+styling.
@@ -9,26 +9,34 @@ is performed. An ` ` element should be used whenever the user will _navigate_
There are several button variants, each applied as an attribute:
-
| Attribute | Description |
|----------------------|--------------------------------------------------------------------------|
-| `mat-button` | Rectangular text button w/ no elevation and rounded corners |
-| `mat-raised-button` | Rectangular contained button w/ elevation and rounded corners |
-| `mat-flat-button` | Rectangular contained button w/ no elevation and rounded corners |
-| `mat-stroked-button` | Rectangular outlined button w/ no elevation and rounded corners |
-| `mat-icon-button` | Circular button with a transparent background, meant to contain an icon |
-| `mat-fab` | Square button w/ elevation and rounded corners, meant to contain an icon. Can be [extended](https://material.angular.io/components/button/overview#extended-fab-buttons) to a rectangle to also fit a label |
-| `mat-mini-fab` | Same as `mat-fab` but smaller |
+| `matButton` | Rectangular button that can contain text and icons |
+| `matIconButton` | Smaller, circular button, meant to contain an icon and no text |
+| `matFab` | Rectangular button w/ elevation and rounded corners, meant to contain an icon. Can be [extended](https://material.angular.io/components/button/overview#extended-fab-buttons) to a rectangle to also fit a label |
+| `matMiniFab` | Smaller variant of `matFab` |
+
+
+Additionally, the `matButton` has several appearances that can be set using the `matButton`
+attribute, for example `matButton="outlined"`:
+
+
+| Appearance | Description |
+|--------------|----------------------------------------------------------------------------------|
+| `text` | Default appearance. Does not have a background until the user interacts with it. |
+| `elevated` | Has a background color, elevation and rounded corners. |
+| `filled` | Has a flat appearance with rounded corners and no elevation. |
+| `outlined` | Has an outline, rounded corners and a transparent background. |
-### Extended fab buttons
-Traditional fab buttons are circular and only have space for a single icon. However, you can add the
-`extended` attribute to allow the fab to expand into a rounded rectangle shape with space for a text
-label in addition to the icon. Only full sized fabs support the `extended` attribute, mini fabs do
-not.
+### Extended FAB buttons
+Traditional floating action buttons (FAB) buttons are circular and only have space for a single
+icon. However, you can add the `extended` attribute to allow the fab to expand into a rounded
+rectangle shape with space for a text label in addition to the icon. Only full sized fabs support
+the `extended` attribute, mini FABs do not.
```html
-
+
home
Home
@@ -65,7 +73,7 @@ We recommend not changing the default capitalization for the button text.
with any assistive technology your application supports.
#### Buttons with icons
-Buttons or links containing only icons (such as `mat-fab`, `mat-mini-fab`, and `mat-icon-button`)
+Buttons or links containing only icons (such as `matFab`, `matMiniFab`, and `matIconButton`)
should be given a meaningful label via `aria-label` or `aria-labelledby`. [See the documentation
for `MatIcon`](https://material.angular.io/components/icon) for more
information on using icons in buttons. Additionally, to be fully accessible the icon should have a minimum touch-target of 48x48 to ensure that the icon is easily clickable particularly on mobile devices and small screens.
diff --git a/src/material/button/button.spec.ts b/src/material/button/button.spec.ts
index 300684f6c214..f8f9d3aca99f 100644
--- a/src/material/button/button.spec.ts
+++ b/src/material/button/button.spec.ts
@@ -1,22 +1,18 @@
import {createMouseEvent, dispatchEvent} from '@angular/cdk/testing/private';
import {ApplicationRef, Component} from '@angular/core';
-import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
+import {ComponentFixture, TestBed} from '@angular/core/testing';
import {ThemePalette} from '../core';
import {By} from '@angular/platform-browser';
import {
MAT_BUTTON_CONFIG,
MAT_FAB_DEFAULT_OPTIONS,
+ MatButtonAppearance,
+ MatButtonConfig,
MatButtonModule,
MatFabDefaultOptions,
} from './index';
describe('MatButton', () => {
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [MatButtonModule, TestApp],
- });
- }));
-
// General button tests
it('should apply class based on color attribute', () => {
let fixture = TestBed.createComponent(TestApp);
@@ -84,6 +80,45 @@ describe('MatButton', () => {
expect(buttonDebugElement.nativeElement.classList.contains('custom-class')).toBe(true);
});
+ it('should be able to change the button appearance dynamically', () => {
+ const fixture = TestBed.createComponent(TestApp);
+ const button = fixture.nativeElement.querySelector('.dynamic') as HTMLElement;
+ fixture.detectChanges();
+
+ expect(button.classList).toContain('mat-mdc-button');
+ expect(button.classList).not.toContain('mat-mdc-outlined-button');
+ expect(button.classList).not.toContain('mat-mdc-raised-button');
+
+ fixture.componentInstance.appearance = 'outlined';
+ fixture.changeDetectorRef.markForCheck();
+ fixture.detectChanges();
+ expect(button.classList).not.toContain('mat-mdc-button');
+ expect(button.classList).toContain('mat-mdc-outlined-button');
+ expect(button.classList).not.toContain('mat-mdc-raised-button');
+
+ fixture.componentInstance.appearance = 'elevated';
+ fixture.changeDetectorRef.markForCheck();
+ fixture.detectChanges();
+ expect(button.classList).not.toContain('mat-mdc-button');
+ expect(button.classList).not.toContain('mat-mdc-outlined-button');
+ expect(button.classList).toContain('mat-mdc-raised-button');
+ });
+
+ it('should be able to configure the default button appearance', () => {
+ const config: MatButtonConfig = {
+ defaultAppearance: 'outlined',
+ };
+
+ TestBed.configureTestingModule({
+ providers: [{provide: MAT_BUTTON_CONFIG, useValue: config}],
+ });
+
+ const fixture = TestBed.createComponent(TestApp);
+ const button = fixture.nativeElement.querySelector('.default-appearance') as HTMLElement;
+ fixture.detectChanges();
+ expect(button.classList).toContain('mat-mdc-outlined-button');
+ });
+
describe('button[mat-fab]', () => {
it('should have accent palette by default', () => {
const fixture = TestBed.createComponent(TestApp);
@@ -422,6 +457,8 @@ describe('MatFabDefaultOptions', () => {
Fab Button
Extended
Mini Fab Button
+ Dynamic button
+ Dynamic button
`,
imports: [MatButtonModule],
})
@@ -433,6 +470,7 @@ class TestApp {
tabIndex: number;
extended = false;
disabledInteractive = false;
+ appearance: MatButtonAppearance = 'text';
increment() {
this.clickCount++;
diff --git a/src/material/button/button.ts b/src/material/button/button.ts
index 125aebfa4fd6..0fcb4661ab6d 100644
--- a/src/material/button/button.ts
+++ b/src/material/button/button.ts
@@ -6,23 +6,29 @@
* found in the LICENSE file at https://angular.dev/license
*/
-import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
-import {MAT_BUTTON_HOST, MatButtonBase} from './button-base';
+import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core';
+import {MAT_BUTTON_HOST, MatButtonAppearance, MatButtonBase} from './button-base';
+
+/**
+ * Classes that need to be set for each appearance of the button.
+ * Note that we use a `Map` here to avoid issues with property renaming.
+ */
+const APPEARANCE_CLASSES: Map = new Map([
+ ['text', ['mat-mdc-button']],
+ ['filled', ['mdc-button--unelevated', 'mat-mdc-unelevated-button']],
+ ['elevated', ['mdc-button--raised', 'mat-mdc-raised-button']],
+ ['outlined', ['mdc-button--outlined', 'mat-mdc-outlined-button']],
+]);
/**
* Material Design button component. Users interact with a button to perform an action.
- * See https://material.io/components/buttons
- *
- * The `MatButton` class applies to native button elements and captures the appearances for
- * "text button", "outlined button", and "contained button" per the Material Design
- * specification. `MatButton` additionally captures an additional "flat" appearance, which matches
- * "contained" but without elevation.
+ * See https://m3.material.io/components/buttons/overview
*/
@Component({
selector: `
- button[mat-button], button[mat-raised-button], button[mat-flat-button],
- button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button],
- a[mat-stroked-button]
+ button[matButton], a[matButton], button[mat-button], button[mat-raised-button],
+ button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button],
+ a[mat-flat-button], a[mat-stroked-button]
`,
templateUrl: 'button.html',
styleUrls: ['button.css', 'button-high-contrast.css'],
@@ -31,18 +37,87 @@ import {MAT_BUTTON_HOST, MatButtonBase} from './button-base';
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class MatButton extends MatButtonBase {}
+export class MatButton extends MatButtonBase {
+ /** Appearance of the button. */
+ @Input('matButton')
+ get appearance(): MatButtonAppearance | null {
+ return this._appearance;
+ }
+ set appearance(value: MatButtonAppearance | '') {
+ // Allow empty string so users can do ` `
+ // without having to write out `="text"` every time.
+ this.setAppearance(value || this._config?.defaultAppearance || 'text');
+ }
+ private _appearance: MatButtonAppearance | null = null;
+
+ constructor(...args: unknown[]);
+
+ constructor() {
+ super();
+ const element = this._elementRef.nativeElement;
+ const inferredAppearance = _inferAppearance(element);
+
+ // This class is common across all the appearances so we add it ahead of time.
+ element.classList.add('mdc-button');
+
+ // Only set the appearance if we managed to infer it from the static attributes, rather than
+ // doing something like `setAppearance(inferredAppearance || 'text')`, because doing so can
+ // cause the fallback appearance's classes to be set and then immediately replaced when
+ // the input value is assigned.
+ if (inferredAppearance) {
+ this.setAppearance(inferredAppearance);
+ }
+ }
+
+ /** Programmatically sets the appearance of the button. */
+ setAppearance(appearance: MatButtonAppearance): void {
+ if (appearance === this._appearance) {
+ return;
+ }
+
+ const classList = this._elementRef.nativeElement.classList;
+ const previousClasses = this._appearance ? APPEARANCE_CLASSES.get(this._appearance) : null;
+ const newClasses = APPEARANCE_CLASSES.get(appearance)!;
+
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && !newClasses) {
+ throw new Error(`Unsupported MatButton appearance "${appearance}"`);
+ }
+
+ if (previousClasses) {
+ classList.remove(...previousClasses);
+ }
+
+ classList.add(...newClasses);
+ this._appearance = appearance;
+ }
+}
+
+/** Infers the button's appearance from its static attributes. */
+function _inferAppearance(button: HTMLElement): MatButtonAppearance | null {
+ if (button.hasAttribute('mat-raised-button')) {
+ return 'elevated';
+ }
+
+ if (button.hasAttribute('mat-stroked-button')) {
+ return 'outlined';
+ }
+
+ if (button.hasAttribute('mat-flat-button')) {
+ return 'filled';
+ }
+
+ if (button.hasAttribute('mat-button')) {
+ return 'text';
+ }
+
+ return null;
+}
// tslint:disable:variable-name
/**
* Material Design button component for anchor elements. Anchor elements are used to provide
* links for the user to navigate across different routes or pages.
- * See https://material.io/components/buttons
- *
- * The `MatAnchor` class applies to native anchor elements and captures the appearances for
- * "text button", "outlined button", and "contained button" per the Material Design
- * specification. `MatAnchor` additionally captures an additional "flat" appearance, which matches
- * "contained" but without elevation.
+ * See https://m3.material.io/components/buttons/overview
*/
export const MatAnchor = MatButton;
export type MatAnchor = MatButton;
diff --git a/src/material/button/fab.ts b/src/material/button/fab.ts
index fa482ebe7453..ce5ab638a937 100644
--- a/src/material/button/fab.ts
+++ b/src/material/button/fab.ts
@@ -58,12 +58,12 @@ const defaults = MAT_FAB_DEFAULT_OPTIONS_FACTORY();
/**
* Material Design floating action button (FAB) component. These buttons represent the primary
* or most common action for users to interact with.
- * See https://material.io/components/buttons-floating-action-button/
+ * See https://m3.material.io/components/floating-action-button/overview
*
* The `MatFabButton` class has two appearances: normal and extended.
*/
@Component({
- selector: `button[mat-fab], a[mat-fab]`,
+ selector: `button[mat-fab], a[mat-fab], button[matFab], a[matFab]`,
templateUrl: 'button.html',
styleUrl: 'fab.css',
host: {
@@ -86,6 +86,8 @@ export class MatFabButton extends MatButtonBase {
constructor() {
super();
+ const element = this._elementRef.nativeElement;
+ element.classList.add('mdc-fab', 'mat-mdc-fab-base', 'mat-mdc-fab');
this._options = this._options || defaults;
this.color = this._options!.color || defaults.color;
}
@@ -94,10 +96,10 @@ export class MatFabButton extends MatButtonBase {
/**
* Material Design mini floating action button (FAB) component. These buttons represent the primary
* or most common action for users to interact with.
- * See https://material.io/components/buttons-floating-action-button/
+ * See https://m3.material.io/components/floating-action-button/overview
*/
@Component({
- selector: `button[mat-mini-fab], a[mat-mini-fab]`,
+ selector: `button[mat-mini-fab], a[mat-mini-fab], button[matMiniFab], a[matMiniFab]`,
templateUrl: 'button.html',
styleUrl: 'fab.css',
host: MAT_BUTTON_HOST,
@@ -114,6 +116,8 @@ export class MatMiniFabButton extends MatButtonBase {
constructor() {
super();
+ const element = this._elementRef.nativeElement;
+ element.classList.add('mdc-fab', 'mat-mdc-fab-base', 'mdc-fab--mini', 'mat-mdc-mini-fab');
this._options = this._options || defaults;
this.color = this._options!.color || defaults.color;
}
@@ -123,7 +127,7 @@ export class MatMiniFabButton extends MatButtonBase {
/**
* Material Design floating action button (FAB) component for anchor elements. Anchor elements
* are used to provide links for the user to navigate across different routes or pages.
- * See https://material.io/components/buttons-floating-action-button/
+ * See https://m3.material.io/components/floating-action-button/overview
*
* The `MatFabAnchor` class has two appearances: normal and extended.
*/
@@ -133,7 +137,7 @@ export type MatFabAnchor = MatFabButton;
/**
* Material Design mini floating action button (FAB) component for anchor elements. Anchor elements
* are used to provide links for the user to navigate across different routes or pages.
- * See https://material.io/components/buttons-floating-action-button/
+ * See https://m3.material.io/components/floating-action-button/overview
*/
export const MatMiniFabAnchor = MatMiniFabButton;
export type MatMiniFabAnchor = MatMiniFabButton;
diff --git a/src/material/button/icon-button.ts b/src/material/button/icon-button.ts
index df433677775b..90cf49864c55 100644
--- a/src/material/button/icon-button.ts
+++ b/src/material/button/icon-button.ts
@@ -15,7 +15,7 @@ import {MAT_BUTTON_HOST, MatButtonBase} from './button-base';
* See https://material.io/develop/web/components/buttons/icon-buttons/
*/
@Component({
- selector: `button[mat-icon-button], a[mat-icon-button]`,
+ selector: `button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]`,
templateUrl: 'icon-button.html',
styleUrls: ['icon-button.css', 'button-high-contrast.css'],
host: MAT_BUTTON_HOST,
@@ -28,7 +28,9 @@ export class MatIconButton extends MatButtonBase {
constructor() {
super();
- this._rippleLoader.configureRipple(this._elementRef.nativeElement, {centered: true});
+ const element = this._elementRef.nativeElement;
+ element.classList.add('mdc-icon-button', 'mat-mdc-icon-button');
+ this._rippleLoader.configureRipple(element, {centered: true});
}
}
diff --git a/src/material/button/public-api.ts b/src/material/button/public-api.ts
index fa631df31302..97022c38a573 100644
--- a/src/material/button/public-api.ts
+++ b/src/material/button/public-api.ts
@@ -10,4 +10,4 @@ export * from './button';
export * from './fab';
export * from './icon-button';
export * from './module';
-export {MAT_BUTTON_CONFIG, MatButtonConfig} from './button-base';
+export {MAT_BUTTON_CONFIG, MatButtonAppearance, MatButtonConfig} from './button-base';
diff --git a/src/material/button/testing/button-harness-filters.ts b/src/material/button/testing/button-harness-filters.ts
index f6a55ae80673..3ecba00636b2 100644
--- a/src/material/button/testing/button-harness-filters.ts
+++ b/src/material/button/testing/button-harness-filters.ts
@@ -8,8 +8,11 @@
import {BaseHarnessFilters} from '@angular/cdk/testing';
+/** Possible button variants. */
+export type ButtonVariant = 'basic' | 'icon' | 'fab' | 'mini-fab';
+
/** Possible button appearances. */
-export type ButtonVariant = 'basic' | 'raised' | 'flat' | 'icon' | 'stroked' | 'fab' | 'mini-fab';
+export type ButtonAppearance = 'text' | 'filled' | 'elevated' | 'outlined';
/** A set of criteria that can be used to filter a list of button harness instances. */
export interface ButtonHarnessFilters extends BaseHarnessFilters {
@@ -19,6 +22,9 @@ export interface ButtonHarnessFilters extends BaseHarnessFilters {
/** Only find instances with a variant. */
variant?: ButtonVariant;
+ /** Only find instances with a specific appearance. */
+ appearance?: ButtonAppearance;
+
/** Only find instances which match the given disabled state. */
disabled?: boolean;
}
diff --git a/src/material/button/testing/button-harness.spec.ts b/src/material/button/testing/button-harness.spec.ts
index 963519892949..fe13608d7a4a 100644
--- a/src/material/button/testing/button-harness.spec.ts
+++ b/src/material/button/testing/button-harness.spec.ts
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
-import {ComponentFixture, inject, TestBed} from '@angular/core/testing';
-import {Platform, PlatformModule} from '@angular/cdk/platform';
+import {ComponentFixture, TestBed} from '@angular/core/testing';
+import {Platform} from '@angular/cdk/platform';
import {HarnessLoader, parallel} from '@angular/cdk/testing';
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
import {MatButtonModule} from '../module';
@@ -14,19 +14,12 @@ describe('MatButtonHarness', () => {
let platform: Platform;
beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [MatButtonModule, MatIconModule, PlatformModule, ButtonHarnessTest],
- });
-
fixture = TestBed.createComponent(ButtonHarnessTest);
fixture.detectChanges();
loader = TestbedHarnessEnvironment.loader(fixture);
+ platform = TestBed.inject(Platform);
});
- beforeEach(inject([Platform], (p: Platform) => {
- platform = p;
- }));
-
it('should load all button harnesses', async () => {
const buttons = await loader.getAllHarnesses(MatButtonHarness);
expect(buttons.length).toBe(15);
@@ -53,24 +46,24 @@ describe('MatButtonHarness', () => {
});
it('should get disabled state', async () => {
- // Grab each combination of [enabled, disabled] ⨯ [button, anchor]
- const [disabledFlatButton, enabledFlatAnchor] = await loader.getAllHarnesses(
- MatButtonHarness.with({text: /flat/i}),
+ // Grab each combination of [enabled, disabled] x [button, anchor]
+ const [disabledFilledButton, enabledFilledAnchor] = await loader.getAllHarnesses(
+ MatButtonHarness.with({text: /filled/i}),
);
- const [enabledRaisedButton, disabledRaisedAnchor] = await loader.getAllHarnesses(
- MatButtonHarness.with({text: /raised/i}),
+ const [enabledElevatedButton, disabledElevatedAnchor] = await loader.getAllHarnesses(
+ MatButtonHarness.with({text: /elevated/i}),
);
- expect(await enabledFlatAnchor.isDisabled()).toBe(false);
- expect(await disabledFlatButton.isDisabled()).toBe(true);
- expect(await enabledRaisedButton.isDisabled()).toBe(false);
- expect(await disabledRaisedAnchor.isDisabled()).toBe(true);
+ expect(await enabledFilledAnchor.isDisabled()).toBe(false);
+ expect(await disabledFilledButton.isDisabled()).toBe(true);
+ expect(await enabledElevatedButton.isDisabled()).toBe(false);
+ expect(await disabledElevatedAnchor.isDisabled()).toBe(true);
});
it('should get button text', async () => {
const [firstButton, secondButton] = await loader.getAllHarnesses(MatButtonHarness);
expect(await firstButton.getText()).toBe('Basic button');
- expect(await secondButton.getText()).toBe('Flat button');
+ expect(await secondButton.getText()).toBe('Filled button');
});
it('should focus and blur a button', async () => {
@@ -99,7 +92,7 @@ describe('MatButtonHarness', () => {
return;
}
- const button = await loader.getHarness(MatButtonHarness.with({text: 'Flat button'}));
+ const button = await loader.getHarness(MatButtonHarness.with({text: 'Filled button'}));
await button.click();
expect(fixture.componentInstance.clicked).toBe(false);
@@ -116,32 +109,60 @@ describe('MatButtonHarness', () => {
expect(await favIcon.getName()).toBe('favorite');
});
- it('should load all button harnesses', async () => {
+ it('should be able to ge the type variant of the button', async () => {
const buttons = await loader.getAllHarnesses(MatButtonHarness);
const variants = await parallel(() => buttons.map(button => button.getVariant()));
expect(variants).toEqual([
'basic',
- 'flat',
- 'raised',
- 'stroked',
+ 'basic',
+ 'basic',
+ 'basic',
'icon',
'icon',
'fab',
'mini-fab',
'basic',
- 'flat',
- 'raised',
- 'stroked',
+ 'basic',
+ 'basic',
+ 'basic',
'icon',
'fab',
'mini-fab',
]);
});
+ it('should be able to get the appearance of the button', async () => {
+ const buttons = await loader.getAllHarnesses(MatButtonHarness);
+ const appearances = await parallel(() => buttons.map(button => button.getAppearance()));
+
+ expect(appearances).toEqual([
+ 'text',
+ 'filled',
+ 'elevated',
+ 'outlined',
+ null,
+ null,
+ null,
+ null,
+ 'text',
+ 'filled',
+ 'elevated',
+ 'outlined',
+ null,
+ null,
+ null,
+ ]);
+ });
+
it('should be able to filter buttons based on their variant', async () => {
- const button = await loader.getHarness(MatButtonHarness.with({variant: 'flat'}));
- expect(await button.getText()).toBe('Flat button');
+ const button = await loader.getHarness(MatButtonHarness.with({variant: 'fab'}));
+ expect(await button.getText()).toBe('Fab button');
+ });
+
+ it('should be able to filter buttons based on their appearance', async () => {
+ const button = await loader.getHarness(MatButtonHarness.with({appearance: 'filled'}));
+ expect(await button.getText()).toBe('Filled button');
});
});
@@ -149,32 +170,32 @@ describe('MatButtonHarness', () => {
// Include one of each type of button selector to ensure that they're all captured by
// the harness's selector.
template: `
-
+
Basic button
-
- Flat button
+
+ Filled button
- Raised button
- Stroked button
-
+ Elevated button
+ Outlined button
+
home
-
+
favorite
- Fab button
- Mini Fab button
-
- Basic anchor
- Flat anchor
- Raised anchor
- Stroked anchor
- Icon anchor
- Fab anchor
- Mini Fab anchor
+ Fab button
+ Mini Fab button
+
+ Basic anchor
+ Filled anchor
+ Elevated anchor
+ Stroked anchor
+ Icon anchor
+ Fab anchor
+ Mini Fab anchor
`,
- imports: [MatButtonModule, MatIconModule, PlatformModule],
+ imports: [MatButtonModule, MatIconModule],
})
class ButtonHarnessTest {
disabled = true;
diff --git a/src/material/button/testing/button-harness.ts b/src/material/button/testing/button-harness.ts
index 23f3030da12e..b711387e7fd5 100644
--- a/src/material/button/testing/button-harness.ts
+++ b/src/material/button/testing/button-harness.ts
@@ -12,13 +12,14 @@ import {
ContentContainerComponentHarness,
HarnessPredicate,
} from '@angular/cdk/testing';
-import {ButtonHarnessFilters, ButtonVariant} from './button-harness-filters';
+import {ButtonAppearance, ButtonHarnessFilters, ButtonVariant} from './button-harness-filters';
/** Harness for interacting with a mat-button in tests. */
export class MatButtonHarness extends ContentContainerComponentHarness {
// TODO(jelbourn) use a single class, like `.mat-button-base`
- static hostSelector = `[mat-button], [mat-raised-button], [mat-flat-button],
- [mat-icon-button], [mat-stroked-button], [mat-fab], [mat-mini-fab]`;
+ static hostSelector = `[matButton], [mat-button], [matIconButton], [matFab], [matMiniFab],
+ [mat-raised-button], [mat-flat-button], [mat-icon-button], [mat-stroked-button], [mat-fab],
+ [mat-mini-fab]`;
/**
* Gets a `HarnessPredicate` that can be used to search for a button with specific attributes.
@@ -26,6 +27,7 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
* - `selector` finds a button whose host element matches the given selector.
* - `text` finds a button with specific text content.
* - `variant` finds buttons matching a specific variant.
+ * - `appearance` finds buttons matching a specific appearance.
* @return a `HarnessPredicate` configured with the given options.
*/
static with(
@@ -39,6 +41,9 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
.addOption('variant', options.variant, (harness, variant) =>
HarnessPredicate.stringMatches(harness.getVariant(), variant),
)
+ .addOption('appearance', options.appearance, (harness, appearance) =>
+ HarnessPredicate.stringMatches(harness.getAppearance(), appearance),
+ )
.addOption('disabled', options.disabled, async (harness, disabled) => {
return (await harness.isDisabled()) === disabled;
});
@@ -91,20 +96,50 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
async getVariant(): Promise {
const host = await this.host();
- if ((await host.getAttribute('mat-raised-button')) != null) {
- return 'raised';
- } else if ((await host.getAttribute('mat-flat-button')) != null) {
- return 'flat';
- } else if ((await host.getAttribute('mat-icon-button')) != null) {
+ // TODO(crisbeto): we're checking both classes and attributes for backwards compatibility
+ // with some internal apps that were applying the attribute without importing the directive.
+ // Really we should be only targeting the classes.
+ if (
+ (await host.hasClass('mat-mdc-icon-button')) ||
+ (await host.getAttribute('mat-icon-button')) != null
+ ) {
return 'icon';
- } else if ((await host.getAttribute('mat-stroked-button')) != null) {
- return 'stroked';
- } else if ((await host.getAttribute('mat-fab')) != null) {
- return 'fab';
- } else if ((await host.getAttribute('mat-mini-fab')) != null) {
+ }
+
+ if (
+ (await host.hasClass('mat-mdc-mini-fab')) ||
+ (await host.getAttribute('mat-mini-fab')) != null
+ ) {
return 'mini-fab';
}
+ if ((await host.hasClass('mat-mdc-fab')) || (await host.getAttribute('mat-fab')) != null) {
+ return 'fab';
+ }
+
return 'basic';
}
+
+ /** Gets the appearance of the button. */
+ async getAppearance(): Promise {
+ const host = await this.host();
+
+ if (await host.hasClass('mat-mdc-outlined-button')) {
+ return 'outlined';
+ }
+
+ if (await host.hasClass('mat-mdc-raised-button')) {
+ return 'elevated';
+ }
+
+ if (await host.hasClass('mat-mdc-unelevated-button')) {
+ return 'filled';
+ }
+
+ if (await host.hasClass('mat-mdc-button')) {
+ return 'text';
+ }
+
+ return null;
+ }
}
diff --git a/src/material/card/testing/card-harness.spec.ts b/src/material/card/testing/card-harness.spec.ts
index 559b4b46e73c..f9d0e22ea3df 100644
--- a/src/material/card/testing/card-harness.spec.ts
+++ b/src/material/card/testing/card-harness.spec.ts
@@ -115,8 +115,8 @@ describe('MatCardHarness', () => {
- LIKE
- SHARE
+ LIKE
+ SHARE
Woof woof!
diff --git a/src/material/datepicker/calendar-header.html b/src/material/datepicker/calendar-header.html
index 2e539ed68c97..2ffe6c6d1dd6 100644
--- a/src/material/datepicker/calendar-header.html
+++ b/src/material/datepicker/calendar-header.html
@@ -4,7 +4,7 @@
Relocated label next to related button and made visually hidden via cdk-visually-hidden
to enable label to appear in a11y tree for SR when using Firefox -->
{{periodButtonDescription}}
-
{{periodButtonText}}
@@ -18,7 +18,7 @@
-
@@ -26,7 +26,7 @@
-
diff --git a/src/material/datepicker/datepicker-actions.spec.ts b/src/material/datepicker/datepicker-actions.spec.ts
index d5ed05cb757a..bfc90c87a351 100644
--- a/src/material/datepicker/datepicker-actions.spec.ts
+++ b/src/material/datepicker/datepicker-actions.spec.ts
@@ -297,8 +297,8 @@ describe('MatDatepickerActions', () => {
@if (renderActions) {
- Cancel
- Apply
+ Cancel
+ Apply
}
diff --git a/src/material/datepicker/datepicker-content.html b/src/material/datepicker/datepicker-content.html
index 96fc2a3c2a09..c42467481887 100644
--- a/src/material/datepicker/datepicker-content.html
+++ b/src/material/datepicker/datepicker-content.html
@@ -32,7 +32,7 @@
Delete all elements?
This will delete all elements that are currently on this page and cannot be undone.
- Cancel
+ Cancel
- Delete
+ Delete
```
@@ -113,7 +113,7 @@ Once a dialog opens, the dialog will automatically focus the first tabbable elem
You can control which elements are tab stops with the `tabindex` attribute
```html
-Not Tabbable
+Not Tabbable
```
diff --git a/src/material/list/list.md b/src/material/list/list.md
index e6a7ed85d9d6..febcd776e3da 100644
--- a/src/material/list/list.md
+++ b/src/material/list/list.md
@@ -76,7 +76,7 @@ element in an ``.
@for (link of links; track link) {
{{ link }}
-
+
info
diff --git a/src/material/menu/menu.md b/src/material/menu/menu.md
index 55115702f62b..a9eb998efdb4 100644
--- a/src/material/menu/menu.md
+++ b/src/material/menu/menu.md
@@ -62,7 +62,7 @@ with the `matMenuContent` attribute:
-
+
more_vert
```
@@ -80,11 +80,11 @@ with a different set of data, depending on the trigger that opened it:
-
+
more_vert
-
+
more_vert
```
@@ -109,7 +109,7 @@ The menu trigger is a standard button element augmented with `aria-haspopup`, `a
The pop-up menu implements the `role="menu"` pattern, handling keyboard interaction and focus
management. Upon opening, the trigger will focus the first focusable menu item. Upon close, the menu
will return focus to its trigger. Avoid creating a menu in which all items are disabled, instead
-hiding or disabling the menu trigger.
+hiding or disabling the menu trigger.
Angular Material does not support the `menuitemcheckbox` or `menuitemradio` roles.
diff --git a/src/material/paginator/paginator.html b/src/material/paginator/paginator.html
index 10ae36fabfb2..d9cd66827870 100644
--- a/src/material/paginator/paginator.html
+++ b/src/material/paginator/paginator.html
@@ -42,7 +42,7 @@
@if (showFirstLastButtons) {
-
}
-
-
@if (showFirstLastButtons) {
-
} @else {
-
+
+ Add C/O, Apt, Suite, Unit
}
@@ -93,7 +93,7 @@
- Submit
+ Submit
diff --git a/src/material/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template b/src/material/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
index 11de5c082500..659971205047 100644
--- a/src/material/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
+++ b/src/material/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
@@ -7,7 +7,7 @@
{{card.title}}
-
+
more_vert
diff --git a/src/material/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template b/src/material/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
index d5c2e6e8dba0..a8841650ade9 100644
--- a/src/material/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
+++ b/src/material/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
@@ -16,7 +16,7 @@
menu
diff --git a/src/material/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template b/src/material/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
index c5e4fa217969..d037316833f6 100644
--- a/src/material/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
+++ b/src/material/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template
@@ -1,6 +1,6 @@
-
+
{{ node.type === 'file' ? 'description' : 'folder' }}
@@ -8,7 +8,7 @@
-
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
diff --git a/src/material/snack-bar/simple-snack-bar.html b/src/material/snack-bar/simple-snack-bar.html
index 577c7e6a3919..4f3f4a0e71b0 100644
--- a/src/material/snack-bar/simple-snack-bar.html
+++ b/src/material/snack-bar/simple-snack-bar.html
@@ -4,7 +4,7 @@
@if (hasAction) {
-
+
{{data.action}}
diff --git a/src/material/stepper/stepper.md b/src/material/stepper/stepper.md
index 69b1743e2269..b8c9f1602175 100644
--- a/src/material/stepper/stepper.md
+++ b/src/material/stepper/stepper.md
@@ -71,14 +71,14 @@ are completed.
...
- Next
+ Next
...
- Back
- Next
+ Back
+ Next
...
diff --git a/src/material/stepper/stepper.spec.ts b/src/material/stepper/stepper.spec.ts
index a750bb709b3a..287f9dcb2327 100644
--- a/src/material/stepper/stepper.spec.ts
+++ b/src/material/stepper/stepper.spec.ts
@@ -1855,16 +1855,16 @@ function createComponent(
This field is required
- Back
- Next
+ Back
+ Next
Step 2
Content 2
- Back
- Next
+ Back
+ Next
@@ -1891,23 +1891,23 @@ class MatHorizontalStepperWithErrorsApp {
Step 1
Content 1
- Back
- Next
+ Back
+ Next
Step 2
Content 2
- Back
- Next
+ Back
+ Next
Content 3
- Back
- Next
+ Back
+ Next
@@ -1929,8 +1929,8 @@ class SimpleMatHorizontalStepperApp {
Step 1
Content 1
- Back
- Next
+ Back
+ Next
@if (showStepTwo()) {
@@ -1938,16 +1938,16 @@ class SimpleMatHorizontalStepperApp {
Step 2
Content 2
- Back
- Next
+ Back
+ Next
}
Content 3
- Back
- Next
+ Back
+ Next
diff --git a/src/material/timepicker/timepicker-toggle.html b/src/material/timepicker/timepicker-toggle.html
index d023f065f91f..c8edc8a33a3b 100644
--- a/src/material/timepicker/timepicker-toggle.html
+++ b/src/material/timepicker/timepicker-toggle.html
@@ -1,5 +1,5 @@
{
Row 1
Row 2
-
+
Button 1
-
+
Button 2
diff --git a/src/universal-app/kitchen-sink/kitchen-sink.html b/src/universal-app/kitchen-sink/kitchen-sink.html
index 52cfff367412..05ede44bd546 100644
--- a/src/universal-app/kitchen-sink/kitchen-sink.html
+++ b/src/universal-app/kitchen-sink/kitchen-sink.html
@@ -12,21 +12,21 @@ Autocomplete
Bottom sheet
-Open bottom sheet
+Open bottom sheet
Button
-go
-search
-go
-home
-favorite
+go
+search
+go
+home
+favorite
-Google
-search
-Google
-home
-favorite
+Google
+search
+Google
+home
+favorite
Button toggle
@@ -59,8 +59,8 @@ Card
And more stuff
- LIKE
- SHARE
+ LIKE
+ SHARE
Hurray
@@ -111,7 +111,7 @@ Disabled datepicker
Dialog
-Open dialog
+Open dialog
Grid list
@@ -211,7 +211,7 @@ Groceries
Menu
-Open
+Open
Mercy
Lucio
@@ -299,7 +299,7 @@ Slider
Snack bar
-Open snackbar
+Open snackbar
Tabs
@@ -325,7 +325,7 @@ The overview
atque iste doloremque dolor? Ullam, aspernatur? Alias, fuga! At dolorum odio molestiae
laudantium nihil alias inventore veritatis voluptatum.
- See the overview
+ See the overview
API docs
@@ -340,7 +340,7 @@ The API docs
officiis molestias, excepturi odio, autem magni dignissimos perspiciatis, amet qui! Dolorem
molestiae similique necessitatibus cupiditate ipsa aspernatur?
- See the API docs
+ See the API docs
@@ -351,7 +351,7 @@ The examples
accusantium, eos perspiciatis reprehenderit, nobis exercitationem sunt ducimus molestiae
laborum inventore itaque incidunt. Neque dolorum adipisci quidem.
- See the examples
+ See the examples
@@ -553,7 +553,7 @@ Focus trap
Badge
-Clicky thing
+Clicky thing
Drag and Drop
Drag me around
diff --git a/tools/public_api_guard/material/button-testing.md b/tools/public_api_guard/material/button-testing.md
index d8709c6bc07b..7f7bf13f38db 100644
--- a/tools/public_api_guard/material/button-testing.md
+++ b/tools/public_api_guard/material/button-testing.md
@@ -9,15 +9,19 @@ import { ComponentHarnessConstructor } from '@angular/cdk/testing';
import { ContentContainerComponentHarness } from '@angular/cdk/testing';
import { HarnessPredicate } from '@angular/cdk/testing';
+// @public
+export type ButtonAppearance = 'text' | 'filled' | 'elevated' | 'outlined';
+
// @public
export interface ButtonHarnessFilters extends BaseHarnessFilters {
+ appearance?: ButtonAppearance;
disabled?: boolean;
text?: string | RegExp;
variant?: ButtonVariant;
}
// @public
-export type ButtonVariant = 'basic' | 'raised' | 'flat' | 'icon' | 'stroked' | 'fab' | 'mini-fab';
+export type ButtonVariant = 'basic' | 'icon' | 'fab' | 'mini-fab';
// @public
export class MatButtonHarness extends ContentContainerComponentHarness {
@@ -26,6 +30,7 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
click(location: 'center'): Promise;
click(): Promise;
focus(): Promise;
+ getAppearance(): Promise;
getText(): Promise;
getVariant(): Promise;
// (undocumented)
diff --git a/tools/public_api_guard/material/button.md b/tools/public_api_guard/material/button.md
index 779bc8c9c7bb..508b149edf41 100644
--- a/tools/public_api_guard/material/button.md
+++ b/tools/public_api_guard/material/button.md
@@ -33,15 +33,23 @@ export type MatAnchor = MatButton;
// @public
export class MatButton extends MatButtonBase {
+ constructor(...args: unknown[]);
+ get appearance(): MatButtonAppearance | null;
+ set appearance(value: MatButtonAppearance | '');
+ setAppearance(appearance: MatButtonAppearance): void;
// (undocumented)
- static ɵcmp: i0.ɵɵComponentDeclaration;
+ static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration;
}
+// @public
+export type MatButtonAppearance = 'text' | 'filled' | 'elevated' | 'outlined';
+
// @public
export interface MatButtonConfig {
color?: ThemePalette;
+ defaultAppearance?: MatButtonAppearance;
disabledInteractive?: boolean;
}
@@ -71,7 +79,7 @@ export class MatFabButton extends MatButtonBase {
// (undocumented)
static ngAcceptInputType_extended: unknown;
// (undocumented)
- static ɵcmp: i0.ɵɵComponentDeclaration;
+ static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration;
}
@@ -91,7 +99,7 @@ export type MatIconAnchor = MatIconButton;
export class MatIconButton extends MatButtonBase {
constructor(...args: unknown[]);
// (undocumented)
- static ɵcmp: i0.ɵɵComponentDeclaration;
+ static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration;
}
@@ -108,7 +116,7 @@ export class MatMiniFabButton extends MatButtonBase {
// (undocumented)
_isFab: boolean;
// (undocumented)
- static ɵcmp: i0.ɵɵComponentDeclaration;
+ static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration;
}