Skip to content

Commit c14c34e

Browse files
devversionandrewseguin
authored andcommitted
docs: show all available schematics in the schematics guide (#13520)
* docs: show all available schematics in the schematics guide * Updates the outdated `schematics` guide to mention the new available component schematics. * Address feedback
1 parent f138682 commit c14c34e

File tree

1 file changed

+70
-21
lines changed

1 file changed

+70
-21
lines changed

guides/schematics.md

Lines changed: 70 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,97 @@ install schematic.
1313
ng add @angular/material
1414
```
1515

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:
1823

1924
- Ensure [project dependencies](./getting-started#step-1-install-angular-material-angular-cdk-and-angular-animations) are placed in `package.json`
2025
- Enable the [BrowserAnimationsModule](./getting-started#step-2-configure-animations) your app module
2126
- 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`
2429
- Add global styles to
2530
- Remove margins from `body`
2631
- Set `height: 100%` on `html` and `body`
2732
- 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 |
2956

30-
## Generator Schematics
31-
In addition to the install schematic, Angular Material has three schematics it comes packaged with:
57+
#### Address form schematic
3258

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:
3661

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
3972
a toolbar with the app name and a responsive side nav based on Material
4073
breakpoints.
4174

4275
```
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>
4493
```
4594

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.
4998

5099
```
51-
ng generate @angular/material:material-dashboard --name <component-name>
100+
ng generate @angular/material:tree <component-name>
52101
```
53102

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.
57106

58107
```
59-
ng generate @angular/material:material-table --name <component-name>
108+
ng generate @angular/cdk:drag-drop <component-name>
60109
```

0 commit comments

Comments
 (0)