Current version 22.11.0

Card Beta

import { Tg2CardComponent, Tg2CardRadiusEnum, Tg2CardBackgroundEnum } from '@trademe/tangram';

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 attribute on a link, a button, or a <div> you have already made interactive yourself, and use the <tg2-card> element for everything else — links and buttons inside a card don't change that.

Radius

radius accepts small (4px), medium (8px, default), large (16px) and extra-large (20px). Under tg-light / tg-dark the same four members resolve to the legacy card's radii instead — see Themes. The card clips its content to this radius by default — see Migrating from tgCard for the rare case where a popover needs to escape it.

Small

Content

Medium Default

Content

Large

Content

Extra large

Content

Background

background accepts white (default) and grey.

White Default

Content

Grey

Content

Photos

Put a real <img> inside the card. The card's corner radius clips it. Don't use a CSS background-image, including tg-aspect-ratio: an <img> gets srcset, the preload path and a real alt.

<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

bordered adds a 1px border. It defaults to false.

Unbordered Default

Content

Bordered

Content

Interactive

A card hosted on an <a> or <button> is interactive automatically, because the component reads the host's tag name. A <div> cannot be detected that way, so if you have given one role, tabindex and keyboard handlers of its own, add interactive to apply the same hover and press states — see the <div> example below. Reach for a real <button> or <a> first: it gives you focus, keyboard activation and semantics without writing any of that.

Button host

Interactive on a <div>

Hover, click or press Enter

API

Selector: tg2-card, [tg2Card]. Import Tg2CardComponent from @trademe/tangram. Experimental: the API can change in a minor release.

Tg2CardComponent inputs
InputValuesDefaultConstraints
radiussmall | medium | large | extra-large —
backgroundwhite | greywhite
borderedbooleanfalse
interactivebooleanfalse
themetg2-light | tg2-dark | tg-light | tg-darktg2-light

Content slots: default content.

Proudly made by © 2026 Trade Me Limited