githubEdit

Custom Navigation

By default, Cue.js provides intuitive "Next", "Back", "Skip", and "Done" buttons within the tooltip. However, you might want to customize their labels, hide them for certain steps, or even implement entirely custom navigation logic based on user actions outside the tooltip.

Cue.js offers flexible options and methods to achieve this.


1. Customizing Button Labels

The simplest form of customization is changing the text labels of the default navigation buttons. You can do this globally when initializing your Cue instance:

Option
Default Value
Description

nextLabel

'Next'

Text for the "Next" button.

prevLabel

'Back'

Text for the "Back" button.

skipLabel

'Skip'

Text for the "Skip Tour" button.

doneLabel

'Done'

Text for the "Done" button (on last step).

const cue = new Cue({
    nextLabel: 'Proceed →', // More engaging "Next" button
    prevLabel: '← Go Back', // Custom "Back" button
    skipLabel: 'No Thanks',      // A softer "Skip"
    doneLabel: 'All Set!'        // A friendly "Done"
});

cue.setSteps([
    // ... your tour steps
]);

cue.start();

2. Hiding Default Buttons

You might want to hide the standard navigation buttons if you require the user to perform a specific action on the highlighted element before proceeding, or if you're building completely custom navigation.

A. Hiding Globally

To hide buttons for the entire tour:

B. Hiding Per Step

To hide buttons only for specific steps:


3. Programmatic Tour Control

When you hide the default buttons or want to advance the tour based on user interactions outside the tooltip, you'll use Cue.js's public methods:

  • cue.nextStep(): Advances to the next step. If it's the last step, it completes the tour.

  • cue.prevStep(): Goes back to the previous step.

  • cue.exit(): Immediately stops the tour and removes all Cue.js elements.

  • cue.goToStep(index): Jumps directly to a specific step by its 0-based index.

A. Advancing on Custom Button Click

Imagine you have a custom "Got It!" button on your page, and you want clicking it to advance the tour.

B. Advancing on Form Input

You can make the tour advance only after a user interacts with a form field.

C. Exiting the Tour from Custom Controls

You can also create a custom "Exit Tour" button:

D. Jumping to Specific Steps

The cue.goToStep(index) method is useful for non-linear tours or if you want to allow users to navigate directly to certain parts of a long tour.


Next Steps

With control over tour navigation, you're ready to tackle more complex scenarios.

Last updated