PRODUCT TOUR

Product Stage.

Tabs that move a focus frame across a screenshot or live interface, with a caption for each feature.

Pick a detail. See the difference.

workspace / overview
YOUR WORKSPACE

Good things are taking shape.

Last 30 days ⌄
Total revenue$24,680+18.6%
Active projects12+3 this month
Team velocity94.2%+8.2%
Momentum
Revenue ↑ 18.6%
Jun 01Jun 15Jun 30
Latest activity
EL
Website shippedJust now
MK
Brand assets ready24 minutes ago
JS
New project created1 hour ago
01 / 03Revenue, active projects, and velocity for the last 30 days.
REACT + TYPESCRIPT + CSSMIT LICENSE

Installation

In a project with React and shadcn configured, run:

npx shadcn@latest add https://aduneer.github.io/opalframe/r/product-stage.json

Copies the component and its stylesheet into components/ui. No additional runtime dependencies. Tailwind classes work through className.

For manual installation, copy both files from Source below. Keep the CSS import alongside the component.

Usage

import { ProductStage } from "@/components/ui/product-stage";

export default function Example() {
  return (
    <ProductStage features={[
      {
        id: "overview", label: "Overview",
        description: "The big picture.", detail: "See your workspace at a glance.",
        target: "[data-stage-target=overview]",
      },
      {
        id: "activity", label: "Activity",
        description: "What changed.", detail: "Follow the latest updates.",
        target: "[data-stage-target=activity]",
      },
    ]}>
      <div style={{ padding: 32 }}>
        <h2 data-stage-target="overview">Your workspace</h2>
        <p data-stage-target="activity">Three updates today.</p>
      </div>
    </ProductStage>
  );
}

Customize

Colors and sizes are scoped CSS variables. Override them on your own class.

<ProductStage
  className="my-product-stage"
  features={features}
  defaultValue="overview"
>
  <YourProductPreview />
</ProductStage>

/* Your stylesheet */
.my-product-stage {
  --stage-accent: #a6cfff;
  --stage-selected: #1e2029;
  --stage-text: #f2f3f8;
  --stage-muted: #aeb4c4;
  --stage-border: #3d4354;
}

Props

PropTypeWhat it does
featuresStageFeature[]Feature labels and captions. Use target (a scoped CSS selector) for live content, or focus (percentages) for an image.
childrenReactNodeYour preview, screenshot, or interface.
focusPaddingnumberPixels around a measured target. Defaults to 5.
value / defaultValuestringControlled or initial selected feature ID.
onValueChange(id: string) => voidCalled when a visitor selects a feature.
reducedMotionbooleanDisable transitions in addition to the OS preference.
label / classNamestringTablist label and root customization.

Accessibility & motion

Arrow keys move between tabs; Home and End select the first and last. The panel names its selected tab. Captions announce politely. The focus rectangle is decorative. OS reduced motion disables transitions.

Dependencies

React only. Styles live in a plain CSS file next to the component, and Tailwind utilities work through className.

Source

product-stage.tsx
"use client";

import {
  useEffect,
  useId,
  useRef,
  useState,
  type KeyboardEvent,
  type ReactNode,
} from "react";
import "./product-stage.css";

export interface StageFeature {
  id: string;
  label: string;
  description: string;
  detail: string;
  /** CSS selector scoped to the preview. Measured again when its layout changes. */
  target?: string;
  /** Percentage rectangle for image previews without DOM targets. */
  focus?: { x: number; y: number; width: number; height: number };
}

export interface ProductStageProps {
  features: StageFeature[];
  children: ReactNode;
  value?: string;
  defaultValue?: string;
  onValueChange?: (value: string) => void;
  className?: string;
  label?: string;
  reducedMotion?: boolean;
  focusPadding?: number;
}

