Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Cart Line Item

ProNew

One product in a cart: picture, name, options, a stepper, a compare-at price and a low-stock notice, in a row that never reflows as amounts change.

Installation

pnpm dlx shadcn@latest add @viewport/cart-line-item

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
title*string

The product's name.

—
hrefstring

Makes the name a link to the product.

—
detailsstring

The chosen options, e.g. "Oat · Regular".

—
media*React.ReactNode

The picture: an `img`, or any element that fills the square.

—
price*string

The line total, formatted.

—
compareAtstring

The price before a discount, formatted. Shown struck through and read as "was".

—
quantity*number—
onQuantityChange*(quantity: number) => void—
onRemove*() => void—
maxnumber

The most that can be bought, e.g. the stock left.

—
noticestring

A short notice under the details, e.g. "Only 2 left".

—
classNamestring—

Accessibility

  • The name is a heading and can be a link.
  • A struck-through price is read as “Was”.
  • Remove is named after the product.
  • Respects prefers-reduced-motion.