Examples

Two-step onboarding tour

Preview
Example.tsx
import { Button, Tour } from '@reactloom/ui';
import { useRef, useState } from 'react';

export default function Example() {
  const [open, setOpen] = useState(false);
  const targetRef = useRef<HTMLButtonElement>(null);
  return (
    <div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
      <Button ref={targetRef} onClick={() => setOpen(true)}>
        Start tour
      </Button>
      <Tour
        open={open}
        onOpenChange={setOpen}
        steps={[
          { title: 'Create a project', description: 'Use this action to initialize a new workspace.', target: targetRef },
          { title: 'Invite teammates', description: 'Share access from workspace settings once ready.' },
        ]}
      />
    </div>
  );
}

API reference

Tour props
PropTypeDefault
stepsrequired
Ordered tour steps with title, description, and optional target.
readonly TourStep[]—
open · defaultOpen
Controlled or initial open state.
boolean—
onOpenChange
Called when the tour opens or closes.
(open: boolean) => void—
onFinish
Called when the user clicks Finish on the final step.
() => void—

Keyboard interaction

Keyboard interactions
KeyAction
EscapeClose the tour
TabMove between Previous, Next/Finish, and Close buttons

Usage guidelines

Do

  • Keep tours short (2–5 steps) and let users dismiss them at any point.

Don’t

  • Do not block primary workflows with mandatory tours on every visit.