Onboarding

Bootstrap 5 Onboarding plugin

Onboarding is a guide plugin to show users how to use your website

Responsive Onboarding plugin built with the latest Bootstrap 5. It is is a guide plugin to show users how to use your website.

Note: Read the API tab to find all available options and advanced customization


Basic example

To initialize Onboarding on your page simply add .onboarding class to the container of your steps and pass initialization options via data-mdb-attributes Specify steps by giving proper data-mdb-attributes with data-mdb-step, data-mdb-index and data-mdb-onboarding-content as required minimum


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Start options

Autostart

Onboarding can be auto initialized by passing data-mdb-auto-start attribute to the steps container element. User can set amount of time after which Onboarding will be trigger with data-mdb-start-delay option

Onboarding will start in: 3


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Event triggered start

Pass to data-mdb-start-trigger selector of element on which user will trigger data-mdb-start-event to start Onboarding.


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Backdrop options

Global backdrop

Backdrop for every step inside Onboarding can be set via data-mdb-backdrop and data-mdb-backdrop-opacity attributes


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Individual step backdrop

Indivudal backdrop options can be set with same data-mdb-backdrop and data-mdb-backdrop-opacity attributes as with global backdrop.


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Autoplay

Set data-mdb-autoplay and data-mdb-steps-duration to enable autoplay for every step inside container


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Autoscroll

Toggle auto scrolling into element that is outside the view with data-mdb-autoscroll attribute.


Scroll from this
... to that

Popover customization

Buttons and labels customization

You can change buttons styles and labels inside step popover via proper data-mdb-attributes. For more info visit API section


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Popover class

Add custom class for popovers by setting custom-class attribute and style it in your css sheet.


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Container example


Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.

Card image cap

Kate Smith

Graphic designer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.

Card image cap

Natalie Code

Backend developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.


Gallery

Card image cap
Card image cap
Card image cap
Card image cap
Card image cap
Card image cap
Card image cap

John Doe

Web developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.

Card image cap

Kate Smith

Graphic designer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.

Card image cap

Natalie Code

Backend developer

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus, ex, recusandae. Facere modi sunt, quod quibusdam.

Onboarding - API


Usage

Via data attributes


        <div class="onboarding"
            data-mdb-start-trigger="#onboarding-start"
            data-mdb-start-event="click">
          <button
            data-mdb-id="onboarding-start"
            data-mdb-step
            data-mdb-index="1"
            data-mdb-onboarding-content="Step 1">Click me</button>
          <div
            data-mdb-step
            data-mdb-index="2"
            data-mdb-onboarding-content="Step 2">Some content</div>
          <div
            data-mdb-step
            data-mdb-index="3"
            data-mdb-onboarding-content="Step 3">Some content</div>
        </div>
      

Via JavaScript


        <div id="js-example">
          <button
            data-mdb-id="onboarding-start">Click me</button>
          <div
            data-mdb-target="step-1">Some content</div>
          <div
            data-mdb-target="step-2">Some content</div>
        </div>
      

          const options = {
            steps: [
              {
              index: 1,
              onboardingContent: '1',
              target: 'step-1'
              },
              {
              index: 2,
              onboardingContent: '2',
              target: 'step-2'
            },
            ],
          startTrigger: '#onboarding-start',
          startEvent: 'click'
          }

          const myOnboarding = new Onboarding(document.getElementById('js-example'), options);
      

Via jQuery

Note: By default, MDB does not include jQuery and you have to add it to the project on your own.


        <div id="jquery-example">
          <button
            data-mdb-id="onboarding-start">Click me</button>
          <div
            data-mdb-target="step-1">Some content</div>
          <div
            data-mdb-target="step-2">Some content</div>
        </div>
      

          const options = {
            steps: [
              {
              index: 1,
              onboardingContent: '1',
              target: 'step-1'
              },
              {
              index: 2,
              onboardingContent: '2',
              target: 'step-2'
            },
            ],
          startTrigger: '#onboarding-start',
          startEvent: 'click'
          }

          $('#jquery-example').onbaording(options);
      

Options

Options can be passed via data attributes, JavaScript, or jQuery. For data attributes, append the option name to data-mdb-, as in data-mdb-start-trigger. Some attributes should be pinned directly to wrapper element and some can be used as both global or individual step attributes.

Global

