Tour
Introduction
Section titled “Introduction”Guides people through a screen with a sequence of steps. Each step points at an element of the page (or is centered), dims the page around it with a spotlight, and offers Next, Back, Skip, and Finish with progress such as “2 of 5”. Every step is a dialog: non-modal by default, so the page stays usable, or modal on request. Focus moves into each step and returns to where it was when the tour ends. A step whose target is missing is skipped and reported with aui-step-missing.
- SpotlightDims the page around the target with a CSS cut-out that follows scrolling and resizing, under a strict CSP.
- A dialog per stepNon-modal by default, modal on request; focus moves into every step and returns when the tour ends.
- Keyboard firstNext, Back, Skip, and Finish buttons, arrow keys mirrored in RTL, and Escape to skip.
- Robust targetsElements, selectors, or functions; missing targets are skipped with an event, and hooks can open what a step needs.
- Progress"2 of 5" announced with each step, optional dots, and targets scrolled into view.
Use it for
- First-time guidance through a new screen or feature.
- Explaining a changed layout after a release.
- Walking through a multi-part workflow where each part is a visible control.
Use something else for
- Information users need every time: put it in the interface or in help text.
- A single hint next to one control: use Popover or Tooltip.
- A blocking question: use Dialog.
Anatomy
<div class="aui-tour"> (host, display: contents) <div class="aui-tour__overlay" popover="manual" aria-hidden="true"> <div class="aui-tour__spotlight"></div> (cut-out; its shadow dims the page) </div> <div class="aui-tour__panel" popover="manual" role="dialog" tabindex="-1" aria-labelledby="...-title" aria-describedby="...-content ...-progress"> <h2 class="aui-tour__title">Search</h2> <div class="aui-tour__content">Find people, documents, and pages.</div> <p class="aui-tour__progress">2 of 5</p> <div class="aui-tour__dots" aria-hidden="true"><span class="aui-tour__dot aui-tour__dot--active"></span>...</div> <div class="aui-tour__footer"> <button class="aui-button aui-tour__skip">Skip tour</button> <div class="aui-tour__nav"> <button class="aui-button aui-tour__back">Back</button> <button class="aui-button aui-tour__next">Next</button> </div> </div> </div></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
Tour in the Document center showcase
Section titled “Tour in the Document center showcase”The part of the Document center showcase that uses Tour. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Documents showcase: a document center over a simulated provider. The File Manager// browses folders (list or grid, sort, multi-select, rename, new folder, delete, move by drag or// cut and paste, uploads with progress); opening a photo shows it in the Image Viewer (zoom,// rotate, crop to a Blob); opening a text or code file shows it in the Code Viewer with a diff// against its previous version; every change is added to the Timeline of document activity; and// a Tour walks through the page.import { instant, type Instant } from '@absoluteui/core';import { CodeViewer, type CodeLanguage } from '@absoluteui/components/code-viewer';import { FileManager, type FileEntry, type FileManagerCreateFolderDetail, type FileManagerDeleteDetail, type FileManagerErrorDetail, type FileManagerMoveDetail, type FileManagerOpenDetail, type FileManagerProvider, type FileManagerRenameDetail, type FileManagerUploadDetail,} from '@absoluteui/components/file-manager';import { ImageViewer, type ImageViewerImage } from '@absoluteui/components/image-viewer';import { Timeline, type TimelineActionDetail, type TimelineItem, type TimelineTone } from '@absoluteui/components/timeline';import { Tour } from '@absoluteui/components/tour';import { action, choice, createShowcase, hostIn, section, status, toggle, wait } from './kit.js';
const sc = createShowcase({ title: 'Document center', description: 'Browse company documents, preview photos and files, compare versions, follow the activity, and take the guided tour.', simulated: true,});
// Simulated storage: entries, text contents with a previous version, and generated photos.const HOUR = 3_600_000;const now = Date.now();const ago = (hours: number): Instant => instant(now - hours * HOUR);
function photo(color: string, label: string): string { const canvas = document.createElement('canvas'); canvas.width = 640; canvas.height = 400; const ctx = canvas.getContext('2d'); if (ctx) { ctx.fillStyle = color; ctx.fillRect(0, 0, 640, 400); ctx.fillStyle = '#f8fafc'; ctx.beginPath(); ctx.arc(320, 170, 80, 0, Math.PI * 2); ctx.fill(); ctx.fillRect(190, 270, 260, 90); ctx.fillStyle = '#0f172a'; ctx.font = '600 28px sans-serif'; ctx.textAlign = 'center'; ctx.fillText(label, 320, 325); } return canvas.toDataURL('image/png');}
interface Stored { entry: FileEntry; text?: string; previous?: string; url?: string;}
const store = new Map<string, Stored>();let nextId = 1;function put(entry: Omit<FileEntry, 'id'> & { id?: string }, extra: Omit<Stored, 'entry'> = {}): FileEntry { const id = entry.id ?? `f${String(nextId++)}`; const full: FileEntry = { ...entry, id }; store.set(id, { entry: full, ...extra }); return full;}
const policyBefore = '{\n "policy": "Annual leave",\n "annualDays": 25,\n "carryOverDays": 5,\n "approval": "manager"\n}\n';const policyAfter = '{\n "policy": "Annual leave",\n "annualDays": 26,\n "carryOverDays": 5,\n "halfDays": true,\n "approval": ["manager", "hr"]\n}\n';const exportBefore = "export async function exportEmployees(limit = 100): Promise<string> {\n const response = await fetch(`/api/employees?limit=${String(limit)}`);\n return JSON.stringify(await response.json());\n}\n";const exportAfter = "/** Export employees as indented JSON; business days only (see the payroll calendar). */\nexport async function exportEmployees(limit = 100, signal?: AbortSignal): Promise<string> {\n const response = await fetch(`/api/employees?limit=${String(limit)}`, { signal });\n if (!response.ok) throw new Error(`Export failed: ${String(response.status)}`);\n return JSON.stringify(await response.json(), null, 2);\n}\n";const handbook = '# Employee handbook\n\nWelcome to the company. Read the **leave policy** first.\n\n## Working hours\n\n- Core hours: 10:00 to 16:00\n- Public holidays follow the `business calendar`\n';const handbookBefore = '# Employee handbook\n\nWelcome to the company.\n\n## Working hours\n\n- Core hours: 10:00 to 15:00\n';
put({ id: 'policies', name: 'Policies', kind: 'folder', parentId: null, hasChildren: true, modified: ago(30) });put({ id: 'photos', name: 'Badge photos', kind: 'folder', parentId: null, hasChildren: false, modified: ago(50) });put({ id: 'scripts', name: 'Scripts', kind: 'folder', parentId: null, hasChildren: false, modified: ago(70) });put({ id: 'archive', name: 'Archive', kind: 'folder', parentId: null, hasChildren: false, modified: ago(900) });put({ name: 'Employee handbook.md', kind: 'file', parentId: null, size: 18_240, mimeType: 'text/markdown', modified: ago(5) }, { text: handbook, previous: handbookBefore });put({ id: 'leave-policy', name: 'leave-policy.json', kind: 'file', parentId: 'policies', size: 1_204, mimeType: 'application/json', modified: ago(2) }, { text: policyAfter, previous: policyBefore });put({ name: 'travel-policy.md', kind: 'file', parentId: 'policies', size: 9_870, mimeType: 'text/markdown', modified: ago(120) }, { text: '# Travel policy\n\nBook economy for flights under six hours.\n' });put({ id: 'remote', name: 'Remote work', kind: 'folder', parentId: 'policies', hasChildren: false, modified: ago(200) });put({ name: 'export-employees.ts', kind: 'file', parentId: 'scripts', size: 2_310, mimeType: 'text/typescript', modified: ago(26) }, { text: exportAfter, previous: exportBefore });put({ name: 'monthly-report.sql', kind: 'file', parentId: 'scripts', size: 640, mimeType: 'application/sql', modified: ago(300) }, { text: "SELECT department, COUNT(*) AS headcount\nFROM employees\nWHERE status = 'active'\nGROUP BY department\nORDER BY headcount DESC;\n" });const PEOPLE: readonly [string, string][] = [ ['Ada Lovelace', '#1d4ed8'], ['Grace Hopper', '#15803d'], ['Alan Turing', '#b45309'], ['Katherine Johnson', '#7c3aed'],];for (const [index, [person, color]] of PEOPLE.entries()) { put({ name: `${person}.png`, kind: 'file', parentId: 'photos', size: 48_000 + index * 3_100, mimeType: 'image/png', modified: ago(48 + index) }, { url: photo(color, person) });}
const children = (parentId: string | null): FileEntry[] => [...store.values()].map((s) => s.entry).filter((e) => e.parentId === parentId);const latency = (): number => 180 + Math.round(Math.random() * 220);function stored(id: string): Stored { const s = store.get(id); if (!s) throw new Error('The file no longer exists.'); return s;}function withChildren(id: string | null): void { if (id === null) return; const s = store.get(id); if (s) s.entry = { ...s.entry, hasChildren: children(id).some((e) => e.kind === 'folder') };}
const provider: FileManagerProvider = { async list(folderId, { signal }) { await wait(latency(), signal); return children(folderId); }, async createFolder(parentId, name, { signal }) { await wait(latency(), signal); const entry = put({ name, kind: 'folder', parentId, hasChildren: false, modified: instant(Date.now()) }); withChildren(parentId); return entry; }, async rename(entry, name, { signal }) { await wait(latency(), signal); const s = stored(entry.id); s.entry = { ...s.entry, name, modified: instant(Date.now()) }; return s.entry; }, async move(entries, targetFolderId, { signal }) { await wait(latency(), signal); const sources = new Set(entries.map((e) => e.parentId)); const moved = entries.map((e) => { const s = stored(e.id); s.entry = { ...s.entry, parentId: targetFolderId }; return s.entry; }); for (const id of [...sources, targetFolderId]) withChildren(id); return moved; }, async delete(entries, { signal }) { await wait(latency(), signal); const remove = (id: string): void => { for (const child of children(id)) remove(child.id); store.delete(id); }; for (const e of entries) remove(e.id); for (const e of entries) withChildren(e.parentId); }, async upload(folderId, file, { signal, onProgress }) { // Simulated transfer: ten steps; names starting with "fail" are rejected by the "server". for (let step = 1; step <= 10; step++) { await wait(120, signal); onProgress(Math.round((file.size * step) / 10), file.size); } if (file.name.toLowerCase().startsWith('fail')) throw new Error('The server rejected the file.'); const text = /\.(?:ts|js|json|md|txt|sql|css|html|sh)$/i.test(file.name) ? await file.text() : undefined; return put({ name: file.name, kind: 'file', parentId: folderId, size: file.size, mimeType: file.type, modified: instant(Date.now()) }, text === undefined ? {} : { text }); }, async getUrl(entry, { signal }) { await wait(120, signal); const url = stored(entry.id).url; if (url === undefined) throw new Error('This file has no preview.'); return url; }, async read(entry, { signal }) { await wait(120, signal); return stored(entry.id).text ?? ''; },};
// Activity timeline: seeded history plus live entries from the File Manager.const activity: TimelineItem[] = [ { id: 'a1', title: 'Leave policy updated', description: '26 annual days, half days allowed, HR approval added.', tone: 'success', status: 'Published', time: ago(2), avatar: { name: 'Grace Hopper' }, actions: [{ id: 'compare', label: 'Compare versions' }] }, { id: 'a2', title: 'Handbook edited', description: 'Core hours extended to 16:00.', tone: 'info', time: ago(5), avatar: { name: 'Ada Lovelace' }, actions: [{ id: 'compare', label: 'Compare versions' }] }, { id: 'a3', title: 'Export script reviewed', tone: 'neutral', time: ago(26), avatar: { name: 'Alan Turing' } }, { id: 'a4', title: 'Badge photos uploaded', description: 'Four photos for new starters.', tone: 'success', time: ago(48), avatar: { name: 'Katherine Johnson' } }, { id: 'a5', title: 'Virus scan blocked an upload', description: 'invoice.pdf.exe was quarantined.', tone: 'error', status: 'Blocked', time: ago(52) },];let olderPages = 2;let activityId = 100;
// Layout: files, then the two previews, then activity.const filesSection = section(sc, 'Files', ['file-manager', 'tour']);const fm = FileManager.create(hostIn(filesSection), { label: 'Company documents', root: { id: null, label: 'Documents' }, provider, height: '30rem', maxFileSize: 5_000_000,});const fmStatus = status(filesSection);fmStatus.textContent = 'Open a photo or a file (Enter or double click) to preview it.';sc.listen(fm.host, ['aui-navigate', 'aui-change', 'aui-open', 'aui-create-folder', 'aui-rename', 'aui-move', 'aui-delete', 'aui-upload', 'aui-error'], 'file-manager');
// The tour walks every section, so every section lists it.const previewSection = section(sc, 'Photos', ['image-viewer', 'tour']);const images = (): ImageViewerImage[] => children('photos') .filter((e) => e.mimeType?.startsWith('image/') === true) .map((e) => ({ src: stored(e.id).url ?? '', alt: `Badge photo of ${e.name.replace(/\.png$/, '')}`, caption: e.name, downloadName: e.name })) .filter((i) => i.src !== '');const viewer = ImageViewer.create(hostIn(previewSection), { label: 'Badge photos', images: images(), croppable: true, aspectRatios: [{ label: 'Badge (1:1)', value: 1 }, { label: '4:3', value: 4 / 3 }, { label: 'Free', value: null }] });sc.listen(viewer.host, ['aui-change', 'aui-zoom', 'aui-rotate', 'aui-crop', 'aui-error'], 'image-viewer');
const LANGUAGES: Readonly<Record<string, CodeLanguage>> = { json: 'json', ts: 'typescript', js: 'javascript', md: 'markdown', sql: 'sql', css: 'css', html: 'html', sh: 'bash' };const languageOf = (name: string): CodeLanguage => LANGUAGES[name.split('.').pop()?.toLowerCase() ?? ''] ?? 'plain';let diffMode: 'unified' | 'split' = 'unified';let showDiff = true;let current = stored('leave-policy');const codeSection = section(sc, 'File preview', ['code-viewer', 'tour']);const code = CodeViewer.create(hostIn(codeSection), { label: 'File preview', filename: current.entry.name, language: 'json', diff: { original: policyBefore, modified: policyAfter, mode: diffMode, originalLabel: 'Previous version', modifiedLabel: 'Current version' } });sc.listen(code.host, ['aui-copy', 'aui-change'], 'code-viewer');
function showCode(s: Stored): void { current = s; const text = s.text ?? ''; const language = languageOf(s.entry.name); if (showDiff && s.previous !== undefined) code.update({ filename: s.entry.name, language, code: '', diff: { original: s.previous, modified: text, mode: diffMode, originalLabel: 'Previous version', modifiedLabel: 'Current version' } }); else code.update({ filename: s.entry.name, language, diff: null, code: text });}
fm.host.addEventListener('aui-open', (event) => { const { entry } = (event as CustomEvent<FileManagerOpenDetail>).detail; const s = store.get(entry.id); if (!s) return; // The page shows previews inline instead of the File Manager's dialog, unless the preview // section is hidden (the File Manager's focus view on a component page). const inline = s.url !== undefined ? !previewSection.hidden : s.text !== undefined && !codeSection.hidden; if (!inline) return; event.preventDefault(); if (s.url !== undefined) { const list = images(); viewer.update({ images: list, index: Math.max(0, list.findIndex((i) => i.caption === entry.name)) }); fmStatus.textContent = `Showing ${entry.name} in the image viewer.`; viewer.host.scrollIntoView({ block: 'nearest' }); } else if (s.text !== undefined) { showCode(s); fmStatus.textContent = s.previous === undefined ? `Showing ${entry.name}.` : `Showing the changes to ${entry.name}.`; code.host.scrollIntoView({ block: 'nearest' }); }});
const activitySection = section(sc, 'Activity', ['timeline', 'tour']);const timeline = Timeline.create(hostIn(activitySection), { label: 'Document activity', items: activity, initialVisible: 4, hasMore: true, loadMore: async ({ signal }) => { await wait(500, signal); olderPages--; const base = 24 * (6 + (2 - olderPages) * 3); return [ { id: `old-${String(olderPages)}-1`, title: 'Contract template replaced', tone: 'info', time: ago(base), avatar: { name: 'Ada Lovelace' } }, { id: `old-${String(olderPages)}-2`, title: 'Archive folder cleaned up', tone: 'warning', description: '12 files older than seven years removed.', time: ago(base + 30) }, ]; },});sc.listen(timeline.host, ['aui-action', 'aui-toggle', 'aui-load-more', 'aui-load-error'], 'timeline');timeline.host.addEventListener('aui-load-more', () => { if (olderPages <= 0) timeline.update({ hasMore: false });});timeline.host.addEventListener('aui-action', (event) => { const { item } = (event as CustomEvent<TimelineActionDetail>).detail; const target = item.id === 'a2' ? [...store.values()].find((s) => s.entry.name === 'Employee handbook.md') : stored('leave-policy'); if (target) { showDiff = true; showCode(target); code.host.scrollIntoView({ block: 'nearest' }); }});
function record(title: string, tone: TimelineTone, description?: string): void { activity.unshift({ id: `live-${String(activityId++)}`, title, tone, time: instant(Date.now()), avatar: { name: 'You' }, ...(description === undefined ? {} : { description }) }); timeline.update({ items: [...activity] });}const names = (list: readonly FileEntry[]): string => list.map((e) => e.name).join(', ');fm.host.addEventListener('aui-create-folder', (e) => { record('Folder created', 'success', (e as CustomEvent<FileManagerCreateFolderDetail>).detail.entry.name);});fm.host.addEventListener('aui-rename', (e) => { const d = (e as CustomEvent<FileManagerRenameDetail>).detail; record('Renamed', 'info', `${d.previousName} to ${d.entry.name}`);});fm.host.addEventListener('aui-move', (e) => { record('Moved', 'info', names((e as CustomEvent<FileManagerMoveDetail>).detail.entries));});fm.host.addEventListener('aui-delete', (e) => { record('Deleted', 'warning', names((e as CustomEvent<FileManagerDeleteDetail>).detail.entries));});fm.host.addEventListener('aui-upload', (e) => { record('Uploaded', 'success', (e as CustomEvent<FileManagerUploadDetail>).detail.entry.name);});fm.host.addEventListener('aui-error', (e) => { const d = (e as CustomEvent<FileManagerErrorDetail>).detail; record(`Failed: ${d.operation}`, 'error', d.error instanceof Error ? d.error.message : undefined);});
// Guided tour of the page.const tour = Tour.create(hostIn(filesSection), { dots: true, steps: [ { id: 'welcome', title: 'Welcome to the document center', content: 'A short tour: files, previews, and activity. Press Escape to leave at any time.' }, { id: 'toolbar', title: 'File actions', content: 'Create folders, upload, rename, delete, cut and paste, sort, and switch between list and grid.', target: () => fm.host.querySelector('[role="toolbar"]'), placement: 'bottom-start' }, { id: 'folders', title: 'Folders', content: 'Browse the folder tree; drop files on a folder to move them.', target: () => fm.host.querySelector('.aui-file-manager__folders'), placement: 'right' }, { id: 'photos', title: 'Photo viewer', content: 'Zoom, rotate, and crop badge photos to a square.', target: () => viewer.host, placement: 'top' }, { id: 'code', title: 'Compare versions', content: 'See what changed in a file, unified or side by side.', target: () => code.host, placement: 'top' }, { id: 'activity', title: 'Activity', content: 'Every change you make is added here, grouped by day.', target: () => timeline.host, placement: 'top' }, ],});sc.listen(tour.host, ['aui-start', 'aui-step-change', 'aui-step-missing', 'aui-finish', 'aui-skip'], 'tour');
// Options.action(sc, 'Start tour', () => { void tour.start();}, ['tour']);choice(sc, 'View', [{ value: 'list', label: 'List' }, { value: 'grid', label: 'Grid' }], 'list', (view) => { fm.update({ view });}, ['file-manager']);toggle(sc, 'Folder pane', true, (checked) => { fm.update({ showFolderPane: checked });}, ['file-manager']);toggle(sc, 'Read-only', false, (checked) => { fm.update({ readOnly: checked });}, ['file-manager']);toggle(sc, 'Show changes', true, (checked) => { showDiff = checked; showCode(current);}, ['code-viewer']);choice(sc, 'Diff layout', [{ value: 'unified', label: 'Unified' }, { value: 'split', label: 'Side by side' }], 'unified', (mode) => { diffMode = mode; showCode(current);}, ['code-viewer']);choice(sc, 'Timeline layout', [{ value: 'start', label: 'Start' }, { value: 'alternate', label: 'Alternate' }], 'start', (layout) => { timeline.update({ layout });}, ['timeline']);choice(sc, 'Times', [{ value: 'relative', label: 'Relative' }, { value: 'absolute', label: 'Absolute' }], 'relative', (timeFormat) => { timeline.update({ timeFormat });}, ['timeline']);timeline.update({ timeFormat: 'relative' });Dashboard onboarding
Section titled “Dashboard onboarding”import { Tour, type TourFinishDetail, type TourSkipDetail } from '@absoluteui/components/tour';
const search = document.createElement('input');search.id = 'global-search';search.setAttribute('aria-label', 'Search');const start = document.createElement('button');start.type = 'button';start.textContent = 'Take the tour';const host = document.createElement('div');document.body.append(search, start, host);const tour = Tour.create(host, { steps: [ { id: 'welcome', title: 'Welcome to PeopleHub', content: 'A one-minute tour of the dashboard.' }, { id: 'search', title: 'Search', content: 'Find people, documents, and pages.', target: '#global-search' }, { id: 'help', title: 'Help', content: 'Restart this tour from the Help menu.', target: '#help-menu' }, ], dots: true,});host.addEventListener('aui-finish', (event) => { host.dataset.completed = String((event as CustomEvent<TourFinishDetail>).detail.completed);});host.addEventListener('aui-skip', (event) => { host.dataset.skippedAt = (event as CustomEvent<TourSkipDetail>).detail.stepId;});start.addEventListener('click', () => { void tour.start();});Modal steps with a hook that prepares the target
Section titled “Modal steps with a hook that prepares the target”import { Tour, type TourStepMissingDetail } from '@absoluteui/components/tour';
const panel = document.createElement('details');const summary = document.createElement('summary');summary.textContent = 'Filters';const button = document.createElement('button');button.textContent = 'Apply';panel.append(summary, button);const host = document.createElement('div');document.body.append(panel, host);const tour = Tour.create(host, { modal: true, steps: [ { id: 'apply', title: 'Apply filters', content: 'Your filters take effect when you apply them.', target: () => button, placement: 'right', onBeforeShow: () => { panel.open = true; }, }, ],});host.addEventListener('aui-step-missing', (event) => { host.dataset.missing = (event as CustomEvent<TourStepMissingDetail>).detail.reason;});void tour.start();Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { Tour } from '@absoluteui/components/tour';import '@absoluteui/components/button/style.css';import '@absoluteui/components/tour/style.css';First use
Section titled “First use”import { Tour } from '@absoluteui/components/tour';import '@absoluteui/components/button/style.css';import '@absoluteui/components/tour/style.css';
const host = document.querySelector<HTMLElement>('#tour');const help = document.querySelector<HTMLButtonElement>('#take-tour');if (host && help) { const tour = Tour.create(host, { steps: [{ id: 'search', title: 'Search', content: 'Find anything here.', target: '#search' }] }); help.addEventListener('click', () => { void tour.start(); });}More usage
import { Tour } from '@absoluteui/components/tour';
const host = document.querySelector<HTMLElement>('#tour');if (host) { const tour = Tour.create(host, { steps: [ { id: 'welcome', title: 'Welcome', content: 'A short tour of your dashboard.' }, { id: 'leave', title: 'Leave balance', content: 'Your remaining days, by type.', target: '#leave-card', placement: 'right' }, ], }); host.addEventListener('aui-finish', () => { host.dataset.seen = 'true'; }); void tour.start();}Using Angular? See Tour for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”Tour.create(host: HTMLElement, options: TourOptions): TourGlobal configuration key: tour (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
steps |
readonly TourStep[] |
The steps: { id, title, content?, target?, placement?, spotlightPadding?, onBeforeShow? }. target is an Element, a CSS selector, a function returning an Element, or null for a centered step. Required. | |
dots |
boolean |
"false" |
Show decorative progress dots under the content. |
skippable |
boolean |
"true" |
Show the Skip button (hidden on the last step). |
keyboardNavigation |
boolean |
"true" |
Arrow keys move between steps while focus is on the panel or its buttons (mirrored in RTL). |
modal |
boolean |
"false" |
Each step is a modal dialog: focus is trapped and the page is blocked. Globally configurable. |
closeOnEscape |
boolean |
"true" |
Escape skips the tour. Globally configurable. |
showProgress |
boolean |
"true" |
Show the ‘2 of 5’ progress text. Globally configurable. |
spotlight |
boolean |
"true" |
Dim the page around the target. Globally configurable. |
spotlightPadding |
number |
"8" |
Space between the target and the spotlight edge, px (0 to 64). Globally configurable. |
locale |
string |
"en-US" |
Locale of the button labels and progress text. Globally configurable. Inherited from common configuration. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
The host element (holds the overlay and panel). |
panel |
HTMLDivElement |
The step panel (role=dialog, manual popover). |
options |
Readonly<TourOptions> |
Current options. |
steps |
readonly TourStep[] |
The steps. |
active |
boolean |
True while a step is shown. |
index |
number |
Index of the shown step, or -1 when inactive. |
target |
Element | null |
The element the current step points at (null for a centered step or when inactive). |
Methods
Section titled “Methods”| Method | Description |
|---|---|
start(index?: number): Promise<void> |
Start (or restart) at index (default 0); steps with a missing target are skipped. |
next(): Promise<void> |
Show the next available step; on the last step, finish. |
back(): Promise<void> |
Show the previous available step. |
goTo(index: number): Promise<void> |
Show the step at index (starts the tour when inactive). |
skip(reason?: 'skip-button' | 'escape' | 'programmatic'): void |
End the tour early and emit aui-skip. |
finish(): void |
End the tour as completed and emit aui-finish. |
update(options: Partial<TourOptions>): void |
Merge and apply options; an active tour re-renders the current step. |
destroy(): void |
End the tour without events and remove rendering and listeners. |
Events
Section titled “Events”| Event | Detail | Bubbles | Cancelable | Description |
|---|---|---|---|---|
aui-start |
TourStartDetail |
Yes | No | The tour started: { index } of the first shown step. |
aui-step-change |
TourStepChangeDetail |
Yes | No | A step is shown: { index, stepId, previousIndex, direction }. |
aui-step-missing |
TourStepMissingDetail |
Yes | No | A step was skipped because its target is missing, hidden, or its hook failed: { index, stepId, reason }. |
aui-finish |
TourFinishDetail |
Yes | No | The tour ended at its end: { index, completed } (completed is false when no later step could be shown). |
aui-skip |
TourSkipDetail |
Yes | No | The tour was skipped: { index, stepId, reason }. |
Content areas
Section titled “Content areas”| Area | Description |
|---|---|
steps[].content |
Step text, or a Node the application owns (inserted as given). |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-tour |
Host (display: contents). |
aui-tour--modal | --centered | --no-spotlight | --static |
Modal steps, a step without a target, no spotlight, animation off. |
aui-tour__overlay |
Top-layer overlay that holds the spotlight (aria-hidden). |
aui-tour__spotlight |
Cut-out around the target; its shadow dims the page. |
aui-tour__panel |
Step dialog (manual popover). |
aui-tour__title |
Step heading. |
aui-tour__content |
Step content. |
aui-tour__progress |
Progress text. |
aui-tour__dots | __dot | __dot--active |
Progress dots. |
aui-tour__footer | __nav |
Button row. |
aui-tour__skip | __back | __next | __finish |
The buttons (Next becomes Finish on the last step). |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-border-width | --aui-color-backdrop | --aui-color-border | --aui-color-border-strong | --aui-color-focus-ring | --aui-color-primary | --aui-color-surface | --aui-color-text | --aui-color-text-muted | --aui-duration-fast | --aui-duration-normal | --aui-easing-standard | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-lg | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-semibold | --aui-line-height-normal | --aui-line-height-tight | --aui-radius-lg | --aui-radius-md | --aui-shadow-lg | --aui-space-1 | --aui-space-2 | --aui-space-4
TypeScript definitions
type TourTarget = Element | string | (() => Element | null) | null;type TourDirection = 'forward' | 'backward' | 'jump';interface TourConfig { modal: boolean; closeOnEscape: boolean; showProgress: boolean; spotlight: boolean; spotlightPadding: number }interface TourStep { id: string; title: string; content?: string | Node; target?: TourTarget; placement?: Placement; spotlightPadding?: number; onBeforeShow?: (step: TourStep, index: number) => void | Promise<void>;}interface TourOptions extends Partial<TourConfig> { steps: readonly TourStep[]; dots?: boolean; skippable?: boolean; keyboardNavigation?: boolean; locale?: string;}interface TourStartDetail { index: number }interface TourStepChangeDetail { index: number; stepId: string; previousIndex: number | null; direction: TourDirection }interface TourStepMissingDetail { index: number; stepId: string; reason: 'not-found' | 'hidden' | 'error' }interface TourFinishDetail { index: number; completed: boolean }interface TourSkipDetail { index: number; stepId: string; reason: 'skip-button' | 'escape' | 'programmatic' }Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: WAI-ARIA APG Dialog per step: a non-modal dialog by default (the page stays usable), or a modal dialog with aria-modal and a focus trap. Focus moves to the step dialog on every step and returns to the element that had focus before the tour.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| Tab / Shift+Tab | Step dialog | Move between the step’s buttons and content (trapped in modal mode). |
| Enter / Space | Button | Next, Back, Skip, or Finish. |
| ArrowRight / ArrowLeft | Step dialog or its buttons | Next and previous step (mirrored in RTL; keyboardNavigation). |
| Escape | Tour active | Skip the tour (closeOnEscape) and return focus. |
| Element | Role |
|---|---|
| panel | dialog |
| title | heading (h2) |
| buttons | button (native) |
| overlay | none (aria-hidden) |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-labelledby |
panel | the step title |
aria-describedby |
panel | the step content and the progress text |
aria-modal |
panel | true with modal |
aria-describedby |
target | adds the step content while the step is shown; removed afterwards |
aria-hidden |
overlay and progress dots | true (decorative) |
On every step, focus moves to the step dialog, which announces its title, content, and progress. When the tour finishes or is skipped, focus returns to the element focused before start(). In modal mode, Tab stays inside the step.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- Each step title should name the step on its own (screen readers announce it on every step).
- The non-modal default never blocks keyboard users from leaving the step with Tab; Escape skips the tour from anywhere.
- Missing targets are skipped silently for users; aui-step-missing tells the application.
- Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/tour |
51.9 kB | 17.5 kB | 15.5 kB | 1.0 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| Tour.create with 10 steps | < 2 ms average in headless Chromium |
| Step change (resolve target, position, focus) | < 16 ms (one frame) without onBeforeShow |
Tested scale: Up to 30 steps per tour; one active tour per page.
Two top-layer elements are created once; a step change resolves the target, writes text, and positions the panel. Spotlight and panel follow scrolling and resizing in one animation frame. Budget: under one frame per step change without onBeforeShow.
Measured run times: Performance.
Details
Section titled “Details”States
Inactive; active with an anchored step or a centered step; modal or non-modal; with or without spotlight; first step (no Back); last step (Finish, no Skip); with progress dots.
State transitions
| From | Trigger | To |
|---|---|---|
| inactive | start() / goTo() |
first available step; aui-start, aui-step-change |
| step n | Next, ArrowRight, next() |
next available step; aui-step-change |
| step n | Back, ArrowLeft, back() |
previous available step |
| any step | a target is missing | that step is skipped; aui-step-missing |
| last step | Finish, finish() |
inactive; focus restored; aui-finish |
| any step | Skip, Escape, skip() |
inactive; focus restored; aui-skip |
Accessibility notes
- Focus moves to the step dialog on every step, so its title, content, and progress are announced; when the tour ends, focus returns to the element focused before
start(). - The non-modal default never traps keyboard users; Escape skips the tour from anywhere.
- Write step titles that make sense on their own.
- The e2e axe run covers three themes with the tour open; manual screen-reader verification is pending.
Responsive behavior
The panel is at most 24rem wide and narrower on small viewports. It flips to the opposite side and shifts to stay inside the viewport, and scrolls when taller than the available space. Targets outside the viewport are scrolled into view (centered).
Right-to-left
-start and -end placements follow the writing direction, ArrowRight and ArrowLeft are mirrored, and the button row mirrors.
Theming
Text and progress colors are in the contrast gate in every theme; the spotlight ring and the current dot are checked as non-text contrast. In forced colors, shadows are not painted, so the spotlight is drawn as a Highlight outline and the panel border as CanvasText.
Global configuration
configureAbsoluteUI({ components: { tour: { modal: true, spotlightPadding: 4 } } });Component configuration
Instance options override configuration; changes apply to the shown step immediately.
Icons
None: the buttons are text buttons.
Security
Titles and string content are set as text. Node content is inserted as given. Selectors are validated when the tour is created. Positions are written through the CSSOM (custom properties and style.setProperty), never as style attributes, so the tour runs under a strict CSP.
Data handling
No persistence, network access, or telemetry. Store completion yourself (listen to aui-finish and aui-skip) so a tour starts only once.
Supported data scale
Up to 30 steps per tour; one active tour per page.
Edge cases
- A step whose target is missing, hidden (
display: none), or whoseonBeforeShowrejects is skipped in the current direction; going back past the first available step keeps the current step. - When no later step can be shown, the tour ends with
aui-finishandcompleted: false; when no step can be shown at all,start()shows nothing and emits onlyaui-step-missing. - Calling
start()while active restarts without a secondaui-start. update()that removes the current step finishes the tour.- Step changes are cancelled when a newer one starts (slow
onBeforeShowhooks never show an outdated step).
Errors
| Code | Category | Cause |
|---|---|---|
TOUR_OPTIONS |
configuration | Empty steps, a duplicate or blank id, a blank title, content that is not text or a Node, an invalid target or CSS selector, an unknown placement, a spotlight padding outside 0 to 64, a non-function hook, a non-boolean flag, or an index out of range. |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid or unknown configuration. |
Invalid options throw before the host is modified; an invalid update() leaves the previous state intact.
Known limitations
- One target per step; the spotlight is a rounded rectangle.
- In modal mode the spotlighted element is visible but not interactive.
- Selectors do not reach into closed shadow roots or iframes; pass a function instead.
- Manual screen-reader verification is pending.
Unsupported scenarios
- Steps that wait for an action on the target: listen to the target and call
next(). - HTML strings as content: pass a Node.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.