ReferenceComponents

cart

A basket the user changes in place: a stepper on each line, a subtotal that follows.

A basket that can be changed without typing. cart draws each line with its picture, its price and a stepper, and totals the lines itself as the quantities change.

Your cartAero Glide 2Size 43 · Volt$129−1+Running socks3 pairs · M$36−2+Subtotal$165Review order · $165

Drawn live in your browser with the SDK’s own sizes and colours, not a screenshot.

Rendered natively by the Flutter SDK since 0.101.0 and the web SDK since 0.76.0. A build that does not declare it is never offered it.

The card buys nothing. Its button sends the quantities back as a form submission: form_id is this cart_id, and values holds one entry for each line, its id and its quantity. What happens next is your own action, behind its confirm_card.

Prices are numbers (unit_price) with one currency code for the cart, and each device writes the amounts in its own language. The card shows a subtotal only: delivery, tax and discounts are yours to work out, and note is the line that says so.

When not to use it

A basket or an order that is only read is a receipt. One number to ask for is a form field of kind stepper.

Props

Every block also carries type and a required fallback_text of 1 to 300 characters.

PropTypeRequiredConstraints
cart_idstringYes1 to 64 characters.
titlestringNoUp to 80 characters.
linesarrayYes1 to 12 entries.
lines[].idstringYes1 to 64 characters.
lines[].titlestringYes1 to 80 characters.
lines[].detailstringNoUp to 80 characters.
lines[].image_urlstringNoNone
lines[].unit_pricenumberYes0 to 1,000,000,000.
lines[].quantityintegerYes0 to 99.
lines[].maxintegerNo1 to 99.
currencystringYesMatches ^[A-Z]{3}$.
notestringNoUp to 120 characters.
submit_labelstringYes1 to 30 characters.

On the wire

{
  "id": "blk_93",
  "type": "cart",
  "fallback_text": "Your cart: Aero Glide 2 and two packs of running socks, $165 before delivery.",
  "props": {
    "cart_id": "cart",
    "title": "Your cart",
    "lines": [
      { "id": "aero-glide-2-43", "title": "Aero Glide 2", "detail": "Size 43 · Volt", "unit_price": 129, "quantity": 1 },
      { "id": "socks-3-m", "title": "Running socks", "detail": "3 pairs · M", "unit_price": 18, "quantity": 2, "max": 6 }
    ],
    "currency": "USD",
    "note": "Delivery is free over $80.",
    "submit_label": "Review order"
  }
}

Interaction

Each stepper moves its line between 0 and max (99 when absent). A line at 0 stays on the card, struck through, until the button is pressed, so a slip is one tap to undo. The button carries the subtotal beside submit_label; once pressed, the card locks. If the answer does not arrive, the card says so and the button can be pressed again.