Skip to content

Cart Line Item

DisplayMIT
View in Storybook

Cart row with thumbnail, title, variant, price, quantity stepper, and remove action.

bun add @otfdashkit/ui

Preview

Cart Line Item
Loading Storybook preview…

Code

import { useState } from 'react'
import { CartLineItem } from '@otfdashkit/ui'

const IMG = 'https://images.unsplash.com/photo-1559056199-641a0ac8b55e?q=80&w=200&auto=format&fit=crop'

export function Example() {
  const [qty, setQty] = useState(2)
  return (
    <div className="w-[480px]">
      <CartLineItem
        image={IMG}
        title="Sunrise Blend"
        variant="Whole bean · 250g"
        price={1800}
        quantity={qty}
        onQuantityChange={setQty}
        onRemove={() => {}}
      />
    </div>
  )
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Kit for this component

Marketplace Kit$99

Build a cart or checkout list with a line for each item.

See the kit

Props

Props declared in the CartLineItem source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
pricerequirednumberUnit price in minor units (cents).
quantityrequirednumber
titlerequiredstring
compareAtnumberOptional compare-at unit price in minor units.
currencystring'USD'
imagestringProduct thumbnail URL.
maxQuantitynumber99
minQuantitynumber1
onQuantityChange(qty: number) => void
onRemove() => void
variantstringVariant summary line, e.g. "Whole bean · 250g".