Skip to content

Commit a4fc779

Browse files
andrewseguinjelbourn
authored andcommitted
docs(material-experimental/button): update class JsDoc (#16988)
1 parent 680ed00 commit a4fc779

File tree

4 files changed

+53
-7
lines changed

4 files changed

+53
-7
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
### TODO
2-
- Write README - looks like lot of overlap with checkbox README. Create common readme for setup
3-
- JSDoc comments on all classes, consts
42
- Consider supporting button[mat-outlined-button]
53
- Add to universal app
64
- Consider if we want to add a "appearance/type" input to button, similar to form field (outline/stroked, flat, raised)

src/material-experimental/mdc-button/button.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ import {
2727
MatButtonBase
2828
} from './button-base';
2929

30-
30+
/**
31+
* Material Design button component. Users interact with a button to perform an action.
32+
* See https://material.io/components/buttons
33+
*
34+
* The `MatButton` class applies to native button elements and captures the appearances for
35+
* "text button", "outlined button", and "contained button" per the Material Design
36+
* specification. `MatButton` additionally captures an additional "flat" appearance, which matches
37+
* "contained" but without elevation.
38+
*/
3139
@Component({
3240
moduleId: module.id,
3341
selector: `
@@ -50,6 +58,16 @@ export class MatButton extends MatButtonBase {
5058
}
5159
}
5260

61+
/**
62+
* Material Design button component for anchor elements. Anchor elements are used to provide
63+
* links for the user to navigate across different routes or pages.
64+
* See https://material.io/components/buttons
65+
*
66+
* The `MatAnchor` class applies to native anchor elements and captures the appearances for
67+
* "text button", "outlined button", and "contained button" per the Material Design
68+
* specification. `MatAnchor` additionally captures an additional "flat" appearance, which matches
69+
* "contained" but without elevation.
70+
*/
5371
@Component({
5472
moduleId: module.id,
5573
selector: `a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button]`,

src/material-experimental/mdc-button/fab.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ import {
2626
MAT_BUTTON_INPUTS,
2727
MatButtonBase
2828
} from './button-base';
29+
import {ThemePalette} from '@angular/material/core';
2930

30-
31+
/**
32+
* Material Design floating action button (FAB) component. These buttons represent the primary
33+
* or most common action for users to interact with.
34+
* See https://material.io/components/buttons-floating-action-button/
35+
*
36+
* The `MatFabButton` class has two appearances: normal and mini.
37+
*/
3138
@Component({
3239
moduleId: module.id,
3340
selector: `button[mat-fab], button[mat-mini-fab]`,
@@ -40,14 +47,24 @@ import {
4047
changeDetection: ChangeDetectionStrategy.OnPush,
4148
})
4249
export class MatFabButton extends MatButtonBase {
50+
// The FAB by default has its color set to accent.
51+
color = 'accent' as ThemePalette;
52+
4353
constructor(
4454
elementRef: ElementRef, platform: Platform, ngZone: NgZone,
4555
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
4656
super(elementRef, platform, ngZone, animationMode);
47-
this.color = 'accent';
4857
}
4958
}
5059

60+
61+
/**
62+
* Material Design floating action button (FAB) component for anchor elements. Anchor elements
63+
* are used to provide links for the user to navigate across different routes or pages.
64+
* See https://material.io/components/buttons-floating-action-button/
65+
*
66+
* The `MatFabAnchor` class has two appearances: normal and mini.
67+
*/
5168
@Component({
5269
moduleId: module.id,
5370
selector: `a[mat-fab], a[mat-mini-fab]`,
@@ -60,10 +77,12 @@ export class MatFabButton extends MatButtonBase {
6077
changeDetection: ChangeDetectionStrategy.OnPush,
6178
})
6279
export class MatFabAnchor extends MatAnchor {
80+
// The FAB by default has its color set to accent.
81+
color = 'accent' as ThemePalette;
82+
6383
constructor(
6484
elementRef: ElementRef, platform: Platform, ngZone: NgZone,
6585
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
6686
super(elementRef, platform, ngZone, animationMode);
67-
this.color = 'accent';
6887
}
6988
}

src/material-experimental/mdc-button/icon-button.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ import {
2727
MatButtonBase
2828
} from './button-base';
2929

30-
30+
/**
31+
* Material Design icon button component. This type of button displays a single interactive icon for
32+
* users to perform an action.
33+
* See https://material.io/develop/web/components/buttons/icon-buttons/
34+
*/
3135
@Component({
3236
moduleId: module.id,
3337
selector: `button[mat-icon-button]`,
@@ -40,6 +44,7 @@ import {
4044
changeDetection: ChangeDetectionStrategy.OnPush,
4145
})
4246
export class MatIconButton extends MatButtonBase {
47+
// Set the ripple to be centered for icon buttons
4348
_isRippleCentered = true;
4449

4550
constructor(
@@ -49,6 +54,11 @@ export class MatIconButton extends MatButtonBase {
4954
}
5055
}
5156

57+
/**
58+
* Material Design icon button component for anchor elements. This button displays a single
59+
* interaction icon that allows users to navigate across different routes or pages.
60+
* See https://material.io/develop/web/components/buttons/icon-buttons/
61+
*/
5262
@Component({
5363
moduleId: module.id,
5464
selector: `a[mat-icon-button]`,
@@ -61,6 +71,7 @@ export class MatIconButton extends MatButtonBase {
6171
changeDetection: ChangeDetectionStrategy.OnPush,
6272
})
6373
export class MatIconAnchor extends MatAnchorBase {
74+
// Set the ripple to be centered for icon buttons
6475
_isRippleCentered = true;
6576

6677
constructor(

0 commit comments

Comments
 (0)