Spotlight Tour

Product Tour Overlay for React

A guided tour that dims the page and cuts a hole around one element at a time. The hole glides to each next element and takes its shape, with the explanation card riding along beside it.

  • Onboarding
  • Overlay
  • Motion

Uses motion, clsx, tailwind-merge

Open in ChatGPTOpen in Claude
padding8px
duration0.50s
bounce0.14
<SpotlightTour />

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.

Spotlight Tour: A guided tour that dims the page and cuts a hole around one element at a time. The hole glides to each next element and takes its shape, with the explanation card riding along beside it.
This demo, Product Onboarding: A first tour of a dashboard: the avatar, the toolbar, the New button and the sidebar. The hole goes from a circle to a long pill to a button to a tall panel. Clicking New moves the tour on.

1. Install it:
   npx shadcn@latest add @keyframeui/spotlight-tour-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/spotlight-tour-demo.json instead.)
   It adds the demo, components/spotlight-tour-demo.tsx, and the component, components/ui/spotlight-tour.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 <SpotlightTour> on its own.

3. These props set its feel. Change them before you change the file:
   - padding (default 8): Room between each element and the edge of its hole, in pixels. A step's own `padding` wins.
   - duration (default 0.5): How long the hole takes to glide to each next element, and to iris open around the first, in seconds. Pages scrolling an element into view ride the same glide.
   - bounce (default 0.14): Bounce of the hole's glide between elements, from 0 (none) to 1.

4. Don't change, in components/ui/spotlight-tour.tsx:
   - The hole, dim, card and ring run on motion values that one `frame.render` loop writes straight to their elements' styles, so nothing re-renders while they move.
   - The hole is cut out of one dim layer with an even-odd `clip-path`; each trip starts where the hole is and carries its speed, so pressing again mid-flight bends the path instead of stopping.
   - Scrolling an element into view follows the same `progress` spring as the hole, so it's one motion; a wheel or touch hands the scroll back to the visitor.
   - Closing widens the hole past the screen's edges while the dark lifts on a lingering ease-in, and the layer goes away when the fades end, without waiting for the spring to rest.
   - Reduced motion has no glide, pulse or lift: between steps the hole fades shut, jumps and fades open, and the text fades instead of sliding.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/spotlight-tour.md

Installation

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

The CLI writes components/ui/spotlight-tour.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/spotlight-tour

Examples

Finished sections built with Spotlight Tour. Each one installs whole, with the component included.

What's New

Three new features spread down a page. Each one scrolls into view while the spotlight travels to it. The Live switch stays usable while it's highlighted.

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

Spotlight Tour: A guided tour that dims the page and cuts a hole around one element at a time. The hole glides to each next element and takes its shape, with the explanation card riding along beside it.
This demo, What's New: Three new features spread down a page. Each one scrolls into view while the spotlight travels to it. The Live switch stays usable while it's highlighted.

1. Install it:
   npx shadcn@latest add @keyframeui/spotlight-tour-whats-new-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/spotlight-tour-whats-new-demo.json instead.)
   It adds the demo, components/spotlight-tour-whats-new-demo.tsx, and the component, components/ui/spotlight-tour.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 <SpotlightTour> on its own.

3. These props set its feel. Change them before you change the file:
   - padding (default 8): Room between each element and the edge of its hole, in pixels. A step's own `padding` wins.
   - duration (default 0.5): How long the hole takes to glide to each next element, and to iris open around the first, in seconds. Pages scrolling an element into view ride the same glide.
   - bounce (default 0.14): Bounce of the hole's glide between elements, from 0 (none) to 1.

4. Don't change, in components/ui/spotlight-tour.tsx:
   - The hole, dim, card and ring run on motion values that one `frame.render` loop writes straight to their elements' styles, so nothing re-renders while they move.
   - The hole is cut out of one dim layer with an even-odd `clip-path`; each trip starts where the hole is and carries its speed, so pressing again mid-flight bends the path instead of stopping.
   - Scrolling an element into view follows the same `progress` spring as the hole, so it's one motion; a wheel or touch hands the scroll back to the visitor.
   - Closing widens the hole past the screen's edges while the dark lifts on a lingering ease-in, and the layer goes away when the fades end, without waiting for the spring to rest.
   - Reduced motion has no glide, pulse or lift: between steps the hole fades shut, jumps and fades open, and the text fades instead of sliding.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/spotlight-tour.md

Form Help

A sign-up form that explains each field in turn. You can type into each field while it's highlighted.

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

Spotlight Tour: A guided tour that dims the page and cuts a hole around one element at a time. The hole glides to each next element and takes its shape, with the explanation card riding along beside it.
This demo, Form Help: A sign-up form that explains each field in turn. You can type into each field while it's highlighted.

1. Install it:
   npx shadcn@latest add @keyframeui/spotlight-tour-form-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/spotlight-tour-form-demo.json instead.)
   It adds the demo, components/spotlight-tour-form-demo.tsx, and the component, components/ui/spotlight-tour.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 <SpotlightTour> on its own.

3. These props set its feel. Change them before you change the file:
   - padding (default 8): Room between each element and the edge of its hole, in pixels. A step's own `padding` wins.
   - duration (default 0.5): How long the hole takes to glide to each next element, and to iris open around the first, in seconds. Pages scrolling an element into view ride the same glide.
   - bounce (default 0.14): Bounce of the hole's glide between elements, from 0 (none) to 1.

4. Don't change, in components/ui/spotlight-tour.tsx:
   - The hole, dim, card and ring run on motion values that one `frame.render` loop writes straight to their elements' styles, so nothing re-renders while they move.
   - The hole is cut out of one dim layer with an even-odd `clip-path`; each trip starts where the hole is and carries its speed, so pressing again mid-flight bends the path instead of stopping.
   - Scrolling an element into view follows the same `progress` spring as the hole, so it's one motion; a wheel or touch hands the scroll back to the visitor.
   - Closing widens the hole past the screen's edges while the dark lifts on a lingering ease-in, and the layer goes away when the fades end, without waiting for the spring to rest.
   - Reduced motion has no glide, pulse or lift: between steps the hole fades shut, jumps and fades open, and the text fades instead of sliding.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/spotlight-tour.md

Props

steps Required

TypeSpotlightTourStep[]

The stops on the tour. Each has a title, and optionally a body, a target (a CSS selector, an element or a ref; leave it out for a centered card with no highlight), a side for the card, its own padding and radius, interactive to let people click and type inside the hole, and advanceOnClick to move on when the element is clicked.

open Required

Typeboolean

Whether the tour is showing.

onOpenChange

Type(open: boolean) => void

Called with false when the tour is skipped, closed with Esc or finished.

step

Typenumber

The current step, to control it yourself. Otherwise the tour starts at the first step each time it opens.

onStepChange

Type(step: number) => void

Called when the step changes. Use it to get the page ready, such as opening a menu before highlighting something inside it. The tour waits for the element to appear.

onComplete

Type() => void

Called when Done is pressed on the last step, not when the tour is skipped.

padding

TypenumberDefault8

Room between each element and the edge of its hole, in pixels. A step's own padding wins.

duration

TypenumberDefault0.5

How long the hole takes to glide to each next element, and to iris open around the first, in seconds. Pages scrolling an element into view ride the same glide.

bounce

TypenumberDefault0.14

Bounce of the hole's glide between elements, from 0 (none) to 1.

className

Typestring

Extra classes for the card.

overlayClassName

Typestring

Extra classes for the dimmed layer, such as its color. Defaults to bg-black/50 dark:bg-black/65.