Pricing Dock

Sticky Pricing Table for React

Plan cards that fold into the comparison table's sticky header as you scroll. Each card folds straight down into its own column: the price shrinks in beside the name, the button narrows, the badge flattens into an accent line, and the cards close into one bar. Click a docked name to see its whole card again.

  • Pricing
  • Scroll
  • Table

Uses motion, clsx, tailwind-merge

Open in ChatGPTOpen in Claude
radius20px
gap12px
peekDuration0.42s
rollDuration0.50s
rollStagger0.035s
<PricingDock />

The demo follows as you drag.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Pricing Dock: Plan cards that fold into the comparison table's sticky header as you scroll. Each card folds straight down into its own column: the price shrinks in beside the name, the button narrows, the badge flattens into an accent line, and the cards close into one bar. Click a docked name to see its whole card again.
This demo, AI API Pricing: An AI API's four plans under a sticky site nav, so the bar docks at `top={56}`. Scroll and each card folds into its column's header. Switch to Yearly from the docked toggle and the docked prices roll; click a docked name to peek at its whole card; hover a column to follow it down.

1. Install it:
   npx shadcn@latest add @keyframeui/pricing-dock-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/pricing-dock-demo.json instead.)
   It adds the demo, components/pricing-dock-demo.tsx, and the component, components/ui/pricing-dock.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <PricingDock> on its own.

3. These props set its feel. Change them before you change the file:
   - radius (default 20): Corner radius of the cards before they dock, in px. The corners square off as the cards close into the bar, and a peeked card gets them back. `0` keeps them square throughout.
   - gap (default 12): Space between the cards before they dock, in px. It closes as they dock, so the bar has none.
   - peekDuration (default 0.42): How long a peeked card takes to unfold over the table when you click its docked name, and to fold back, in seconds.
   - rollDuration (default 0.5): How long each price digit takes to roll to its new value when billing changes, in seconds.
   - rollStagger (default 0.035): Delay between a price's digits as they roll, right to left, in seconds. `0` rolls them together.

4. Don't change, in components/ui/pricing-dock.tsx:
   - The fold follows scroll position, not time: the header is natively sticky, one rect read per scroll frame sets `u` and `t`, and every moving part is a motion value; scrolling re-renders only when `docked` flips.
   - `useLive` reads every dependency before it computes, so motion subscribes to all of them even when a computation returns early.
   - The table never moves: the header sticks at `top` less `--dock-fold`, so the cards' bottom edge is the bar's. A peek unfolds one card in place, at its column's width, over the table.
   - The plan button is one element through the whole fold, resized by motion values, so focus never breaks.
   - Reduced motion skips the staged fold: `t` jumps at the dock point, the table slides over the pinned cards, the heads fade back in on `swap`, and peeks, digits and the phone strip jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/pricing-dock.md

Installation

Add the component on its own with the CLI, or copy the file in by hand.

The CLI writes components/ui/pricing-dock.tsx and installs motion, clsx and tailwind-merge. It needs the @keyframeui registry in components.json; add it once per project.

npx shadcn@latest add @keyframeui/pricing-dock

Examples

Finished sections built with Pricing Dock. Each one installs whole, with the component included.

Studio Packages

A design studio's three ways to work together, set in an editorial serif with tighter corners (`radius={6}`), a wider `gap` and warm `--dock-border` lines. `formatPrice` writes prices in thousands, the Sprint sets its own `/sprint` period, and Quarterly billing rolls the retainers down.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Pricing Dock: Plan cards that fold into the comparison table's sticky header as you scroll. Each card folds straight down into its own column: the price shrinks in beside the name, the button narrows, the badge flattens into an accent line, and the cards close into one bar. Click a docked name to see its whole card again.
This demo, Studio Packages: A design studio's three ways to work together, set in an editorial serif with tighter corners (`radius={6}`), a wider `gap` and warm `--dock-border` lines. `formatPrice` writes prices in thousands, the Sprint sets its own `/sprint` period, and Quarterly billing rolls the retainers down.

1. Install it:
   npx shadcn@latest add @keyframeui/pricing-dock-studio-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/pricing-dock-studio-demo.json instead.)
   It adds the demo, components/pricing-dock-studio-demo.tsx, and the component, components/ui/pricing-dock.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <PricingDock> on its own.

