1.0.3 • Published 3 years ago

vue-site-guide v1.0.3

Weekly downloads
17
License
MIT
Repository
-
Last release
3 years ago

vue-site-guide

Demo and documentation

Install

Yarn

yarn add vue-site-guide

NPM

npm i vue-site-guide

Props

config

Guide configuration

Type: Object

Accepted values:

Property nameTypeDefaultDescription
stepsArray[]Configuration of guide steps { selector: '', title: '', message: '' }
initialStepNumber0Index number of initial step
backdropClickToCloseBooleantrueClose guide by clicking outside of tooltip
prevButtonTextStringPrevThe text that will be shown on the button Previous
prevButtonClassString''CSS classes for the button Previous
prevButtonStyleObject{}Object with CSS properties and values for styling the button Previous
nextButtonTextStringNextThe text that will be shown on the button Next
nextButtonClassString''CSS classes for the button Next
nextButtonStyleObject{}Object with CSS properties and values for styling the button Next
skipButtonTextStringSkipThe text that will be shown on the button Skip
skipButtonClassString''CSS class name of the button Skip
skipButtonStyleObject{}Object with CSS properties and values for styling the button Skip
tooltipAlignStringcenterTooltip alignment relative to step
titleClassString''CSS classes for the tooltip title
titleStyleString''Object with CSS properties and values for styling the tooltip title
messageClassString''CSS classes for the tooltip message
messageStyleString''Object with CSS properties and values for styling the tooltip message
tooltipBgColorString''Background color of tooltip
tooltipRadiusString''Border radius of tooltip in CSS units
tooltipPaddingString''Padding of tooltip in CSS units
tooltipShadowString''Shadow of tooltip in CSS units
supportBgColorString''Background color of the step backdrop
supportRadiusString''Border radius of the step backdrop in CSS units
supportShadowString''Shadow of the step backdrop

Events

shown

Emitted after component has been shown to user

stepChanged

Emitted when currently step was changed

Payload

Current step index (after step was changed) Number

nextStep

Emitted when the user clicks Previous button

Payload

Current step index Number

prevStep

Payload

Current step index Number

beforeClose

Emitted immediately after the start of the closure of the guide

close

Emitted after the guide was closed

isBeginning

Emitted after the guide shown with initial-step is equal 0

isEnd

Emitted after the guide shown with initial-step is equal of index of the last step

reachBeginning

Emitted when guide reaches its initial step

reachEnd

Emitted when guide reaches its last step

Slots

default

Default slot used for pass the content

<vue-site-guide v-model="guide" :config="guideConfig">
  <div id="title">
    ...
  </div>
    
  <div id="start">
    ...
  </div>
    
  <div id="features">
    ...
  </div>
</vue-site-guide>

Scoped slots

buttonPrev

Slot for Previous button

Scope

NameTypeDescription
prevFunctionGo to previous step
canPrevBooleanSet false if step index number is 0

Example

<vue-site-guide :config="config" v-model="guide">
  <template #buttonPrev="{ prev, canPrev }">
    <button
      @click="prev"
      :disabled="!canPrev"
    >
      Back
    </button>
  </template>

  ...
</vue-site-guide>

buttonNext

Slot for Next button

Scope

NameTypeDescription
nextFunctionGo to next step
canNextBooleanSet false if step index number is equal of index number of the last step

Example

<vue-site-guide :config="config" v-model="guide">
  <template #buttonNext="{ next, canNext }">
    <button
      @click="next"
      :disabled="!canNext"
    >
      Forward
    </button>
  </template>

  ...
</vue-site-guide>

buttonSkip

Slot for Next button

Scope

NameTypeDescription
skipFunctionClose guide

{stepIndex}Title

Slot for tooltip title

Example

<vue-site-guide :config="config" v-model="guide">
  <template #0Title>
    <h2 style="color: #fff">
      Doc title
    </h2>
  </template>

  <template #1Title>
    <h2 style="color: #fff">
      Features
    </h2>
  </template>

  ...
</vue-site-guide>

{stepIndex}Message

Slot for tooltip message

Example

<vue-site-guide :config="config" v-model="guide">
  <template #2Message>
    <div style="margin-bottom: 8px;">
      About your features
    </div>
    <img 
      style="max-width: 100%; border-radius: 3px; margin-bottom: 12px;" 
      src="https://picsum.photos/seed/picsum/400/200"
      alt=""
    >
  </template>

  ...
</vue-site-guide>