Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rrrapha/reactour

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rrrapha/reactour

Tourist Guide into your React Components

  • 1.9.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Reactour

Tourist Guide into your React Components

Demo

Edit 6z56m8x18k

This is a fork from: https://github.com/elrumordelaluz/reactour

Install

npm i --save reactour styled-components
yarn add reactour styled-components

From v1.8.6 styled-components it isn't bundled into the package.

Initialize

Add the Tour Component in your Application:

import Tour from 'reactour'

class App extends Component {
  // ...

  render  (
    <div>
      { /* other stuff */}
      <Tour
        steps={steps}
        isOpen={this.state.isTourOpen}
        onRequestClose={this.closeTour} />
    </div>
  )
}

const steps = [
  {
    selector: '.first-step',
    content: 'This is my first Step',
  },
  // ...
]

PropTypes

PropDescTypeDefaultIs Required
accentColorChange --reactour-accent color (helper number + dots)string#007aff
badgeContentFunction to customize Badge content (current, total) => {}func
childrenElements to appear after the Mask (need to be styled correctly to have a position and z-index higher than Mask)`nodeelem`false
classNameCustom class to add to the helperstring
closeWithMaskClose clicking the maskbooltrue
disableDotsNavigationIsn't possible to interact with helper dotsbool
disableInteractionIsn't possible to interact with highlighted elementsbool
disableKeyboardNavigationIsn't possible to interact with keyboard arrowsbool
getCurrentStepFunction triggered each time current step changefuncstep => { /* 'step' is the current step index */ }
goToStepProgrammatically change current stepnumber
highlightedMaskClassNameCustom class name for element which is overlaid target elementstring
inViewThresholdScroll element to show when is outiside viewport adding this threshold valuenumber
isOpenYou know…bool
lastStepNextButtonChange Next button in last step into a custom button to close the Tournode
maskClassNameCustom class to add to the maskstring
maskSpacePadding between elemente showed and masknumber10
nextButtonNext navigation button textnode
nextStepOverride default nextStep function to use a custom onefunc
onAfterOpenFunction triggered after openfunc() => { document.body.style.overflowY = 'hidden' }
onBeforeCloseFunction triggered before closefunc() => { document.body.style.overflowY = 'auto' }
onRequestCloseFunction triggered to closefunc
prevButtonPrev navigation button textnode
prevStepOverride default prevStep function to use a custom onefunc
roundedBeautify helper + mask with border-radius (in px)number0
scrollDurationSmooth scroll duration when positioning the target elementnumber1
scrollOffsetOffset when positioning the target elementnumbercalculates the vertical center of the page
showButtonsShow helper navigation buttonsbooltrue
showCloseButtonShow close buttonbooltrue
showNavigationShow helper navigation dotsbooltrue
showNavigationNumberShow number when hovers on each navigation dotsbooltrue
showNumberShow helper number badgebooltrue
showTooltipArrowShow tooltip arrows pointing to target elementbooltrue
startAtStarting step each time the Tour is opennumber
stepsArray of steps with info and props[view bellow]
updateValue to listen if a forced update is neededstring
updateDelayDelay time when forcing update. Useful when there are known animation/transitionsnumber1
steps: PropTypes.arrayOf(PropTypes.shape({
  'follow': PropTypes.bool, // Should the guide follow the element when scrolling
  'selector': PropTypes.string,
  'content': PropTypes.oneOfType([
    PropTypes.node,
    PropTypes.element,
    PropTypes.func,
  ]).isRequired,
  'position': PropTypes.oneOf(['top', 'right', 'bottom', 'left', 'center']),
  'action': PropTypes.func,
  'style': PropTypes.object,
  'stepInteraction': PropTypes.bool,
  'maskClickHandler': PropTypes.func,
})),

Steps example

const steps = [
  {
    selector: '[data-tour="my-first-step"]',
    content: ({ goTo, inDOM }) => (
      <div>
        Lorem ipsum <button onClick={() => goTo(4)}>Go to Step 5</button>
        <br />
        {inDOM && '🎉 Look at your step!'}
      </div>
    ),
    position: 'top',
    action: node => {
      node.focus()
      console.log('yup, the target element is also focused!')
    },
    style: {
      backgroundColor: '#bada55',
    },
  },
  // ...
]

Keywords

FAQs

Package last updated on 22 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc