Tour
Tour walks users through key areas of an interface.
@duskmoon-dev/components/tour Usage
When to use
- Use it immediately after user actions or system checks that need visible confirmation.
- Choose the least interruptive feedback surface that still makes the state clear.
Implementation notes
Features
Covers transient, inline, or blocking feedback patterns for user actions and system status.
Shows how the component keeps next actions visible after success, warning, or failure states.
Tour is most often configured through `steps`, `open`, `defaultOpen`, `current`.
Renders the current step when open
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Welcome
Basic usage
Import the component stylesheet and Tour from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function Example() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Renders the current step when open
test-backedTour scenario from the component test coverage: renders the current step when open.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function TourRendersTheCurrentStepDemo() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Supports uncontrolled step changes and finish close
test-backedTour scenario from the component test coverage: supports uncontrolled step changes and finish close.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function TourSupportsUncontrolledStepChangesDemo() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Honors controlled current and custom indicators
test-backedTour scenario from the component test coverage: honors controlled current and custom indicators.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function TourHonorsControlledCurrentAndDemo() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Applies placement, target highlight, and mask config
test-backedTour scenario from the component test coverage: applies placement, target highlight, and mask config.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function TourAppliesPlacementTargetHighlightDemo() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Supports close callbacks and hidden mask or indicators
test-backedTour scenario from the component test coverage: supports close callbacks and hidden mask or indicators.
import "@duskmoon-dev/components/styles.css";
import { Tour } from "@duskmoon-dev/components/tour";
export function TourSupportsCloseCallbacksAndDemo() {
return (<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>);
} Welcome
Welcome
Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>
</div>
<div data-theme="moonlight">
<Tour
open
mask={false}
steps={[
{
title: "Welcome",
description: "Review the highlighted workflow.",
style: {
position: "static",
left: "auto",
top: "auto",
transform: "none"
}
}
]}
/>
</div> API
The API reference below lists every parsed exported type or interface for Tour. Start with `steps`, `open`, `defaultOpen`, `current` for common usage.
packages/components/src/components/tour/Tour.types.ts
Scenarios: packages/components/src/components/tour/Tour.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
steps | TourStep[] | No | steps configures Tour. |
open | boolean | No | open configures Tour. |
defaultOpen | boolean | No | defaultOpen configures Tour. |
current | number | No | current configures Tour. |
defaultCurrent | number | No | defaultCurrent configures Tour. |
placement | TourPlacement | No | placement configures Tour. |
mask | boolean | TourMaskConfig | No | mask configures Tour. |
indicators | boolean | ((current: number, total: number) => ReactNode) | No | indicators configures Tour. |
indicatorsRender | (current: number, total: number) => ReactNode | No | indicatorsRender configures Tour. |
closeIcon | ReactNode | No | closeIcon configures Tour. |
disabledInteraction | boolean | No | disabledInteraction configures Tour. |
zIndex | number | No | zIndex configures Tour. |
gap | number | No | gap configures Tour. |
nextButtonProps | ButtonProps | No | nextButtonProps configures Tour. |
prevButtonProps | ButtonProps | No | prevButtonProps configures Tour. |
onClose | (current: number) => void | No | onClose configures Tour. |
onChange | (current: number) => void | No | onChange configures Tour. |
onFinish | () => void | No | onFinish configures Tour. |
| Prop | Type | Required | Description |
|---|---|---|---|
className | string | No | className configures Tour. |
style | CSSProperties | No | style configures Tour. |
color | string | No | color configures Tour. |
| Prop | Type | Required | Description |
|---|---|---|---|
title | ReactNode | No | title configures Tour. |
description | ReactNode | No | description configures Tour. |
target | TourTarget | No | target configures Tour. |
placement | TourPlacement | No | placement configures Tour. |
cover | ReactNode | No | cover configures Tour. |
mask | boolean | TourMaskConfig | No | mask configures Tour. |
nextButtonProps | ButtonProps | No | nextButtonProps configures Tour. |
prevButtonProps | ButtonProps | No | prevButtonProps configures Tour. |
closeIcon | ReactNode | No | closeIcon configures Tour. |
className | string | No | className configures Tour. |
style | CSSProperties | No | style configures Tour. |
onClose | (current: number) => void | No | onClose configures Tour. |
| Prop | Type | Required | Description |
|---|---|---|---|
top | number | Yes | top configures Tour. |
left | number | Yes | left configures Tour. |
width | number | Yes | width configures Tour. |
height | number | Yes | height configures Tour. |
| "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | HTMLElement | null | string | (() => HTMLElement | null) MouseEvent<HTMLButtonElement>