|
| 1 | +# md-card |
| 2 | + |
| 3 | +`md-card` is a content container component that conforms to the spec of a Material Design card. |
| 4 | + |
| 5 | +See plunker example [here](http://plnkr.co/edit/pkUNGMXPcf8RXKapXNXQ?p=preview). |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +Simply add your content between `md-card` tags to consume basic card styles like box-shadow and default padding. |
| 10 | + |
| 11 | +```html |
| 12 | +<md-card> |
| 13 | + Basic card. |
| 14 | +</md-card> |
| 15 | +``` |
| 16 | + |
| 17 | +Output: |
| 18 | + |
| 19 | +<img src="https://material.angularjs.org/material2_assets/cards/basic-card-min.png"> |
| 20 | + |
| 21 | +### Preset sections |
| 22 | + |
| 23 | +We also provide a number of preset sections that you can mix and match within the `md-card` tags. |
| 24 | + |
| 25 | + * `<md-card-title>`: adds styles for a title |
| 26 | + * `<md-card-subtitle>`: adds styles for a subtitle |
| 27 | + * `<md-card-content>`: main content section, intended for blocks of text |
| 28 | + * `<img md-card-image>`: stretches image to container width |
| 29 | + * `<md-card-actions>`: wraps and styles buttons |
| 30 | + * `<md-card-footer>`: anchors section to bottom of card |
| 31 | + |
| 32 | +Example markup for a card with section presets: |
| 33 | + |
| 34 | +```html |
| 35 | +<md-card> |
| 36 | + <md-card-subtitle>Subtitle first</md-card-subtitle> |
| 37 | + <md-card-title>Card with title</md-card-title> |
| 38 | + <md-card-content> |
| 39 | + <p>This is supporting text.</p> |
| 40 | + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do |
| 41 | + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad</p> |
| 42 | + </md-card-content> |
| 43 | + <md-card-actions> |
| 44 | + <button md-button>LIKE</button> |
| 45 | + <button md-button>SHARE</button> |
| 46 | + </md-card-actions> |
| 47 | +</md-card> |
| 48 | +``` |
| 49 | + |
| 50 | +Output: |
| 51 | + |
| 52 | +<img src="https://material.angularjs.org/material2_assets/cards/sections-card-min.png"> |
| 53 | + |
| 54 | +### Preset layouts |
| 55 | + |
| 56 | +You can also leverage preset layouts that format some of the sections together. |
| 57 | + |
| 58 | +#### `<md-card-header>` |
| 59 | + |
| 60 | +Formats the following sections into a header: |
| 61 | + |
| 62 | + * `<md-card-title>`: title to format within header |
| 63 | + * `<md-card-subtitle>`: subtitle to format within header |
| 64 | + * `<img md-card-avatar>`: image to use for avatar |
| 65 | + |
| 66 | +Example markup for a card with a header: |
| 67 | + |
| 68 | +```html |
| 69 | +<md-card> |
| 70 | + <md-card-header> |
| 71 | + <img md-card-avatar src="path/to/img.png"> |
| 72 | + <md-card-title>Header title</md-card-title> |
| 73 | + <md-card-subtitle>Header subtitle</md-card-subtitle> |
| 74 | + </md-card-header> |
| 75 | + <img md-card-image src="path/to/img.png"> |
| 76 | + <md-card-content> |
| 77 | + <p>Here is some more content</p> |
| 78 | + </md-card-content> |
| 79 | +</md-card> |
| 80 | +``` |
| 81 | + |
| 82 | +Output: |
| 83 | + |
| 84 | +<img src="https://material.angularjs.org/material2_assets/cards/header-card-min.png"> |
| 85 | + |
| 86 | +#### `<md-card-title-group>` |
| 87 | + |
| 88 | +Groups the following sections together: |
| 89 | + |
| 90 | + * `<md-card-title>`: title to format within group |
| 91 | + * `<md-card-subtitle>`: subtitle to format within group |
| 92 | + * One of the following image sizes: |
| 93 | + * `<img md-card-sm-image>` |
| 94 | + * `<img md-card-md-image>` |
| 95 | + * `<img md-card-lg-image>` |
| 96 | + |
| 97 | +Example markup for a card with title-group layout: |
| 98 | + |
| 99 | +```html |
| 100 | +<md-card> |
| 101 | + <md-card-title-group> |
| 102 | + <img md-card-sm-image src="path/to/img.png"> |
| 103 | + <md-card-title>Card with title</md-card-title> |
| 104 | + <md-card-subtitle>Subtitle</md-card-subtitle> |
| 105 | + </md-card-title-group> |
| 106 | +</md-card> |
| 107 | +``` |
| 108 | + |
| 109 | +Output: |
| 110 | + |
| 111 | +<img src="https://material.angularjs.org/material2_assets/cards/title-group-card-min.png"> |
0 commit comments