Tally UI

CartPanel

CartPanel renders cart items in a scrollable list with a render function, optional header and footer slots, and an empty state.

Import

import { CartPanel } from '@tallyui/components';

Usage

<CartPanel
  items={cartItems}
  renderItem={(item) => <CartLine item={item} />}
  header={<CustomerCard doc={customer} />}
  footer={<CartTotal items={cartItems} />}
/>

A scrollable cart panel that composes line items into a list with optional header and footer slots. The header typically holds customer info, and the footer holds totals or a checkout button.

Props

PropTypeDefaultDescription
itemsCartLineItem[]requiredCart line items to render
renderItem(item, index) => ReactNoderequiredRender function for each line
keyExtractor(item, index) => stringitem id, else indexRow key per item; override for items without an id, or to key by something else
headerReactNode—Header slot (e.g. customer info)
afterItemsReactNode—Content after the lines, inside the scrolling region (e.g. discount chips); shown even with no lines
footerReactNode—Footer slot (e.g. totals, checkout button)
footerClassNamestring—Classes for the footer's wrapper (default border-t border-border px-3 py-2)
emptyStateReactNode—Content shown when items is empty
pulseKey(item) => string | number—A value per row whose change pulses it (e.g. the quantity); with it, rows pulse when added and tint and collapse when removed, as in WCPOS v2; without it nothing animates
identitystring—What the rows belong to (e.g. the order id): a change rebaselines without a pulse
classNamestring—Override container styles

CartLineItem

interface CartLineItem {
  doc: any;       // RxDB product document
  quantity: number;
}

Live demo