Skip to content

Commit a20a9ec

Browse files
crisbetoandrewseguin
authored andcommitted
docs: switch remaining docs to @use (#22527)
Updates all of the remaining docs to go through the new `@use` API instead of `@import`. **Note:** does not include the `mdc-button` readme, because the necessary mixins aren't exported yet. See #22449. (cherry picked from commit 1def768)
1 parent 6c8bd45 commit a20a9ec

File tree

19 files changed

+166
-166
lines changed

19 files changed

+166
-166
lines changed

src/cdk/text-field/text-field.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ changes.
3232

3333
Note: This service requires some CSS to install animation hooks when the autofill statechanges. If
3434
you are using Angular Material, this CSS is included as part of the `mat-core` mixin. If you are not
35-
using Angular Material, you should include this CSS with the `cdk-text-field` mixin.
35+
using Angular Material, you should include this CSS with the `text-field-autofill` mixin.
3636

3737
```scss
38-
@import '~@angular/cdk/text-field/text-field';
38+
@use '~@angular/cdk';
3939

40-
@include cdk-text-field();
40+
@include cdk.text-field-autofill();
4141
```
4242

4343
### Styling the autofill state of an `<input>`
4444

4545
It can be difficult to override the browser default `background` and `color` properties on an
46-
autofilled `<input>`. To make this simpler, the CDK includes a mixin `cdk-text-field-autofill-color`
46+
autofilled `<input>`. To make this simpler, the CDK includes a mixin `text-field-autofill-color`
4747
which can be used to set these properties. It takes a `background` value as the first parameter and
4848
an optional `color` value as the second parameter.
4949

5050
```scss
51-
@import '~@angular/cdk/text-field/text-field';
51+
@use '~@angular/cdk';
5252

53-
// Set custom-autofill inputs to have no background and red text.
53+
// Set custom autofill inputs to have no background and red text.
5454
input.custom-autofill {
55-
@include cdk-text-field-autofill-color(transparent, red);
55+
@include cdk.text-field-autofill-color(transparent, red);
5656
}
5757
```

src/material-experimental/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ component by following these steps:
2929
},
3030
...
3131
```
32-
32+
3333
3. Import the `NgModule` for the component you want to use. For example, the checkbox:
3434
```ts
3535
import {MatCheckboxModule} from '@angular/material-experimental/mdc-checkbox';
@@ -42,7 +42,7 @@ component by following these steps:
4242
```
4343

4444
4. Add use the components just as you would the normal Angular Material components. For example,
45-
the checkbox:
45+
the checkbox:
4646
```html
4747
<mat-checkbox [checked]="isChecked">Check me</mat-checkbox>
4848
```
@@ -52,23 +52,23 @@ mixins except that they are suffixed with `-mdc`. Some experimental components m
5252
be included in the pre-built CSS mixin and will need to be explicitly included.
5353

5454
```scss
55-
@import '~@angular/material/theming';
56-
@import '~@angular/material-experimental/mdc-theming/all-theme';
57-
58-
$my-primary: mat-palette($mat-indigo);
59-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
60-
$my-theme: mat-light-theme((
55+
@use '~@angular/material' as mat;
56+
@use '~@angular/material-experimental' as mat-experimental;
57+
58+
$my-primary: mat.define-palette(mat.$indigo-palette);
59+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
60+
$my-theme: mat.define-light-theme((
6161
color: (
62-
primary: $my-primary,
62+
primary: $my-primary,
6363
accent: $my-accent
6464
),
65-
// Using `mat-mdc-typography-config` rather than `mat-typography-config` generates a typography
66-
// config directly from the official Material Design styles. This includes using `rem`-based
67-
// measurements rather than `px`-based ones as the spec recommends.
68-
typography: mat-mdc-typography-config(),
65+
// Using `define-mdc-typography-config` rather than `define-typography-config` generates a
66+
// typography config directly from the official Material Design styles. This includes using
67+
// `rem`-based measurements rather than `px`-based ones as the spec recommends.
68+
typography: mat-experimental.define-mdc-typography-config(),
6969
// The density level to use in this theme, defaults to 0 if not specified.
7070
density: 0
7171
));
7272

73-
@include angular-material-mdc-theme($my-theme);
73+
@include mat-experimental.all-mdc-component-themes($my-theme);
7474
```

src/material-experimental/mdc-autocomplete/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,20 @@ component by following these steps:
5757
the experimental `<mat-autocomplete>`):
5858

5959
```scss
60-
@import '~@angular/material/theming';
61-
@import '~@angular/material-experimental/mdc-autocomplete/autocomplete-theme';
60+
@use '~@angular/material' as mat;
61+
@use '~@angular/material-experimental' as mat-experimental;
6262

63-
$my-primary: mat-palette($mat-indigo);
64-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
65-
$my-theme: mat-light-theme((
63+
$my-primary: mat.define-palette(mat.$indigo-palette);
64+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
65+
$my-theme: mat.define-light-theme((
6666
color: (
6767
primary: $my-primary,
6868
accent: $my-accent
6969
)
7070
));
7171

72-
@include mat-mdc-autocomplete-theme($my-theme);
73-
@include mat-mdc-autocomplete-typography($my-theme);
72+
@include mat-experimental.mdc-autocomplete-theme($my-theme);
73+
@include mat-experimental.mdc-autocomplete-typography($my-theme);
7474
```
7575

7676
## API differences

src/material-experimental/mdc-card/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This is a prototype of an alternate version of `MatCard` built on top of
33
experimental and should not be used in production.
44

55
## How to use
6-
Assuming your application is already up and running using Angular Material, you can add this
6+
Assuming your application is already up and running using Angular Material, you can add this
77
component by following these steps:
88

99
1. Install `@angular/material-experimental` and MDC Web:
@@ -41,8 +41,8 @@ component by following these steps:
4141
```
4242

4343
4. Use the card in your component's template:
44-
45-
```html
44+
45+
```html
4646
<mat-card>
4747
<mat-card-title> My Card Title </mat-card-title>
4848
<mat-card-content>
@@ -53,25 +53,25 @@ component by following these steps:
5353
<button> Share </button>
5454
</mat-card-actions>
5555
</mat-card>
56-
```
57-
56+
```
57+
5858
5. Add the theme and typography mixins to your Sass:
5959

6060
```scss
61-
@import '~@angular/material/theming';
62-
@import '~@angular/material-experimental/mdc-card/card-theme';
61+
@use '~@angular/material' as mat;
62+
@use '~@angular/material-experimental' as mat-experimental;
6363

64-
$candy-app-primary: mat-palette($mat-indigo);
65-
$candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
66-
$candy-app-theme: mat-light-theme((
64+
$candy-app-primary: mat.define-palette(mat.$indigo-palette);
65+
$candy-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
66+
$candy-app-theme: mat.define-light-theme((
6767
color: (
6868
primary: $candy-app-primary,
6969
accent: $candy-app-accent,
7070
)
7171
));
7272

7373

74-
@include mat-mdc-card-theme($candy-app-theme);
74+
@include mat-experimental.mdc-card-theme($candy-app-theme);
7575
```
7676

7777
## API differences

src/material-experimental/mdc-checkbox/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ component by following these steps:
5353
the experimental `<mat-checkbox>`):
5454

5555
```scss
56-
@import '~@angular/material/theming';
57-
@import '~@angular/material-experimental/mdc-checkbox/checkbox-theme';
56+
@use '~@angular/material' as mat;
57+
@use '~@angular/material-experimental' as mat-experimental;
5858

59-
$my-primary: mat-palette($mat-indigo);
60-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
61-
$my-theme: mat-light-theme((
59+
$my-primary: mat.define-palette(mat.$indigo-palette);
60+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
61+
$my-theme: mat.define-light-theme((
6262
color: (
63-
primary: $my-primary,
63+
primary: $my-primary,
6464
accent: $my-accent
6565
)
6666
));
6767

68-
@include mat-mdc-checkbox-theme($my-theme);
69-
@include mat-mdc-checkbox-typography($my-theme);
68+
@include mat-experimental.mdc-checkbox-theme($my-theme);
69+
@include mat-experimental.mdc-checkbox-typography($my-theme);
7070
```
7171

7272
## API differences

src/material-experimental/mdc-chips/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ Assuming your application is already up and running using Angular Material, you
5050
5. Add the theme mixins to your Sass:
5151

5252
```scss
53-
@import '~@angular/material/theming';
54-
@import '~@angular/material-experimental/mdc-chips/chips-theme';
53+
@use '~@angular/material' as mat;
54+
@use '~@angular/material-experimental' as mat-experimental;
5555

56-
$candy-app-primary: mat-palette($mat-indigo);
57-
$candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
58-
$candy-app-theme: mat-light-theme((
56+
$candy-app-primary: mat.define-palette(mat.$indigo-palette);
57+
$candy-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
58+
$candy-app-theme: mat.define-light-theme((
5959
color: (
6060
primary: $candy-app-primary,
6161
accent: $candy-app-accent,
62-
),
62+
)
6363
));
6464

6565

66-
@include mat-mdc-chips-theme($candy-app-theme);
66+
@include mat-experimental.mdc-chips-theme($candy-app-theme);
6767
```
6868

6969
## API differences

src/material-experimental/mdc-dialog/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ component by following these steps:
4343

4444
4. Use the `MatDialog` service in your components by injecting the service, just like you would
4545
use the normal dialog.
46-
46+
4747
5. Ensure color and typography styles for `@angular/material-experimental` are set up. Either
4848
use a custom theme and use the `mat-mdc-dialog-theme` mixin, or use a prebuilt theme
4949
from `@angular/material-experimental/mdc-theming/prebuilt`.
@@ -57,7 +57,7 @@ longer has outer padding by default.
5757
If content elements such as `matDialogContent` or `matDialogTitle` are used though, the MDC dialog
5858
will display as with the current non-experimental dialog. The padding change will only surface if
5959
you have custom content within the dialog that is not wrapped with `matDialogContent`,
60-
`matDialogActions` or `matDialogTitle`.
60+
`matDialogActions` or `matDialogTitle`.
6161

6262
We provide a backwards compatibility mixin that re-adds the outer padding. The use of this mixin
6363
is generally not recommended as it results in inefficient CSS for the dialog because padding from
@@ -67,7 +67,7 @@ directly through CSS, or move them into one of the defined sections the Angular
6767
provides.
6868

6969
```scss
70-
@import '@angular/material-experimental/mdc-dialog/dialog-legacy-padding';
70+
@use '@angular/material-experimental/mdc-dialog/dialog-legacy-padding' as mat-mdc-dialog;
7171

72-
@include mat-mdc-dialog-legacy-padding();
72+
@include mat-mdc-dialog.legacy-padding();
7373
```

src/material-experimental/mdc-menu/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,20 @@ component by following these steps:
5757
the experimental `<mat-menu>`):
5858

5959
```scss
60-
@import '~@angular/material/theming';
61-
@import '~@angular/material-experimental/mdc-menu/menu-theme';
60+
@use '~@angular/material' as mat;
61+
@use '~@angular/material-experimental' as mat-experimental;
6262

63-
$my-primary: mat-palette($mat-indigo);
64-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
65-
$my-theme: mat-light-theme((
63+
$my-primary: mat.define-palette(mat.$indigo-palette);
64+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
65+
$my-theme: mat.define-light-theme((
6666
color: (
67-
primary: $my-primary,
67+
primary: $my-primary,
6868
accent: $my-accent
6969
)
7070
));
7171

72-
@include mat-mdc-menu-theme($my-theme);
73-
@include mat-mdc-menu-typography($my-theme);
72+
@include mat-experimental.mdc-menu-theme($my-theme);
73+
@include mat-experimental.mdc-menu-typography($my-theme);
7474
```
7575

7676
## API differences

src/material-experimental/mdc-paginator/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ component by following these steps:
5353
the experimental `<mat-paginator>`):
5454

5555
```scss
56-
@import '~@angular/material/theming';
57-
@import '~@angular/material-experimental/mdc-paginator/paginator-theme';
56+
@use '~@angular/material' as mat;
57+
@use '~@angular/material-experimental' as mat-experimental;
5858

59-
$my-primary: mat-palette($mat-indigo);
60-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
61-
$my-theme: mat-light-theme((
59+
$my-primary: mat.define-palette(mat.$indigo-palette);
60+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
61+
$my-theme: mat.define-light-theme((
6262
color: (
6363
primary: $my-primary,
6464
accent: $my-accent
6565
)
6666
));
6767

68-
@include mat-mdc-paginator-theme($my-theme);
69-
@include mat-mdc-paginator-typography($my-theme);
68+
@include mat-experimental.mdc-paginator-theme($my-theme);
69+
@include mat-experimental.mdc-paginator-typography($my-theme);
7070
```
7171

7272
## API differences

src/material-experimental/mdc-progress-bar/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ component by following these steps:
5454
the experimental `<mat-progress-bar>`):
5555

