Skip to content

Commit 3d91f61

Browse files
authored
feat(material/core): drop dependency on animations module (angular#30459)
All Material components have been moved away from requiring the `@angular/animations` module. These changes update the docs and `peerDependencies` not to require it. This means that users can remove the BrowserAnimationsModule from their apps, if they weren't using Angular's animations system in their own code or in other dependencies. This has a few advantages: 1. It removes ~16kb of minified JS from production bundle. 2. It resolves a bunch of bugs and memory leaks that were caused by the animations. E.g. previously if there was an expansion panel inside a tab, it would be open while the animations are running and then snap into place. 3. It reduces some runtime overhead for Angular. 4. It causes fewer change detections. ### Notes This change **does not** imply that the `@angular/animations` module is deprecated, it is **still supported**. We decided to move our library away from it, because it resolved a lot of bugs that our users were seeing and we felt that it wasn't fair to force another dependency upon them. Furthermore, disabling animations using the `NoopAnimationsModule` (e.g. for tests) is still supported by Material.
1 parent bf94082 commit 3d91f61

File tree

4 files changed

+1
-8
lines changed

4 files changed

+1
-8
lines changed

guides/getting-started.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ determine which features to include:
2727

2828
Whether to apply the global [typography](https://material.angular.io/guide/typography) styles to your application.
2929

30-
3. Set up browser animations for Angular Material:
31-
32-
Importing the [`BrowserAnimationsModule`](https://angular.dev/api/platform-browser/animations/BrowserAnimationsModule) into your application enables Angular's [animation system](https://angular.dev/guide/animations). Declining this will disable most of Angular Material's animations.
33-
3430
The `ng add` command will additionally perform the following actions:
3531

3632
* Add project dependencies to `package.json`
@@ -48,7 +44,7 @@ You're done! Angular Material is now configured to be used in your application.
4844
Let's display a slide toggle component in your app and verify that everything works.
4945

5046
You need to import the `MatSlideToggleModule` that you want to display by adding the following lines to
51-
your standalone component's imports, or otherwise your component's `NgModule`.
47+
your standalone component's imports, or otherwise your component's `NgModule`.
5248

5349
```ts
5450
import { MatSlideToggleModule } from '@angular/material/slide-toggle';

guides/schematics.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ ng add @angular/cdk
2525
The Angular Material `ng add` schematic helps you set up an Angular CLI project that uses Material. Running `ng add` will:
2626

2727
- Ensure [project dependencies](./getting-started#step-1-install-angular-material-angular-cdk-and-angular-animations) are placed in `package.json`
28-
- Enable the [BrowserAnimationsModule](./getting-started#step-2-configure-animations) in your app module
2928
- Add either a prebuilt theme or a custom theme
3029
- Add Roboto fonts to your `index.html`
3130
- Add the [Material Icon font](./getting-started#step-6-optional-add-material-icons) to your `index.html`

src/material-experimental/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
}
1818
},
1919
"peerDependencies": {
20-
"@angular/animations": "0.0.0-NG",
2120
"@angular/cdk": "0.0.0-PLACEHOLDER",
2221
"@angular/core": "0.0.0-NG",
2322
"@angular/common": "0.0.0-NG",

src/material/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
}
5757
},
5858
"peerDependencies": {
59-
"@angular/animations": "0.0.0-NG",
6059
"@angular/cdk": "0.0.0-PLACEHOLDER",
6160
"@angular/core": "0.0.0-NG",
6261
"@angular/common": "0.0.0-NG",

0 commit comments

Comments
 (0)