export function ProductStage({
  features,
  children,
  value,
  defaultValue,
  onValueChange,
  className = "",
  label = "Explore the product",
  reducedMotion = false,
  focusPadding = 5,
}: ProductStageProps) {
  const uid = useId();
  const [internalValue, setInternalValue] = useState(
    defaultValue ?? features[0]?.id,
  );
  const selected =
    features.find((feature) => feature.id === (value ?? internalValue)) ??
    features[0];
  const scene = useRef<HTMLDivElement>(null);
  const [measuredFocus, setMeasuredFocus] = useState<StageFeature["focus"]>();
  const target = selected?.target;
  useEffect(() => {
    const preview = scene.current;
    if (!preview || !target) return;
    const element = preview.querySelector(target);
    if (!element) return;
    const measure = () => {
      const frame = preview.getBoundingClientRect();
      const bounds = element.getBoundingClientRect();
      if (!frame.width || !frame.height) return;
      // Keep padding in local CSS pixels, including when a recording canvas is scaled.
      const paddingX = focusPadding * (frame.width / preview.offsetWidth);
      const paddingY = focusPadding * (frame.height / preview.offsetHeight);
      setMeasuredFocus({
        x: ((bounds.left - frame.left - paddingX) / frame.width) * 100,
        y: ((bounds.top - frame.top - paddingY) / frame.height) * 100,
        width: ((bounds.width + paddingX * 2) / frame.width) * 100,
        height: ((bounds.height + paddingY * 2) / frame.height) * 100,
      });
    };
    const observer = new ResizeObserver(measure);
    observer.observe(preview);
    observer.observe(element);
    const animationFrame = requestAnimationFrame(measure);
    return () => {
      observer.disconnect();
      cancelAnimationFrame(animationFrame);
    };
  }, [target, focusPadding, children]);
  if (!selected) return null;
  const focus = target ? measuredFocus : selected.focus;

  function select(id: string) {
    if (value === undefined) setInternalValue(id);
    onValueChange?.(id);
  }

  function navigate(event: KeyboardEvent<HTMLButtonElement>, index: number) {
    let next = index;
    if (event.key === "ArrowDown" || event.key === "ArrowRight")
      next = (index + 1) % features.length;
    else if (event.key === "ArrowUp" || event.key === "ArrowLeft")
      next = (index - 1 + features.length) % features.length;
    else if (event.key === "Home") next = 0;
    else if (event.key === "End") next = features.length - 1;
    else return;
    event.preventDefault();
    select(features[next].id);
    document.getElementById(`${uid}-tab-${features[next].id}`)?.focus();
  }

  return (
    <div
      className={`is-stage ${className}`}
      data-reduced-motion={reducedMotion || undefined}
    >
      <div
        className="is-stage-features"
        role="tablist"
        aria-label={label}
        aria-orientation="vertical"
      >
        {features.map((feature, index) => (
          <button
            key={feature.id}
            id={`${uid}-tab-${feature.id}`}
            role="tab"
            type="button"
            aria-selected={feature.id === selected.id}
            aria-controls={`${uid}-panel`}
            tabIndex={feature.id === selected.id ? 0 : -1}
            onClick={() => select(feature.id)}
            onKeyDown={(event) => navigate(event, index)}
          >
            <span className="is-stage-number">0{index + 1}</span>
            <span>
              <span className="is-stage-label">{feature.label}</span>
              <span className="is-stage-description">
                {feature.description}
              </span>
            </span>
            <span className="is-stage-arrow" aria-hidden="true">
              ↗
            </span>
          </button>
        ))}
        <p className="is-stage-hint">Pick a detail. See the difference.</p>
      </div>
      <div
        className="is-stage-body"
        role="tabpanel"
        id={`${uid}-panel`}
        aria-labelledby={`${uid}-tab-${selected.id}`}
        tabIndex={0}
      >
        <div className="is-stage-scene" ref={scene}>
          {children}
          {focus && (
            <div
              className="is-stage-focus"
              aria-hidden="true"
              style={{
                left: `${focus.x}%`,
                top: `${focus.y}%`,
                width: `${focus.width}%`,
                height: `${focus.height}%`,
              }}
            >
              <span />
              <span />
              <span />
              <span />
            </div>
          )}
        </div>
        <div className="is-stage-caption" aria-live="polite" aria-atomic="true">
          <span className="is-stage-caption-index">
            0{features.indexOf(selected) + 1} / 0{features.length}
          </span>
          <span className="is-stage-caption-texts">
            {features.map((feature) => (
              <span
                key={feature.id}
                data-active={feature.id === selected.id}
                aria-hidden={feature.id !== selected.id}
              >
                {feature.detail}
              </span>
            ))}
          </span>
          <span aria-hidden="true">↗</span>
        </div>
      </div>
    </div>
  );
}
product-stage.css
.is-stage {
  --stage-accent: var(--accent, #aacfff);
  --stage-text: var(--text, #f1f1f3);
  --stage-muted: var(--muted, #a1a1aa);
  --stage-border: var(--line, #343439);
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(190px, 0.31fr) minmax(0, 1fr);
  color: var(--stage-text);
  gap: 28px;
}
.is-stage-features {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.is-stage-features button {
  display: flex;
  gap: 16px;
  text-align: left;
  padding: 22px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--stage-muted);
  background: none;
  font: inherit;
  cursor: pointer;
  transition:
    background 220ms,
    color 220ms,
    border-color 220ms;
}
.is-stage-features button[aria-selected="true"] {
  background: var(--stage-selected, var(--raised, #242428));
  border-color: var(--stage-border);
  color: var(--stage-text);
}
.is-stage-features button:hover {
  color: var(--stage-text);
}
.is-stage-features button:focus-visible,
.is-stage-body:focus-visible {
  outline: 2px solid var(--stage-accent);
  outline-offset: 4px;
}
.is-stage-number {
  font:
    11px ui-monospace,
    monospace;
  padding-top: 4px;
  color: var(--stage-accent);
}
.is-stage-label {
  display: block;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.02em;
}
.is-stage-description {
  display: block;
  font-size: 12px;
  line-height: 1.65;
  margin-top: 6px;
  max-width: 175px;
  color: var(--stage-muted);
}
.is-stage-arrow {
  margin-left: auto;
  color: var(--stage-accent);
  opacity: 0;
}
.is-stage-features button[aria-selected="true"] .is-stage-arrow {
  opacity: 1;
}
.is-stage-hint {
  font-size: 11px;
  margin: 22px 18px 0;
  color: var(--stage-muted);
}
.is-stage-body {
  min-width: 0;
  border-radius: 10px;
}
.is-stage-scene {
  position: relative;
  isolation: isolate;
}
.is-stage-focus {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  border: 1px solid var(--stage-accent);
  border-radius: 5px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--stage-accent) 8%, transparent);
  transition:
    left 500ms cubic-bezier(0.22, 1, 0.36, 1),
    top 500ms cubic-bezier(0.22, 1, 0.36, 1),
    width 500ms cubic-bezier(0.22, 1, 0.36, 1),
    height 500ms cubic-bezier(0.22, 1, 0.36, 1);
}
.is-stage-focus span {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--stage-accent);
  border-radius: 1px;
}
.is-stage-focus span:nth-child(1) {
  left: -3px;
  top: -3px;
}
.is-stage-focus span:nth-child(2) {
  right: -3px;
  top: -3px;
}
.is-stage-focus span:nth-child(3) {
  left: -3px;
  bottom: -3px;
}
.is-stage-focus span:nth-child(4) {
  right: -3px;
  bottom: -3px;
}
.is-stage-caption {
  min-height: 66px;
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--stage-muted);
  font-size: 12px;
  padding: 16px 2px 0;
}
.is-stage-caption-index {
  font:
    10px ui-monospace,
    monospace;
  color: var(--stage-accent);
  white-space: nowrap;
}
.is-stage-caption-texts {
  display: grid;
  flex: 1;
  min-width: 0;
}
.is-stage-caption-texts > span {
  grid-area: 1 / 1;
  visibility: hidden;
}
.is-stage-caption-texts > span[data-active="true"] {
  visibility: visible;
}
.is-stage-caption > span:last-child {
  margin-left: auto;
  color: var(--stage-accent);
}
.is-stage[data-reduced-motion] *,
.is-stage[data-reduced-motion] *::before {
  transition: none !important;
}
@media (max-width: 680px) {
  .is-stage {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .is-stage-features {
    flex-direction: row;
    gap: 4px;
  }
  .is-stage-features button {
    flex: 1;
    justify-content: center;
    padding: 13px 8px;
    gap: 8px;
  }
  .is-stage-description,
  .is-stage-hint,
  .is-stage-arrow {
    display: none;
  }
  .is-stage-label {
    font-size: 12px;
  }
  .is-stage-number {
    font-size: 9px;
  }
  .is-stage-caption {
    font-size: 11px;
    gap: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .is-stage * {
    transition: none !important;
  }
}