Material Components React Card
npm install @material/react-cardA React version of an MDC Card.
```
npm install @material/react-card
with Sass:
`js`
import '@material/react-card/index.scss';
with CSS:
`js`
import '@material/react-card/dist/card.css';
js
import React from 'react';
import Card, {
CardPrimaryContent,
CardMedia,
CardActions,
CardActionButtons,
CardActionIcons
} from "@material/react-card";const MyApp = () => {
return (
Header
Click Me Too!
);
}
`Components
The following components are MDC Card components. Other components outside of this package also can be used with these components, since there is such a large variety of card types. For further descriptions, please refer to MDC Card.
> NOTE: All following components will still pass through the props
className and style.$3
This is the container component for the entire card. All other components listed in this documentation should be a child to this component.
`js
import Card from '@material/react-card';
Title
Content
`#### Props
Prop Name | Type | Description
--- | --- | ---
outlined | n/a | Enables an outline on the card.
$3
This component is used as the container for primary tappable content.
`js
import Card, {CardPrimaryContent} from '@material/react-card';
Content
`$3
This component is a container for an image on the card. Optionally, any children of the
component is wrapped with an element with the className .mdc-card__media-content. In order for your image to display, CardMedia requires that you have an aspect ratio of either square or wide.`js
import {CardMedia} from '@material/react-card';
Fancy Image
`#### Props
Prop Name | Type | Description
--- | --- | ---
contentClassName | string | Adds a class to the
.mdc-card__media-content element.
square | n/a | Scales the height of the image to be equal to the width of the image.
wide | n/a | Scales the height of the image maintaining a 16:9 aspect ratio.
imageUrl | string | Path to the image of the component.$3
Acts as a container for
and/or . It should be used as the last child of the component.`js
import {CardActions, CardActionButtons, CardActionIcons} from '@material/react-card';
...
...
`#### Props
Prop Name | Type | Description
--- | --- | ---
fullBleed | n/a | Enables full bleed card actions row by removing all padding.
$3
It acts as a container for buttons of the card. This component is a child of a
component.`js
import {CardActionButtons} from '@material/react-card';
`$3
It acts as a container for icons of the card. This component is a child of a
component. It can be used by itself or used as a sibling directly after the component.`js
import {CardActionIcons} from '@material/react-card';
Icon 1
Icon 2
``Sass mixins may be available to customize various aspects of the Components. Please refer to the
MDC Web repository for more information on what mixins are available, and how to use them.
Please see our Best Practices doc when importing or using icon fonts.