Name Type Default Description
nextLabel String 'Next' Defines label for next step button inside popover element
prevLabel String 'Back' Defines label for previous step button inside popover element
skipLabel String 'Skip' Defines label for skip button inside popover element
finishLabel String 'Finish' Defines label for finish button inside popover element
pauseLabel String 'Pause' Defines label for pause button inside popover element when autoPlay,stepsDuration or step duration is set
resumeLabel String 'Resume' Defines label for resume button inside popover element when autoPlay,stepsDuration or step duration is set
btnMain String 'btn-main' Set class for main button style
btnClose String 'btn-close' Set class for skip and finish buttons
btnPause String 'btn-pause' Set class for pause control button
btnResume String 'btn-resume' Set class for resume control button
steps Array [] An array of items to create step elements. Each element should contain the required index and onboardingContent
startTrigger String '' Set selector for HTML element that will start Onboarding when startEvent occurs.
startEvent String '' Set event on startTrigger element which will start Onboarding, e.g. mouseover or click
autostart Boolean false Set Onboarding to start automatically after startDelay seconds
startDelay Number 0 Set time in seconds after which Onboarding will start. Use it with autoStart or startTrigger / startEvent combination
autoplay Boolean false Set automatic step change on or off. Use it in combination with stepsDuration
stepsDuration Number 0 Set time in seconds after which each step will automatically change to next
autoscroll Boolean false Defines whether window should automatically scroll into opened step position
startIndex Number 1 Set index from which Onboarding will start
debounce Number 300 Set time in miliseconds after which changing of steps via keyboard navigation will be possible
backdrop Boolean false Set show backdrop for step popover on or off
backdropOpacity Number 0.6 Set opacity for step popover backdrop element
autoFocus Boolean false Set auto focusing step popover element on or off
customClass String ' Adds user's custom class to popover element

Each individual step attribute will overwrite its global counterpart behavior.

Step

Name Type Default Description
nextLabel String '' Overwrites global nextLabel attribute for single step
prevLabel String '' Overwrites global prevLabel attribute for single step
skipLabel String '' Overwrites global skipLabel attribute for single step
finishLabel String '' Overwrites global finishLabel attribute for single step
pauseLabel String '' Overwrites global pasueLabel attribute for single step
resumeLabel String '' Overwrites global resumeLabel attribute for single step
btnMain String '' Overwrites global btnMain attribute for single step
btnClose String '' Overwrites global btnClose attribute for single step
btnPause String '' Overwrites global btnPause attribute for single step
btnResume String '' Overwrites global btnResume attribute for single step
onboardingContent String '' Set content for step element. Can receive HTML templates
index Number null Set index number for step element
target String | Null null Define selector for step element when creating Onboarding via JS
placement String 'bottom' Define placement of step popover. auto | top | bottom | left | right
title String '' Set title for step popover element. When no title given, popover shows progress indicator
backdrop Boolean | Null null Overwrites global backdrop attribute for single step
duration Number 0 Overwrites global stepsDuration attribute for single step
autoplay Boolean true Set step autoplay attribute to false to turn off global autoplay for this particular step

Methods

Name Parameters Description Example
open index Starts Onboarding on step set by the index key. Default is the first step. instance.open(1)
close Closes opened step popover. instance.close()
nextStep Opens next step popover. instance.nextStep()
prevStep Opens previous step popover. instance.prevStep()
pause Pauses Onboarding on current step when autoplay is on. instance.pause()
resume Resumes Onboarding on current step when autoplay is on. instance.resume()
dispose Removes the Onbaording instance. instance.dispose()
getInstance element Static method which allows to get the Onboarding instance associated with a DOM element. Onboarding.getInstance(element)

        const onboardingElement = document.getElementById('my-onboarding');
        const instance = Onboarding.getInstance(onboardingElement);
        instance.open();
      

Events

Name Description
start.mdb.onboarding Emitted when an Onboarding has started.
end.mdb.onboarding Emitted when the last step of the Onboarding has ended.
open.mdb.onboarding Emitted when a step element has opened.
close.mdb.onboarding Emitted when a step element has closed
next.mdb.onboarding Emitted when next step is about to be opened.
previous.mdb.onboarding Emitted when previous step is about to be opened.

          window.addEventListener('start.mdb.onboarding', () => alert('Onboarding has started'));
        

Import

MDB UI KIT also works with module bundlers. Use the following code to import this component:


        import Onboarding from 'mdb-onboarding';