Ir al contenido
Español
Recorrido guiado viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

The spotlight is one element: its 9999px spread shadow dims the screen, and transform, width, height and radius animate together so it glides and resizes between targets on one curve. The card is placed below the target, else above, else at the bottom of the frame, clamped inside, with its arrow pointing at the target's centre. Positions are measured in layout pixels and remeasured when the frame resizes.

Úsalo para

  • A first visit to a dense screen, pointing out three to five key places.
  • Introducing a new feature in an existing layout.

Busca otra opción cuando

  • Explaining things the interface should make obvious: fix the interface instead.
  • Long tutorials: link to a guide.

Uso

import { useState } from 'react'
import { ProductTour } from './ProductTour.jsx'

export function Onboarding() {
  const [open, setOpen] = useState(true)
  return (
    <ProductTour
      open={open}
      onOpenChange={setOpen}
      steps={[
        { target: '[data-tour="new"]', title: 'Start a project', body: 'Create one per client or campaign.' },
        { target: '[data-tour="search"]', title: 'Find anything', body: 'Projects, files and people in one box.' },
      ]}
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
steps{ target: string | RefObject, title, body }[]—Steps in order. A string target is a CSS selector looked up inside the tour's parent element.
open / onOpenChangeboolean / (open) => voidopen trueShown or not; closes on Skip, Done, Escape or a click on the dimmed area.
step / defaultStep / onStepChangenumberdefaultStep 0The current step, controlled or not.
labelsobject—Replaces next, back, done, skip and progress (with {n} and {total}).
paddingnumber8Space between the target and the spotlight edge, in px.
containedbooleanfalseCover the parent element instead of the viewport.

Accesibilidad

  • The card is a modal role dialog labelled by the step title and described by its text; the step count is a polite live region.
  • Moving to a step focuses the Next or Done button; Tab cycles inside the card; Left and Right change steps; Escape closes.
  • The spotlight and dimming are aria-hidden decoration; all meaning is in the card text.
  • Buttons are 32px high with visible focus rings.
  • With reduced motion the spotlight and card jump between targets and the pulse is off.

Movimiento

Spotlight and card 520ms cubic-bezier(0.65, 0, 0.25, 1); step text rises 4px in 360ms; two soft pulses around each new target; progress dot stretches to 18px.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

ProductTour.jsxproduct-tour.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Capas
Panel inferior viene con Pro. La vista previa aparece al desbloquearlo.