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

Free Shipping Progress

ProNew

How far the cart is from a perk, in words and as a bar that fills with a transform and turns green when the threshold is reached.

Installation

pnpm dlx shadcn@latest add @viewport/free-shipping-progress

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
subtotal*number

The cart subtotal.

—
threshold*number

The subtotal at which shipping becomes free.

—
format(amount: number) => string

Formats an amount of money. Defaults to US dollars.

dollars
rewardstring

The perk, in a few words.

"free shipping"
classNamestring—

Accessibility

  • The words carry the amount left and are announced when they change.
  • The bar is decorative; reaching the goal changes the icon as well as the color.
  • Server component with no client JavaScript.
  • Respects prefers-reduced-motion.