Direction:
Card
A structural component used to group information and actions related to a single topic.
Demos
Default
Card title Description Supporting text
With link
Adding the url
prop will make the root element of the Card an anchor element.
Media
A Card can have either an icon or a thumbnail. Card text will be aligned to the top of the media, unless there is only a title, which will be aligned to the center of the media.
With icon
Card title Description
With thumbnail
Card title Description
Title only
Card title
Card groups
Cards will often be displayed in groups. There are two considerations for Card groups:
- Layout: Layout styles for groups of Cards, e.g. margins or grid layout, must be added by the application. The example below adds some simple layout styles to a group of Cards.
- Media consistency: As shown above, adding a
thumbnail
prop will display the thumbnail. For groups of Cards, you may want to display a thumbnail for each Card if available, and otherwise display a placeholder. To enable this behavior, add theforceThumbnail
prop, as demonstrated below. The third item has no thumbnail and display a placeholder icon instead.
Nearby Pages
Golden Gate National Recreation AreaU.S. National Recreation Area surrounding San Francisco Bay Area Distance: 170mInternet ArchiveAmerican non-profit organization providing archives of digital media since 1996 Distance: 300mGreen Apple Books & MusicBookstore in San Francisco Distance: 350mMaximum example
Card titles should be fairly short, but will wrap onto a new line if the text becomes long enough Description text will commonly be longer than a single line, and will wrap onto new lines, expanding the height of the Card to accommodate the content. Supporting text should also be kept short, but if it is long, it will wrap onto a new line like the rest of the Card content.
Usage
Props
Prop name | Description | Type | Default |
---|---|---|---|
url | If provided, the Card will be a link to this URL. | string | '' |
icon | Icon displayed at the start of the Card. | Icon | '' |
thumbnail | Thumbnail image data for the Card. | Thumbnail|null | null |
forceThumbnail | Option to force a thumbnail layout. When set to true , the Card will display a Thumbnail. If a thumbnail prop was also provided, the thumbnail image will display. Otherwise, a placeholder icon will display.This is useful when displaying groups of Cards when some of the cards have thumbnail images but some do not. forceThumbnail will provide a consistent layout for that group.Note that this prop is not needed to display a thumbnail image: if the thumbnail prop is provided, it will display. This prop is only needed to enable the display of the thumbnail placeholder icon when the thumbnail prop is not provided. | boolean | false |
customPlaceholderIcon | Optional custom icon for the placeholder shown when forceThumbnail is true but no thumbnail is provided.Defaults to the default placeholder icon set in the Thumbnail component. | Icon | undefined |
Slots
Name | Description | Bindings |
---|---|---|
title | Card title | |
description | Card description | |
supporting-text | Short supporting text |