Skip to content
Docs
Reference

<tl-cart-badge>

A cart icon carrying the number of items in the cart, kept current from the cart bus.

HTML tag<tl-cart-badge>
Reactimport { TlCartBadge } from '@ticketlayer/elements-react'
CategoryCart
Runs inweb (browser DOM)

A cart icon carrying the number of items in the cart, kept current from the cart bus.

Properties#

PropertyAttributeDescriptionTypeDefault
badgeOnlybadge-onlyBadge only mode - only shows the count bubble, no icon or buttonbooleanfalse
iconiconCustom icon (emoji or text). If not provided, uses cart SVGstring | undefinedundefined
showEmptyshow-emptyShow the badge even when count is 0booleanfalse
sizesizeSize variant"lg" | "md" | "sm"'md'
unstyledunstyledRender into the light DOM with no stylesheet, for a page that styles the element itself: every node carries a tl-cart-badge__* class. Without it the element is styled, and each node is a ::part() of the same name.booleanfalse

Events#

EventDescriptionType
tlClickEmitted when the badge is clickedCustomEvent<{ itemCount: number; }>

Events are CustomEvents; the payload is on event.detail. In HTML, listen with element.addEventListener('tlXxx', handler); in React the wrapper exposes each one as an onTlXxx prop.