3.0.0 • Published 3 years ago

@arterial/card v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Arterial Card

Another React Material Card

Installation

npm install @arterial/card

Usage

Styles

Sass

@use '@material/card/index.scss' as card;
@include card.core-styles;

CSS

import '@material/card/dist/mdc.card.css';

JSX

import { Card, CardPrimaryAction, CardActions, ... } from '@arterial/card';

Elevated Card

A shadow helps indicate a card.

<Card>
  <div className="primary-title">
    <div className="title">Card title</div>
    <div className="subtitle">Secondary text</div>
  </div>
</Card>

Outlined Card

An outline helps indicate a card.

<Card outlined>
  <div className="primary-title">
    <div className="title">Card title</div>
    <div className="subtitle">Secondary text</div>
  </div>
</Card>

Other Variants

Primary Action

The primary action area of a card is typically the card itself. Often cards are one large touch target to a detail screen on a subject.

<Card>
  <CardPrimaryAction>
    <div className="primary-title">
      <div className="title">Card title</div>
      <div className="subtitle">Secondary text</div>
    </div>
  </CardPrimaryAction>
</Card>

Supplemental Actions

Supplemental actions are represented by icons, text, and UI controls on cards. They are typically placed at the bottom of the card.

<Card>
  <CardPrimaryAction>
    <div className="primary-title">
      <div className="title">Card title</div>
      <div className="subtitle">Secondary text</div>
    </div>
  </CardPrimaryAction>
  <CardActions>
    <CardActionButtons>
      <CardActionButton label="Action 1" />
      <CardActionButton label="Action 2" />
    </CardActionButtons>
    <CardActionIcons>
      <CardActionIcon icon="favorite" />
      <CardActionIcon icon="share" />
    </CardActionIcons>
  </CardActions>
</Card>

Rich Media

This area is used for showing rich media in cards, and optionally as a container.

<Card>
  <CardPrimaryAction>
    <CardMedia className="rich-media" sixteenByNine />
    <div className="primary-title">
      <div className="title">Card title</div>
      <div className="subtitle">Secondary text</div>
    </div>
  </CardPrimaryAction>
  <CardActions>
    <CardActionButtons>
      <CardActionButton label="Action 1" />
      <CardActionButton label="Action 2" />
    </CardActionButtons>
    <CardActionIcons>
      <CardActionIcon icon="favorite" />
      <CardActionIcon icon="share" />
    </CardActionIcons>
  </CardActions>
</Card>

Rich Media Content

<Card>
  <CardPrimaryAction>
    <CardMedia className="rich-media" sixteenByNine>
      <CardMediaContent className="rich-media__content">
        <div className="primary-title">
          <div className="title">Card title</div>
          <div className="subtitle">Secondary text</div>
        </div>
      </CardMediaContent>
    </CardMedia>
  </CardPrimaryAction>
  <CardActions>
    <CardActionButtons>
      <CardActionButton label="Action 1" />
      <CardActionButton label="Action 2" />
    </CardActionButtons>
    <CardActionIcons>
      <CardActionIcon icon="favorite" />
      <CardActionIcon icon="share" />
    </CardActionIcons>
  </CardActions>
</Card>

Header

<Card>
  <CardPrimaryAction>
    <CardMedia className="rich-media" sixteenByNine />
    <div className="header">
      <div className="thumbnail" />
      <div className="primary-title">
        <div className="title">Card title</div>
        <div className="subtitle">Secondary text</div>
      </div>
    </div>
  </CardPrimaryAction>
  <CardActions>
    <CardActionButtons>
      <CardActionButton label="Action 1" />
      <CardActionButton label="Action 2" />
    </CardActionButtons>
    <CardActionIcons>
      <CardActionIcon icon="favorite" />
      <CardActionIcon icon="share" />
    </CardActionIcons>
  </CardActions>
</Card>

Supporting Text

<Card>
  <CardPrimaryAction>
    <CardMedia className="rich-media" sixteenByNine />
    <div className="primary-title">
      <div className="title">Card title</div>
      <div className="subtitle">Secondary text</div>
    </div>
    <div className="supporting-text">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    </div>
  </CardPrimaryAction>
  <CardActions>
    <CardActionButtons>
      <CardActionButton label="Action 1" />
      <CardActionButton label="Action 2" />
    </CardActionButtons>
    <CardActionIcons>
      <CardActionIcon icon="favorite" />
      <CardActionIcon icon="share" />
    </CardActionIcons>
  </CardActions>
</Card>

Props

Card

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
outlinedbooleanEnables an outlined variant.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardPrimaryAction

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardMedia

NameTypeDescription
backgroundImagestringPath to the image of the root element.
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
sixteenByNinebooleanScales the height of the image maintaining a 16:9 aspect ratio.
squarebooleanScales the height of the image to be equal to the width of the image.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardMediaContent

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardActions

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
fullBleedbooleanEnables full bleed card actions row by removing all padding.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardActionButtons

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardActionButton

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardActionIcons

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.

CardActionIcon

NameTypeDescription
childrennodeElements to be displayed within root element.
classNamestringClasses to be applied to the root element.
tagstring | objectHTML tag to be applied to the root element. Defaults to div.
3.0.0

3 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.1

4 years ago

1.0.0-alpha.0

4 years ago