Skip to content
Sign upGet access
MicrointeractionsCart flyMenu

Cart fly (Pro)

ProIncluded in $99

The item the agent adds is thrown into the cart, which dips to catch it.

ProThe item the agent adds is thrown into the cart along an arc, shrinking as it goes; the cart dips to catch it and the count and total roll up.

flyToCart throws a copy of the item's picture along an arc into the cart, shrinking and rounding as it goes, and resolves the moment it lands. Bump the count then: the cart dips under the weight and springs back, the badge pops, and the count and total roll to their new values.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/cart-fly

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { CartButton, flyToCart } from "@/components/ui/chatcn/pro/cart-fly"

await flyToCart(thumbRef.current, cartRef.current)
setCount((c) => c + 1)

<CartButton ref={cartRef} count={count} total={total} />

Props

PropTypeNotes
countnumberGoing up plays the catch
totalnumberRolls with the count
currencystringDefault "USD"
flyToCart(source, cart, duration?)Promise<void>Resolves on landing

Accessibility

  • The cart is a button named with the count; the flying copy is hidden.

Motion

  • A 640 ms arc sampled in 18 frames; the catch is a 480 ms squash. Reduced motion: no flight.