Card Beta
A surface that groups related content, with a background, a corner radius and an optional border. The card projects your content with no wrapper, no padding and no slots, so the layout inside is yours.
It comes in two forms, and the host element decides which one applies: put the tg2Card<div><tg2-card>
Radius
radiussmallmediumlargeextra-largetg-lighttg-dark
Small
Medium Default
Large
Extra large
Background
backgroundwhitegrey
White Default
Grey
Photos
Put a real <img>background-imagetg-aspect-ratio<img>srcsetalt
<a tg2Card radius="medium" [routerLink]="listing.url">
<img class="listing-card__photo" [src]="listing.photoUrl" alt="" />
<div class="listing-card__body">{{ listing.title }}</div>
</a>
.listing-card__photo {
display: block;
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
}Bordered
borderedfalse
Unbordered Default
Bordered
Interactive
A card hosted on an <a><button><div>roletabindexinteractive<div><button><a>
API
Selector: tg2-card, [tg2Card]Tg2CardComponent@trademe/tangram
| Input | Values | Default | Constraints |
|---|---|---|---|
radius | smallmediumlargeextra-large | — | |
background | whitegrey | white | |
bordered | boolean | false | |
interactive | boolean | false | |
theme | tg2-lighttg2-darktg-lighttg-dark | tg2-light |
Content slots: default content.