Free Shipping Progress
ProNewHow 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
| Prop | Type | Default |
|---|---|---|
| subtotal* | numberThe cart subtotal. | — |
| threshold* | numberThe subtotal at which shipping becomes free. | — |
| format | (amount: number) => stringFormats an amount of money. Defaults to US dollars. | dollars |
| reward | stringThe perk, in a few words. | "free shipping" |
| className | string | — |
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.