diff --git a/src/components-examples/material/button/BUILD.bazel b/src/components-examples/material/button/BUILD.bazel index c535f58d8b7c..4584a389fed0 100644 --- a/src/components-examples/material/button/BUILD.bazel +++ b/src/components-examples/material/button/BUILD.bazel @@ -19,6 +19,7 @@ ng_module( "//src/material/button/testing", "//src/material/divider", "//src/material/icon", + "//src/material/tooltip", "@npm//@angular/platform-browser", "@npm//@angular/platform-browser-dynamic", "@npm//@types/jasmine", diff --git a/src/components-examples/material/button/button-types/button-types-example.css b/src/components-examples/material/button/button-types/button-types-example.css index 34087886392b..74bc6ae390ab 100644 --- a/src/components-examples/material/button/button-types/button-types-example.css +++ b/src/components-examples/material/button/button-types/button-types-example.css @@ -2,3 +2,7 @@ .example-button-row a { margin-right: 8px; } + +.example-disabled { + display: inline-block; +} diff --git a/src/components-examples/material/button/button-types/button-types-example.html b/src/components-examples/material/button/button-types/button-types-example.html index 574e47a9b5cc..684a5a7f7683 100644 --- a/src/components-examples/material/button/button-types/button-types-example.html +++ b/src/components-examples/material/button/button-types/button-types-example.html @@ -40,45 +40,90 @@

Flat Buttons

Icon Buttons

- - - - - +
+ favorite - +

Fab Buttons

- - - - - - + - Link + +
+ +
+ + favorite +

Mini Fab Buttons

- - - - - - - Link + + +
+ +
+ + favorite + +
+ +

Extended Fab

+
+ + + + + + favorite + Link +
diff --git a/src/components-examples/material/button/index.ts b/src/components-examples/material/button/index.ts index bb13ae3729f2..f46a9ccf6666 100644 --- a/src/components-examples/material/button/index.ts +++ b/src/components-examples/material/button/index.ts @@ -2,6 +2,7 @@ import {NgModule} from '@angular/core'; import {MatButtonModule} from '@angular/material/button'; import {MatDividerModule} from '@angular/material/divider'; import {MatIconModule} from '@angular/material/icon'; +import {MatTooltipModule} from '@angular/material/tooltip'; import {ButtonOverviewExample} from './button-overview/button-overview-example'; import {ButtonTypesExample} from './button-types/button-types-example'; import {ButtonHarnessExample} from './button-harness/button-harness-example'; @@ -11,7 +12,7 @@ export {ButtonOverviewExample, ButtonTypesExample, ButtonHarnessExample}; const EXAMPLES = [ButtonOverviewExample, ButtonTypesExample, ButtonHarnessExample]; @NgModule({ - imports: [MatButtonModule, MatDividerModule, MatIconModule], + imports: [MatButtonModule, MatDividerModule, MatIconModule, MatTooltipModule], declarations: EXAMPLES, exports: EXAMPLES, }) diff --git a/src/material/button/README.md b/src/material/button/README.md deleted file mode 100644 index 7b2b438d6492..000000000000 --- a/src/material/button/README.md +++ /dev/null @@ -1,80 +0,0 @@ -This is a prototype of an alternate version of `MatButton` built on top of -[MDC Web](https://github.com/material-components/material-components-web). This component is -experimental and should not be used in production. - -## How to use -Assuming your application is already up and running using Angular Material, you can add this -component by following these steps: - -1. Install `@angular/material-experimental` and MDC Web: - - ```bash - npm i material-components-web @angular/material-experimental - ``` - -2. In your `angular.json`, make sure `node_modules/` is listed as a Sass include path. This is - needed for the Sass compiler to be able to find the MDC Web Sass files. - - ```json - ... - "styles": [ - "src/styles.scss" - ], - "stylePreprocessorOptions": { - "includePaths": [ - "node_modules/" - ] - }, - ... - ``` - -3. Import the experimental `MatButtonModule` and add it to the module that declares your component: - - ```ts - import {MatButtonModule} from '@angular/material-experimental/mdc-button'; - @NgModule({ - declarations: [MyComponent], - imports: [MatButtonModule], - }) - export class MyModule {} - ``` - -4. Use the buttons in your component's template: - - ```html - - - - - - - ``` - -5. Add the theme and typography mixins to your Sass. Note that there are three separate mixins for -the button variants: standard buttons, icon buttons, and floating action buttons. Include only the mixins of the -button variants you are using: - - ```scss - @use '@angular/material' as mat; - @use '@angular/material-experimental' as mat-experimental; - $candy-app-primary: mat.define-palette(mat.$indigo-palette); - $candy-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400); - $candy-app-theme: mat.define-light-theme(( - color: ( - primary: $candy-app-primary, - accent: $candy-app-accent, - ) - )); - @include mat-experimental.mdc-button-theme($candy-app-theme); - @include mat-experimental.mdc-fab-theme($candy-app-theme); - @include mat-experimental.mdc-icon-button-theme($candy-app-theme); - ``` - -## API differences - -The API of the buttons matches the one from `@angular/material/button`. Simply replace imports to -`@angular/material/button` with imports to `@angular/material-experimental/mdc-button`. diff --git a/src/material/button/button.md b/src/material/button/button.md index 8a8308b8417c..e922733ec9f9 100644 --- a/src/material/button/button.md +++ b/src/material/button/button.md @@ -32,6 +32,19 @@ certain locales. It is also worth noting that using ALL CAPS in the text itself screen-readers, which will read the text character-by-character. We leave the decision of how to approach this to the consuming app. +### 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. + +```html + +``` + ### Accessibility Angular Material uses native `