1.0.2 • Published 2 years ago

@next-cafeteria/quick-intro v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

quick-intro

A small React wrapper around intro.js-react. The wrapper provides support for both steps and hints, persisting the walkthrough progress across screens using local storage.

Quicklinks

Example

You can find a small example here on codesandbox.io.

Installation

Install using Npm (don't forget to add the --save option if you're still using npm < 5):

$ npm i @next-cafeteria/quick-intro

Or Yarn:

$ yarn add @next-cafeteria/quick-intro

Make sure to have React & Intro.js installed (they're peer dependencies) and the Intro.js CSS definitions properly loaded into your project.

This would usually looks like:

import 'intro.js/introjs.css';

Usage

Two component are available for both steps and hints:

import { PersistentSteps, PersistentHints } from '@next-cafeteria/quick-intro';

PersistentSteps

Basic example:

<PersistentSteps
  steps={steps}
  title="My steps"
/>

Props

NameDescriptionTypeRequired
stepsAll the steps.Step[]
titleTitle of the tutorialString

Step

const steps = [
  {
    element: '.selector1',
    intro: 'test 1',
  },
  {
    element: '.selector2',
    intro: 'test 2',
  },
  {
    element: '.selector3',
    intro: 'test 3',
  },
];
NameDescriptionTypeRequired
elementCSS selector to use for the step.String
introThe tooltip content.String | React element

PersistentHints

Basic example:

<Hints
  hints={hints}
/>

Props

NameDescriptionTypeRequired
hintsAll the hints.Hint[]
onClickCallback called when a hint is clicked.Function ( )

Hint

const hints = [
  {
    element: '.selector1',
    hint: 'test 1',
  },
  {
    element: '.selector2',
    hint: 'test 2',
  },
];
NameDescriptionTypeRequired
elementCSS selector to use for the hint.String
hintThe tooltip text.String

QuickIntro.js options

NameDescriptionType
nextLabelNext button label.String
prevLabelPrevious button label.String
skipLabelSkip button label.String
doneLabelDone button label.String
hidePrevHides the Previous button in the first step.Boolean
hideNextHide the Next button in the last step.Boolean
tooltipClassCSS class of the tooltips.String
highlightClassCSS class of the helperLayer.String
exitOnEscExit by pressing Escape.Boolean
exitOnOverlayClickExit by clicking on the overlay layer.Boolean
showStepNumbersShow steps number in a red circle.Boolean
keyboardNavigationAllows navigation between steps using the keyboard.Boolean
showButtonsShow navigation buttons.Boolean
showBulletsShow bullets.Boolean
showProgressShow progress indicator.Boolean
scrollToElementEnables scrolling to hidden elements.Boolean
overlayOpacityOpacity of the overlay.Number
scrollPaddingPadding when automatically scrolling to an element.Number
positionPrecedencePrecedence of positions.String[]
disableInteractionDisables interaction inside elements.Boolean
hintPositionPosition of the hints.String
hintButtonLabelHint button label.String
hintAnimationEnables hint animations.Boolean

License

Licensed under the ISC License, Copyright © Next-Cafeteria.

See LICENSE for more information.

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago