@@ -13,48 +13,97 @@ install schematic.
13
13
ng add @angular/material
14
14
```
15
15
16
- The install schematic will help you add Material to a new project.
17
- This schematic will:
16
+ In case you just want to install the ` @angular/cdk ` , there are also schematics for the [ Component Dev Kit] ( https://material.angular.io/cdk )
17
+
18
+ ```
19
+ ng add @angular/cdk
20
+ ```
21
+
22
+ The Angular Material ` ng add ` schematic helps you setup an Angular CLI project that uses Material. Running ` ng add ` will:
18
23
19
24
- Ensure [ project dependencies] ( ./getting-started#step-1-install-angular-material-angular-cdk-and-angular-animations ) are placed in ` package.json `
20
25
- Enable the [ BrowserAnimationsModule] ( ./getting-started#step-2-configure-animations ) your app module
21
26
- Add either a [ prebuilt theme] ( ./theming#using-a-pre-built-theme ) or a [ custom theme] ( ./theming#defining-a-custom-theme )
22
- - Add Roboto fonts to your index.html
23
- - Add the [ Material Icon font] ( ./getting-started#step-6-optional-add-material-icons ) to your index.html
27
+ - Add Roboto fonts to your ` index.html `
28
+ - Add the [ Material Icon font] ( ./getting-started#step-6-optional-add-material-icons ) to your ` index.html `
24
29
- Add global styles to
25
30
- Remove margins from ` body `
26
31
- Set ` height: 100% ` on ` html ` and ` body `
27
32
- Make Roboto the default font of your app
28
- - Install and import ` hammerjs ` for [ touch gesture support] ( ./getting-started#step-5-gesture-support ) in your project
33
+ - Install and import ` hammerjs ` for [ gesture support] ( ./getting-started#step-5-gesture-support ) in your project
34
+
35
+
36
+ ## Component schematics
37
+ In addition to the install schematic, Angular Material comes with multiple schematics that can be
38
+ used to easily generate Material Design components:
39
+
40
+
41
+ | Name | Description |
42
+ | ----------------| --------------------------------------------------------------------------------------------------------|
43
+ | ` address-form ` | Component with a form group that uses Material Design form controls to prompt for a shipping address |
44
+ | ` navigation ` | Creates a component with a responsive Material Design sidenav and a toolbar for showing the app name |
45
+ | ` dashboard ` | Component with multiple Material Design cards and menus which are aligned in a grid layout |
46
+ | ` table ` | Generates a component with a Material Design data table that supports sorting and pagination |
47
+ | ` tree ` | Component that interactively visualizes a nested folder structure by using the ` <mat-tree> ` component |
48
+
49
+
50
+ Additionally the Angular CDK also comes with a collection of component schematics:
51
+
52
+
53
+ | Name | Description |
54
+ | ----------------| ----------------------------------------------------------------------------------------------------|
55
+ | ` drag-drop ` | Component that uses the ` @angular/cdk/drag-drop ` directives for creating an interactive to-do list |
29
56
30
- ## Generator Schematics
31
- In addition to the install schematic, Angular Material has three schematics it comes packaged with:
57
+ #### Address form schematic
32
58
33
- - Navigation
34
- - Dashboard
35
- - Table
59
+ Running the ` address-form ` schematic generates a new Angular component that can be used to get
60
+ started with a Material Design form group consisting of:
36
61
37
- ### Navigation Schematic
38
- The navigation schematic will create a new component that includes
62
+ * Material Design form fields
63
+ * Material Design radio controls
64
+ * Material Design buttons
65
+
66
+ ```
67
+ ng generate @angular/material:address-form <component-name>
68
+ ```
69
+
70
+ #### Navigation schematic
71
+ The ` navigation ` schematic will create a new component that includes
39
72
a toolbar with the app name and a responsive side nav based on Material
40
73
breakpoints.
41
74
42
75
```
43
- ng generate @angular/material:material-nav --name <component-name>
76
+ ng generate @angular/material:nav <component-name>
77
+ ```
78
+
79
+ #### Table schematic
80
+ The table schematic will create a component that renders an Angular Material ` <table> ` which has
81
+ been pre-configured with a datasource for sorting and pagination.
82
+
83
+ ```
84
+ ng generate @angular/material:table <component-name>
85
+ ```
86
+
87
+ #### Dashboard schematic
88
+ The ` dashboard ` schematic will create a new component that contains
89
+ a dynamic grid list of Material Design cards.
90
+
91
+ ```
92
+ ng generate @angular/material:dashboard <component-name>
44
93
```
45
94
46
- ### Dashboard Schematic
47
- The dashboard schematic will create a new component that contains
48
- a dynamic grid list of cards .
95
+ #### Tree schematic
96
+ The ` tree ` schematic can be used to quickly generate an Angular component that uses the Angular
97
+ Material ` <mat-tree> ` component to visualize a nested folder structure .
49
98
50
99
```
51
- ng generate @angular/material:material-dashboard --name <component-name>
100
+ ng generate @angular/material:tree <component-name>
52
101
```
53
102
54
- ### Table Schematic
55
- The table schematic will create a new table component pre-configured
56
- with a datasource for sorting and pagination .
103
+ #### Drag and Drop schematic
104
+ The ` drag-drop ` schematic is provided by the ` @angular/cdk ` and can be used to generate a component
105
+ that uses the CDK drag and drop directives .
57
106
58
107
```
59
- ng generate @angular/material:material-table --name <component-name>
108
+ ng generate @angular/cdk:drag-drop <component-name>
60
109
```
0 commit comments