5656
```scss
57-
@import '~@angular/material/theming';
58-
@import '~@angular/material-experimental/mdc-progress-bar/progress-bar-theme';
57+
@use '~@angular/material' as mat;
58+
@use '~@angular/material-experimental' as mat-experimental;
5959

60-
$my-primary: mat-palette($mat-indigo);
61-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
62-
$my-theme: mat-light-theme((
60+
$my-primary: mat.define-palette(mat.$indigo-palette);
61+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
62+
$my-theme: mat.define-light-theme((
6363
color: (
64-
primary: $my-primary,
64+
primary: $my-primary,
6565
accent: $my-accent
6666
)
6767
));
6868

69-
@include mat-mdc-progress-bar-theme($my-theme);
70-
@include mat-mdc-progress-bar-typography($my-theme);
69+
@include mat-experimental.mdc-progress-bar-theme($my-theme);
70+
@include mat-experimental.mdc-progress-bar-typography($my-theme);
7171
```
7272

7373
## Replacing the standard progress bar in an existing app

src/material-experimental/mdc-progress-spinner/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ component by following these steps:
5454
the experimental `<mat-progress-spinner>`):
5555

5656
```scss
57-
@import '~@angular/material/theming';
58-
@import '~@angular/material-experimental/mdc-progress-spinner/progress-spinner-theme';
57+
@use '~@angular/material' as mat;
58+
@use '~@angular/material-experimental' as mat-experimental;
5959

60-
$my-primary: mat-palette($mat-indigo);
61-
$my-accent: mat-palette($mat-pink, A200, A100, A400);
62-
$my-theme: mat-light-theme((
60+
$my-primary: mat.define-palette(mat.$indigo-palette);
61+
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
62+
$my-theme: mat.define-light-theme((
6363
color: (
64-
primary: $my-primary,
64+
primary: $my-primary,
6565
accent: $my-accent
6666
)
6767
));
6868

69-
@include mat-mdc-progress-spinner-theme($my-theme);
70-
@include mat-mdc-progress-spinner-typography($my-theme);
69+
@include mat-experimental.mdc-progress-spinner-theme($my-theme);
70+
@include mat-experimental.mdc-progress-spinner-typography($my-theme);
7171
```
7272

7373
## Replacing the standard progress spinner in an existing app

0 commit comments

Comments
 (0)