Skip to main content

<tl-cart>

HTML tag<tl-cart>
Reactimport { TlCart } from '@ticketlayer/elements-react'
CategoryCart
Runs inweb (browser DOM), native (planned React Native set)

Properties

PropertyAttributeDescriptionTypeDefault
checkoutLabelcheckout-labelCheckout button labelstring'Checkout'
compactcompactCompact mode - hides some detailsbooleanfalse
showCheckoutButtonshow-checkout-buttonShow checkout buttonbooleantrue
showRemoveButtonsshow-remove-buttonsShow remove item buttonsbooleantrue

Events

EventDescriptionType
tlCartUpdatedEmitted when cart is updatedCustomEvent<{ cart: TlCartData; }>
tlCheckoutEmitted when checkout is clickedCustomEvent<{ cart: TlCartData; }>
tlErrorEmitted on errorCustomEvent<{ message: string; }>
tlItemRemovedEmitted when item is removedCustomEvent<{ itemId: string; }>

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.

Used by: <tl-cart-drawer>