3. These props set its feel. Change them before you change the file:
   - radius (default 20): Corner radius of the cards before they dock, in px. The corners square off as the cards close into the bar, and a peeked card gets them back. `0` keeps them square throughout.
   - gap (default 12): Space between the cards before they dock, in px. It closes as they dock, so the bar has none.
   - peekDuration (default 0.42): How long a peeked card takes to unfold over the table when you click its docked name, and to fold back, in seconds.
   - rollDuration (default 0.5): How long each price digit takes to roll to its new value when billing changes, in seconds.
   - rollStagger (default 0.035): Delay between a price's digits as they roll, right to left, in seconds. `0` rolls them together.

4. Don't change, in components/ui/pricing-dock.tsx:
   - The fold follows scroll position, not time: the header is natively sticky, one rect read per scroll frame sets `u` and `t`, and every moving part is a motion value; scrolling re-renders only when `docked` flips.
   - `useLive` reads every dependency before it computes, so motion subscribes to all of them even when a computation returns early.
   - The table never moves: the header sticks at `top` less `--dock-fold`, so the cards' bottom edge is the bar's. A peek unfolds one card in place, at its column's width, over the table.
   - The plan button is one element through the whole fold, resized by motion values, so focus never breaks.
   - Reduced motion skips the staged fold: `t` jumps at the dock point, the table slides over the pinned cards, the heads fade back in on `swap`, and peeks, digits and the phone strip jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/pricing-dock.md

Why Switch

Us against the two tools teams switch from, with logo cards instead of prices: each mark shrinks in beside its name as the cards dock. On a phone, the plan pills pick whose column the table shows, or swipe the table sideways.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Pricing Dock: Plan cards that fold into the comparison table's sticky header as you scroll. Each card folds straight down into its own column: the price shrinks in beside the name, the button narrows, the badge flattens into an accent line, and the cards close into one bar. Click a docked name to see its whole card again.
This demo, Why Switch: Us against the two tools teams switch from, with logo cards instead of prices: each mark shrinks in beside its name as the cards dock. On a phone, the plan pills pick whose column the table shows, or swipe the table sideways.

1. Install it:
   npx shadcn@latest add @keyframeui/pricing-dock-compare-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/pricing-dock-compare-demo.json instead.)
   It adds the demo, components/pricing-dock-compare-demo.tsx, and the component, components/ui/pricing-dock.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <PricingDock> on its own.

3. These props set its feel. Change them before you change the file:
   - radius (default 20): Corner radius of the cards before they dock, in px. The corners square off as the cards close into the bar, and a peeked card gets them back. `0` keeps them square throughout.
   - gap (default 12): Space between the cards before they dock, in px. It closes as they dock, so the bar has none.
   - peekDuration (default 0.42): How long a peeked card takes to unfold over the table when you click its docked name, and to fold back, in seconds.
   - rollDuration (default 0.5): How long each price digit takes to roll to its new value when billing changes, in seconds.
   - rollStagger (default 0.035): Delay between a price's digits as they roll, right to left, in seconds. `0` rolls them together.

4. Don't change, in components/ui/pricing-dock.tsx:
   - The fold follows scroll position, not time: the header is natively sticky, one rect read per scroll frame sets `u` and `t`, and every moving part is a motion value; scrolling re-renders only when `docked` flips.
   - `useLive` reads every dependency before it computes, so motion subscribes to all of them even when a computation returns early.
   - The table never moves: the header sticks at `top` less `--dock-fold`, so the cards' bottom edge is the bar's. A peek unfolds one card in place, at its column's width, over the table.
   - The plan button is one element through the whole fold, resized by motion values, so focus never breaks.
   - Reduced motion skips the staged fold: `t` jumps at the dock point, the table slides over the pinned cards, the heads fade back in on `swap`, and peeks, digits and the phone strip jump.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/pricing-dock.md

Props

plans Required

TypePricingDockPlan[]

One card and one table column per plan, left to right. Three or four fit best; the cards sit over their columns from a 48rem-wide container, and narrower ones get the phone layout.

groups Required

TypePricingDockGroup[]

The comparison table: { label, rows } per section. Each label sticks under the docked bar until the next one pushes it out.

billing

TypePricingDockBilling[]

