Overlay Configuration
The overlay is the dark (or colored) backdrop that appears behind the highlighted element. Laravel Driver.js gives you full control over the overlay's appearance and behavior through fluent builder methods.
Setting the Overlay Color
DriverJs::overlayColor(string $color);Sets the overlay color. Accepts any valid CSS color value — hex, rgb, rgba, hsl, or named colors.
Example
DriverJs::tour('onboarding')
->overlayColor('#1a1a2e')
->step('#header', 'Welcome')
->render();Setting the Overlay Opacity
DriverJs::overlayOpacity(float $opacity);Sets the overlay opacity. Accepts a float value between 0.0 (fully transparent) and 1.0 (fully opaque). The default is 0.7.
Example
DriverJs::tour('onboarding')
->overlayColor('#000')
->overlayOpacity(0.8)
->step('#header', 'Welcome')
->render();Setting Stage Padding
DriverJs::stagePadding(int $padding);Sets the padding (in pixels) between the highlighted element and the stage cutout. A larger value shows more space around the element. The default is 10.
Example
DriverJs::tour('onboarding')
->stagePadding(20)
->step('#header', 'Welcome')
->render();Setting Stage Radius
DriverJs::stageRadius(int $radius);Sets the border radius (in pixels) of the stage cutout around the highlighted element. A larger value creates a more rounded cutout. The default is 5.
Example
DriverJs::tour('onboarding')
->stageRadius(15)
->step('#header', 'Welcome')
->render();Animating Transitions
DriverJs::animate(bool $animate = true);Enables or disables animation of the tour transitions between steps. When enabled, the overlay and popover will smoothly animate when moving between steps. The default is true.
Example
DriverJs::tour('onboarding')
->animate(false) // Disable animations for a snappy feel
->step('#header', 'Welcome')
->render();Smooth Scrolling
DriverJs::smoothScroll(bool $smooth = true);Enables smooth scrolling to the highlighted element when it's not visible in the viewport. The default is false (instant scroll).
Example
DriverJs::tour('onboarding')
->smoothScroll()
->step('#header', 'Welcome')
->step('#footer', 'Footer') // Will smooth scroll to footer
->render();Allowing Close
DriverJs::allowClose(bool $allow = true);Sets whether the tour can be closed by clicking the overlay or pressing the Escape key. Set to false to force users to complete the tour. The default is true.
Example
DriverJs::tour('mandatory-tour')
->allowClose(false)
->step('#header', 'Welcome')
->render();Overlay Click Behavior
DriverJs::overlayClickBehavior(string $behavior);Sets the action to perform when the overlay (backdrop) is clicked. Supported values: "close" (default), "nextStep", or a JavaScript callback.
Example
DriverJs::tour('onboarding')
->overlayClickBehavior('nextStep') // Click overlay to advance
->step('#header', 'Welcome')
->render();Complete Overlay Configuration Example
DriverJs::tour('onboarding')
->overlayColor('#1a1a2e')
->overlayOpacity(0.85)
->stagePadding(15)
->stageRadius(10)
->animate(true)
->smoothScroll()
->allowClose(true)
->overlayClickBehavior('close')
->step('#header', 'Welcome!', 'This is the header.')
->step('#nav', 'Navigation', 'Navigate your app.')
->render();That's it! You're now equipped to configure the overlay using Laravel Driver.js.