Configuration

Learn about all the configuration options available in MonkeyJs.

Tour Configuration

The main configuration object used when creating a new tour. It includes the controller configuration and popover builder configuration.

Tour Configuration

    
{
  controllerConfig: TourControllerConfig,  // Configuration for the tour controller
  tourConfig: PopoverBuilderConfig         // Configuration for the popovers
}
  

Controller Configuration

Configuration options for the tour controller.

TourControllerConfig

controller config
    
{
  steps: stepComponent[]  // Array of step configurations
}
  

stepComponent

    
{
  target: string,            // CSS selector for the target element
  title: string,             // Title of the step
  content: string,           // Content/description for the step
  placement?: string,        // Optional: Popover placement ('top', 'bottom', 'left', 'right')
  showArrow?: boolean,       // Optional: Whether to show an arrow pointing to the target
  showButtons?: boolean,     // Optional: Whether to show navigation buttons
  onNext?: () => void,       // Optional: Callback function when moving to next step
  onPrevious?: () => void,   // Optional: Callback function when moving to previous step
  onComplete?: () => void    // Optional: Callback function when completing the tour
}
  

Popover Configuration

Configuration options for the tour popovers.

PopoverBuilderConfig

    
{
  overlayConfig: OverlayBuilderConfig; // Configuration for the overlay
  progressBar: boolean;                // Show progress bar
  progressBarSteps: number;            // Number of steps in the progress bar
  nextBtnText: string;                 // Text for the next button
  prevBtnText: string;                 // Text for the previous button
  position: TPopoverPosition;          // Position of the popover
  offsetX: number;                     // Horizontal offset for the popover
  offsetY: number;                     // Vertical offset for the popover
  isArrowVisible: boolean;             // Show arrow on the popover
  isCloseBtnVisible: boolean;          // Show close button on the popover
}
  

Theme Configuration

Customize the appearance of the tour components.

ThemeType

    
{
  fontFamily: string;
  fontSize: string;
  textColor: string;
  popoverBgColor: string;
  popoverPadding: string;
  popoverBorderRadius: string;
  popoverBoxShadow: string;
  popoverBtnPadding: string;
  overlayColor: string;
  overlayOpacity: number;
  overlayRadius: string;
  overlayPadding: string;
  overlayStrokeWidth: number;
  ovelayStrokeColor: string;
  primaryBtnBgColor: string;
  primaryBtnColor: string;
  secondaryBtnColor: string;
  secondaryBtnBgColor: string;
  baseZIndex: number;
  overlayZIndex: number;
  arrowColor: string;
}
  

Example Configuration

Here's a complete example of configuring a tour:

tourConfig.js

    
const tour = new Tour({
  controllerConfig: {
    steps: [
      {
        target: '#step-1',
        title: 'Welcome',
        content: 'This is the first step of your tour!',
        placement: 'bottom',
        showArrow: true,
        onNext: () => console.log('Moving to next step')
      },
      {
        target: '#step-2',
        title: 'Features',
        content: 'Here you can find all the features.',
        placement: 'right',
        showArrow: true,
        onComplete: () => console.log('Tour completed')
      }
    ]
  },
  tourConfig: {
    className: 'my-custom-tour',
    zIndex: 1000,
    showOverlay: true,
    overlayOpacity: 0.5,
    animation: {
      duration: 300,
      easing: 'ease-in-out'
    }
  }
}, {
  colors: {
    primary: '#3b82f6',
    secondary: '#6366f1',
    text: '#1f2937',
    background: '#ffffff',
    overlay: '#000000'
  },
  borderRadius: '0.375rem',
  fontFamily: 'system-ui, -apple-system, sans-serif',
  spacing: {
    small: '0.5rem',
    medium: '1rem',
    large: '1.5rem'
  }
});