Onboarding tours: one window in the scrim morphs from target to target, the callout rides along and the step ball rolls down its rail.
Click meTap me
Billing · October
| Invoice | Customer | Status | Amount |
|---|---|---|---|
| #2041 | Juniper Labs | Overdue | €1,840 |
| #2042 | Harbor & Pine | Pending | €920 |
| #2043 | Blue Fern Studio | Paid | €2,310 |
| #2044 | Oakline Freight | Pending | €640 |
coach-marks, lively
Onboarding tours and feature announcements inside a product: a scrim with a window over the element being explained, a callout with Next and Back. Tour libraries unmount a step and mount the next; here there is one window and one callout. Press Next: the window leans toward the next target, then flies and resizes to it (its corners interpolating between the two targets' radii), the callout rides along on the same spring and re-anchors to the side with room, the step ball rolls down its rail and squashes on its dot, the counter rolls. Use beacons for feature discovery after a release (a ball on each new thing, opened on demand) and hint for a single announcement. For a passive explanation of one control, use a Tooltip; for a decision, a Dialog.
pnpm dlx shadcn@latest add @motionkit/coach-marksnpx shadcn@latest add @motionkit/coach-marksyarn dlx shadcn@latest add @motionkit/coach-marksbunx --bun shadcn@latest add @motionkit/coach-marksRequires the @motionkit namespace in components.json. See Installation.
import { CoachMarks } from "@/components/ui/coach-marks"
export function InvoicesTour() {
const [open, setOpen] = useState(true)
return (
<CoachMarks
open={open}
onOpenChange={setOpen}
onComplete={() => markTourSeen()}
steps={[
{
id: "search",
target: "#invoice-search",
title: "Search everything",
body: "Find an invoice by number or customer.",
},
{
id: "filters",
target: filtersRef,
title: "Filters",
body: "Narrow the list by status or due date.",
},
{
id: "new",
target: () => document.querySelector("[data-new-invoice]"),
title: "New invoice",
},
]}
/>
)
}A step's target is a CSS selector, a ref or a function; a function may return several elements (a column's header and cells) and the window frames them all. The window takes the target's radius plus 4 px (radius overrides it) and 8 px of padding; side pins the callout (auto picks the first side with room: right, bottom, left, top). step / onStepChange control the step; onComplete fires on Done. By default the layer is fixed over the viewport, in the provider's portalContainer; pass container (a position: relative element) to keep the scrim inside a card or a panel. Under 480 px of layer width the callout becomes a sheet 12 px inside the edges: on the bottom, or on the top when the target sits under it (a target neither band can hold is scrolled to the top first), so it never covers what it points at; a sheet changing edge fades across instead of sweeping over the screen. interactive lets clicks reach the target through the window. preset picks tour, beacons (with onDismiss(id)) or hint; temperament tunes how much it moves, the look never changes.
Prop
Type
Also accepts all props of Omit<
ComponentProps<"div">,
"title" | "children" | MotionOwned
>.
The beacons preset: a 12 px ball on each new thing. Pressing one stretches it, then it grows into its callout while the others step back; Got it dismisses it for good.
Click meTap me
Updated 2 minutes ago
Revenue
€48,210
+8.2% vs last month
coach-marks, lively
The hint preset: one callout anchored to the Export button, a rim around it and no scrim, one Got it button.
Click meTap me
3 saved reports
coach-marks, lively
dialog named by the step's title and described by its body (aria-modal while the screen is blocked and focus moves into it; with moveFocus={false} it is a non-modal dialog). Focus moves to the title when it opens and on every step (moveFocus, default on), Tab cycles inside the callout, and focus returns where it was when the tour closes.aria-hidden; targets keep their own focusability.tour (it is not a dismiss): Skip and Escape close it.ring-[3px] ring-ring/50; primary draws the window rim and the ball, ring only focus.| Key | Action |
|---|---|
| ArrowRight / ArrowLeft | Next / previous step (tour) |
| Enter / Space | Presses the focused button (Next, Back, Done, Got it, a beacon) |
| Tab / Shift + Tab | Cycles through the callout's buttons while the screen is blocked |
| Escape | Closes the tour or the hint; closes an open beacon callout (it stays) |
No flight, nudge or squash. The window and the callout appear at the next target and fade in, the step ball glides in the fade time, the scrim fades in once, beacon callouts crossfade. Depth, rim and focus stay.
Nothing runs at rest. During a step change Motion animates the window's position, size and radius (an absolutely positioned element in its own layer: nothing in your page reflows), the callout's position and the text area's height, then stops. Targets are measured once per step and again only when the layer or the target resizes (ResizeObserver) or something scrolls (one passive listener). The scrim is a single box-shadow, no extra element. Third-party code: motion only.
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Not measured yet · budget 6.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, motion.
click, press, a keyboard shortcut
No flight, nudge or squash: window and callout appear at the next target and fade in, the step ball glides in the fade time, the scrim fades in once, beacon callouts crossfade.
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)