Async steps
Async steps allow tours to wait for user actions or external events before proceeding. Unlike regular steps that users can navigate immediately, async steps require something to happen first - like submitting a form, clicking a specific button, or waiting for data to load.
How It Works
Async steps have three states:
Pending - Waiting for the user to start an action
Processing - The action is in progress
Success - The action is complete, can now continue
Basic Example
const tour: TourConfig = {
id: 'form-tour',
steps: [
{
id: 'fill-form',
type: 'async',
page: '/signup',
content: {
pending: {
targetElement: '#email-input',
title: 'Enter Your Email',
content: 'Type your email address and click Submit',
},
processing: {
targetElement: '#submit-button',
title: 'Processing...',
content: 'Validating your email',
},
success: {
targetElement: '#success-message',
title: 'Email Verified!',
content: 'Great! Now you can continue',
},
},
},
],
};Controlling Async Steps
Using Tour Helpers (Recommended)
The easiest way to control async steps is using tour helpers, which provide the correct event names automatically:
Manual Event Names
Alternatively, you can send events directly, the library is completely typed and should provide you with the correct event names.
Custom Event Names
You can customize the event names for better readability:
Common Use Cases
Waiting for Button Click
Form Submission
Data Loading
Navigation Behavior
During pending: Users can go back (if
canPrevisn't false)During processing: Navigation is typically disabled
During success: Users can continue to the next step
Default Event Names
If you don't specify custom event names, Tourista generates them based on the step ID:
Start:
START_[STEP_ID](e.g.,START_LOGIN)Success:
[STEP_ID]_SUCCESS(e.g.,LOGIN_SUCCESS)Failed:
[STEP_ID]_FAILED(e.g.,LOGIN_FAILED)
Complete Example
Best Practices
Clear instructions: Tell users exactly what action to take
Show progress: Use the processing state to show something is happening
Handle failures: Always implement the failed event to handle errors gracefully
Keep it simple: Don't overuse async steps - only when you really need to wait for user actions
Related Features
Navigation - Multi-page tours with async steps
Callbacks - Track async step transitions
Auto-Advance - Combine with async steps for complex flows
Last updated