Migrating from tgCard
Replace the tgCard<tg-card>tg2CardTg2CardComponentTgCardComponenttg2Card
<!-- Before — element form -->
<tg-card>Content</tg-card>
<!-- Before — attribute form -->
<div tgCard>Content</div>
<!-- After — attribute-only, no element form -->
<div tg2Card>Content</div>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
<div
tg2Card
class="tm-my-card"
style="--tg-card-bg: var(--tg-color-bluff-oyster-10)">
Content
</div>
// Or, for the shipped grey surface, skip the override entirely:
<div
tg2Card
background="grey">
Content
</div>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
<div tg2Card theme="tg-light" radius="medium">Content</div>
// tg-light / tg-dark: small = 0, medium = 6px, large = 8px (default), extra-large = 16pxClipping
tg2Cardoverflow: hidden<a><button>overflow: visible
// tg2Card always clips to its radius with overflow: hidden. A popover or
// tooltip that needs to escape the card must opt the card itself out:
<div tg2Card class="tm-my-card-with-popover">...</div>
.tm-my-card-with-popover {
overflow: visible;
}