Options for the billing toggle, as { id, label, note?, period? }, e.g. { id: "yearly", label: "Yearly", note: "−20%" }. The toggle sits in the top-left cell and shrinks into the docked bar, where it still works. Leave it out for one price per plan.

defaultBilling

Typestring

The billing option selected at first. Defaults to the first one.

onBillingChange

Type(id: string) => void

Called with the option's id when the visitor switches billing.

formatPrice

Type(amount: number, plan: PricingDockPlan, billing?: string) => stringDefaultwhole US dollars

Turns a number price into text, e.g. (n) => "€" + n or (n) => "$" + n + "k". Digits roll on their own wheels when billing changes.

period

TypestringDefault"/mo"

Shown after every number price. A billing option's period, then a plan's, override it. Text prices like "Custom" show none.

intro

TypeReact.ReactNode

A line in the top-left cell, under the toggle. It slides away with the page as the cards dock.

compareLabel

Typestring | nullDefault"Compare all features"

Label of the link at the bottom of the top-left cell, which scrolls to exactly where the cards have docked. null hides it.

featureLabel

TypestringDefault"Feature"

Screen-reader header of the feature column.

top

TypenumberDefault0

Where the docked bar pins, in px from the top of the scrollport: your fixed nav's height, or 0. The cards' top edges slide under whatever covers the space above it.

containerRef

TypeReact.RefObject<HTMLElement | null>

The scroll container, when the table scrolls inside an overflow-y-auto box. Leave it out for the window.

radius

TypenumberDefault20

Corner radius of the cards before they dock, in px. The corners square off as the cards close into the bar, and a peeked card gets them back. 0 keeps them square throughout.

gap

TypenumberDefault12

Space between the cards before they dock, in px. It closes as they dock, so the bar has none.

peekDuration

TypenumberDefault0.42

How long a peeked card takes to unfold over the table when you click its docked name, and to fold back, in seconds.

rollDuration

TypenumberDefault0.5

How long each price digit takes to roll to its new value when billing changes, in seconds.

rollStagger

TypenumberDefault0.035

Delay between a price's digits as they roll, right to left, in seconds. 0 rolls them together.

className

Typestring

Classes for the table. Theme it with CSS variables: --dock-accent (featured card, badge and check marks), --dock-accent-foreground (text on it), --dock-surface (cards and the docked bar), --dock-page (the page behind, used by the group labels) and --dock-border (card outlines, the bar's dividers and the table's lines). They default to your foreground and background colors, e.g. [--dock-border:var(--color-stone-200)].

plan.id Required

Typestring

PricingDockPlan: keys this plan's column in each row's values.

plan.name Required

Typestring

PricingDockPlan: the plan's name, also its column header for screen readers.

plan.price

Typenumber | string | Record<string, number | string>

PricingDockPlan: a number goes through formatPrice; text ("Custom") shows as is. One per billing option: { monthly: 24, yearly: 19 }.

plan.period

Typestring

PricingDockPlan: overrides the period after this plan's price, e.g. "/seat/mo".

plan.caption

TypeReact.ReactNode | Record<string, React.ReactNode>

PricingDockPlan: small print under the price, one for all billing options or one per option.

plan.logo

TypeReact.ReactNode

PricingDockPlan: shown instead of a price, e.g. a product's mark on a comparison page. It shrinks in before the name when docked.

plan.pitch

TypeReact.ReactNode

PricingDockPlan: one line under the price. Two lines at most.

plan.highlights

TypeReact.ReactNode[]

PricingDockPlan: three to five points under the button. They slide under it and fade as the card docks.

plan.featured

Typeboolean

PricingDockPlan: tints the card and runs the tint down its whole column.

plan.badge

TypeReact.ReactNode

PricingDockPlan: a label over the name, e.g. "Most popular". Flattens into a 2px accent line along the top of the docked cell.

plan.cta

Type{ label: string; href?: string; onClick?: () => void }

PricingDockPlan: the plan's button, a link with href or a button with onClick. It is the same element docked and undocked, so focus and tab order never jump.

row.feature Required

TypeReact.ReactNode

PricingDockRow: the feature's name, the row's header.

row.hint

TypeReact.ReactNode

PricingDockRow: explanation shown from a small info icon beside the feature.

row.values Required

TypeRecord<string, boolean | React.ReactNode>

PricingDockRow: one value per plan id. true draws a check mark, false (or a missing value) a dash; text and elements render as they are.