Migrating from tgCard
Replace the tgCard<tg-card>Tg2CardComponentTgCardComponent<tg2-card><a><button>tg2Card
<!-- Before — a static container, either form -->
<tg-card>Content</tg-card>
<div tgCard>Content</div>
<!-- After -->
<tg2-card>Content</tg2-card>
<!-- Before — the card wrapped in a link -->
<a href="/listing/123">
<tg-card>Content</tg-card>
</a>
<!-- After — the link is the card -->
<a tg2Card href="/listing/123">Content</a>Host class
The host class is now o-card-tg2o-card.o-card.o-card-tg2
// Before
.o-card { ... }
// After
.o-card-tg2 { ... }The same rename applies inside a nested scope, or alongside a co-located BEM class:
// Before — nested, scope already provided by the host selector
tm-offers-card:host {
tg-card { ... }
}
// After
tm-offers-card:host {
.o-card-tg2 { ... }
}// Before — co-located class, element token dropped
tg-card.tm-watchlist-collection-summary { ... }
// After
.tm-watchlist-collection-summary { ... }Background
The card's surface is now a token, --tg-card-bg--tg-card-bggreybackground
// Before — background supplied by the page behind a white card
.tm-my-card {
background-color: $tg-ui-grey-extra-light;
}
// After — background is a token on the card itself
<tg2-card
class="tm-my-card"
style="--tg-card-bg: var(--tg-color-bluff-oyster-10)">
Content
</tg2-card>
// Or, for the shipped grey surface, skip the override entirely:
<tg2-card background="grey">Content</tg2-card>Radius
Under tg-lighttg-darkradiusborder-radiuslarge
// Before — radius overridden in consumer SCSS
.o-card {
border-radius: $tg-border-radius-medium; // 6px
}
// After — under tg-light / tg-dark the input carries the same value
<tg2-card theme="tg-light" radius="medium">Content</tg2-card>
// tg-light / tg-dark: small = 0, medium = 6px, large = 8px (default), extra-large = 16pxClipping
tg2Cardoverflow: hidden<a><button>overflow: visible
// The card always clips to its radius with overflow: hidden. A popover or
// tooltip that needs to escape the card must opt the card itself out:
<tg2-card class="tm-my-card-with-popover">...</tg2-card>
.tm-my-card-with-popover {
overflow: visible;
}