|
2 | 2 |
|
3 | 3 | <!-- example(card-overview) -->
|
4 | 4 |
|
5 |
| - |
6 | 5 | ### Basic card sections
|
7 |
| -The most basic card needs only an `<mat-card>` element with some content. However, Angular Material |
8 |
| -provides a number of preset sections that you can use inside of an `<mat-card>`: |
9 | 6 |
|
| 7 | +The most basic card needs only an `<mat-card>` element with some content. However, Angular Material |
| 8 | +provides a number of preset sections that you can use inside a `<mat-card>`: |
10 | 9 |
|
11 |
| -| Element | Description | |
12 |
| -| ---------------------- | ------------------------------------------------------ | |
13 |
| -| `<mat-card-title>` | Card title | |
14 |
| -| `<mat-card-subtitle>` | Card subtitle | |
15 |
| -| `<mat-card-content>` | Primary card content. Intended for blocks of text | |
16 |
| -| `<img mat-card-image>` | Card image. Stretches the image to the container width | |
17 |
| -| `<mat-card-actions>` | Container for buttons at the bottom of the card | |
18 |
| -| `<mat-card-footer>` | Section anchored to the bottom of the card | |
| 10 | +| Element | Description | |
| 11 | +|--------------------------|----------------------------------------------------------------| |
| 12 | +| `<mat-card-header>` | Section anchored to the top of the card (adds padding) | |
| 13 | +| `<mat-card-content>` | Primary card content (adds padding) | |
| 14 | +| `<img mat-card-image>` | Card image. Stretches the image to the container width | |
| 15 | +| `<mat-card-actions>` | Container for buttons at the bottom of the card (adds padding) | |
| 16 | +| `<mat-card-footer>` | Section anchored to the bottom of the card | |
19 | 17 |
|
20 | 18 | These elements primary serve as pre-styled content containers without any additional APIs.
|
21 | 19 | However, the `align` property on `<mat-card-actions>` can be used to position the actions at the
|
22 |
| -`'start'` or `'end'` of the container. |
| 20 | +`'start'` or `'end'` of the container. |
| 21 | + |
| 22 | +### Card padding |
23 | 23 |
|
| 24 | +The `<mat-card>` element itself does not add any padding around its content. This allows developers |
| 25 | +to customize the padding to their liking by applying padding to the elements they put in the card. |
| 26 | + |
| 27 | +In many cases developers may just want the standard padding specified in the Material Design spec. |
| 28 | +In this case, the `<mat-card-header>`, `<mat-card-content>`, and `<mat-card-footer>` sections can be |
| 29 | +used. |
| 30 | + |
| 31 | +* `<mat-card-content>` adds standard padding along its sides, as well as along the top if it is the |
| 32 | + first element in the `<mat-card>`, and along the bottom if it is the last element in the |
| 33 | + `<mat-card>`. |
| 34 | +* `<mat-card-header>` adds standard padding along its sides and top. |
| 35 | +* `<mat-card-actions>` adds padding appropriate for the action buttons at the bottom of a card. |
24 | 36 |
|
25 | 37 | ### Card headers
|
26 |
| -In addition to the aforementioned sections, `<mat-card-header>` gives the ability to add a rich |
27 |
| -header to a card. This header can contain: |
28 | 38 |
|
29 |
| -| Element | Description | |
30 |
| -| ----------------------- | -------------------------------------------- | |
31 |
| -| `<mat-card-title>` | A title within the header | |
32 |
| -| `<mat-card-subtitle>` | A subtitle within the header | |
33 |
| -| `<img mat-card-avatar>` | An image used as an avatar within the header | |
| 39 | +A `<mat-card-header>` can contain any content, but there are several predefined elements |
| 40 | +that can be used to create a rich header to a card. These include: |
34 | 41 |
|
| 42 | +| Element | Description | |
| 43 | +|--------------------------|------------------------------------------------------| |
| 44 | +| `<mat-card-title>` | A title within the header | |
| 45 | +| `<mat-card-subtitle>` | A subtitle within the header | |
| 46 | +| `<img mat-card-avatar>` | An image used as an avatar within the header | |
| 47 | + |
| 48 | +In addition to using `<mat-card-title>` and `<mat-card-subtitle>` directly within the |
| 49 | +`<mat-card-header>`, they can be further nested inside a `<mat-card-title-group>` in order arrange |
| 50 | +them with a (non-avatar) image. |
35 | 51 |
|
36 | 52 | ### Title groups
|
| 53 | + |
37 | 54 | `<mat-card-title-group>` can be used to combine a title, subtitle, and image into a single section.
|
38 | 55 | This element can contain:
|
39 | 56 | * `<mat-card-title>`
|
|
0 commit comments