An `<sp-card>` represents a rectangular card that contains a variety of text and image layouts. Cards are typically used to encapsulate units of a data set, such as a gallery of image/caption pairs.
npm install @spectrum-web-components/cardAn represents a rectangular card that contains
a variety of text and image layouts. Cards are typically used
to encapsulate units of a data set, such as a gallery of
image/caption pairs.



```
yarn add @spectrum-web-components/card
Import the side effectful registration of via:
``
import '@spectrum-web-components/card/sp-card.js';
When looking to leverage the Card base class as a type and/or for extension purposes, do so via:
``
import { Card } from '@spectrum-web-components/card';
Normal cards can contain a heading, a subheading, a cover photo, and a footer.
`html demo`
JPG photo
Footer
#### Heading
By default, the heading for an is applied via the heading attribute, which is restricted to string content only. For HTML content, use the heading slot instead.
`html demo`
subheading="JPG Photo"
style="--spectrum-card-body-header-height: auto;"
>
Footer
`html demo`
style="--spectrum-card-body-header-height: auto;"
>
Card Heading
Footer
#### Linking
An can be provided with an href attribute in order for it to act as one large anchor element. When leveraging the href attribute, the download, target and rel attributes customize the card's linking behavior. Use them as follows:
`html demo`
subheading="JPG"
href="https://opensource.adobe.com/spectrum-web-components"
target="_blank"
>
slot="cover-photo"
src="https://picsum.photos/200/300"
alt="Demo Image"
/>
#### Cover Photo
Use slot="cover-photo" on an image to set it as the card's cover photo.
`html demo`
slot="cover-photo"
src="https://picsum.photos/200/300"
alt="Demo Image"
/>
Footer
#### Preview Image
Use slot="preview" on an image to set it as the card's preview image.
`html demo`
Footer
#### No Preview Image
Cards with no preview image can contain a heading, a subheading, and a footer.
`html demo`
Footer
#### Actions
Cards can be supplied an actions via a names slot.
`html`
slot="cover-photo"
src="https://picsum.photos/200/300"
alt="Demo Image"
/>
Footer
slot="actions"
placement="bottom-end"
quiet
>
#### Horizontal
Cards with a horizontal attribute can contain a heading, a subheading, a cover photo, and a description.
`html`
10/15/18
#### Variant
There are multiple card variants to choose from in Spectrum. The variant
attribute controls the main variant of the card.
Cards with variant="quiet" can contain a heading, a subheading, a cover photo, a description, and a footer. Quiet cards will also accept actions via a named slot.
`html`
10/15/18
slot="actions"
placement="bottom-end"
quiet
>
Cards with variant="gallery" can contain a heading, a subheading, an image preview, a description, and a footer.
`html`
10/15/18
Footer
#### Asset
When leveraging the asset attribute, a card can be declared as representing a file or a folder:
`html`
File Name
10/15/18
Footer
Folder Name
10/15/18
Footer
#### Toggles
When the toggles boolean attribute set to true, the card can be toggled between selected and unselected states.
A checkbox will be rendered on hover, focus within, and when the card is selected.
`html`
10/15/18
#### Be concise
Heading text should be no more than 5-7 words. If the card has an href`, the heading is used as a link and should ideally be no more than 3 words. For buttons, 1-2 words.
#### Use descriptive heading, link, and button text
Be descriptive. Set expectations on what someone will find and where they will go once they interact with a card. Avoid using the same text on more than one interactive element, unless both elements go to the same place.
#### Make the first word in a heading meaningful
Consider making the first word of links, buttons and headings something an assistive technology user might search for when headings and links are listed alphabetically.