• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Give your user a guided tour around your application

React User Tour

A component that allows you to give a user a guided tour around your application. Click here for a Demo!

Circle CI

Install

npm install react-user-tour

Props

active

A boolean value representing whether or not the tour should currently be displayed

step

An integer representing the current active step of the tour

onNext

function that fires when user clicks the Next button. Receives the next step integer as a callback. For example, if current step is 1 and user clicks the Next button, onNext(2) will be called.

onBack

function that fires when user clicks the Back button. Receives the previous step integer as a callback. For example, if current step is 2 and user clicks the Back button, onBack(1) will be called.

onCancel

function that fires when user clicks the X button or the Done Button.

steps

An array of steps. Each step object takes: step (integer), selector (CSS selector to be passed to document.querySelector()), title (a react element representing the header of the current step), and body (a react element representing the main body message of the tour step). Each step can also take an optional argument, position which will override the position of the tour component in relation to the selector that is determined by the application. Valid arguments for the position step are left , right, top, topLeft, bottom, and bottomLeft. Optional properties horizontalOffset and verticalOffset values allow to move tooltip around pointed element. You can control distance from the edge of pointed element by margin property (25 by default). It's not taken into account in case of top and bottom overrides.

style

Optional style object.

containerStyle

Optional style object for the top level component container.

buttonStyle

Optional style object for buttons displayed on component.

buttonContainerStyle

Optional style object for the container div around the buttons.

arrow

We provide an arrow that points to the selector, but you may optionally pass in your own React element in the place of the arrow provided.

arrowSize

If you choose to use the provided arrow, you can set the pixel size here with an integer value.

arrowColor

If you choose to use the provided arrow, you can set the color here by passing in a hex value.

nextButtonText

Text that will appear on the button that moves the tour forward. Defaults to Next

backButtonText

Text that will appear on the button that moves the tour backwards. Defaults to Back

doneButtonText

Text that will appear on the button that finishes the tour. Defaults to Done

closeButtonText

Text that will appear on the button that closes the tour. Defaults to Close

hideButtons

Boolean to disable the showing of next/back/done buttons. Set this to true if you want to insert your own buttons in the body.

hideClose

Boolean to disable the showing of the close text in the upper left of the component. Set this to true if you want to insert your own close functionality or if you would like to disable the ability for the user to prematurely exit the tour.

Use

import React, { Component }from "react";
import Tour from "react-user-tour";
export default class UserTour extends Component {
	constructor() {
		super();
		this.state = {
			isTourActive: false,
			tourStep: 1
		};
	}
	componentDidMount() {
		/* set state to active in cDM to make sure nodes being attached to have been mounted */
		this.setState({
			isTourActive: true
		});
	}
	render() {
		return (
			<div>
				<Tour
					active={this.state.isTourActive}
					step={this.state.tourStep}
					onNext={(step) => this.setState({tourStep: step})}
					onBack={(step) => this.setState({tourStep: step})}
					onCancel={() => this.setState({isTourActive: false})}
					steps={[
						{
							step: 1,
							selector: ".my-fun-website",
							title: <div style={{color: "blue"}}>My Web</div>,
							body: <div style={{color: "green"}}>Site</div>
						},
						{
							step: 2,
							selector: ".my-website-is-amazing",
							title: <div style={{color: "blue"}}>Wow</div>,
							body: <div style={{color: "yellow"}}>so good</div>
						}
					]}
				/>
			</div>
		);
	}
}

Copyright (C) 2017 Social Tables, Inc. (https://www.socialtables.com) All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

redux-unhandled-action

Redux middleware that logs an error to the console when an action is fired and the state is not mutated,
JavaScript
125
star
2

react-image-fallback

stop displaying broken images, have another image to fallback on.
JavaScript
111
star
3

react-infinity-menu

A react component that displays an unlimited deep menu
JavaScript
58
star
4

openfpc

A 2D CAD tool built on React, Three.js, and Immutable
JavaScript
51
star
5

graphql-test-generator

generate tests for graphql
JavaScript
29
star
6

saml-protocol

A framework-agnostic SAML protocol implementation for service and identity providers
JavaScript
16
star
7

2019-drawing-app-challenge

Make a drawing app! Challenge for prospective apprentices.
JavaScript
9
star
8

ST-UI-Toolkit

DEPRECATED - Old React Component Toolkit for ST
JavaScript
8
star
9

obj2json

Convert Wavefront .obj files to Three.js JSON format, using Blender
JavaScript
7
star
10

webgl-test-ci

Test your WebGL on CI(continuous integration)
JavaScript
7
star
11

apprentice-challenge

Social Tables Apprentice Challenge
JavaScript
7
star
12

drawing-app-challenge

Make a drawing app! A challenge for prospective apprentices.
JavaScript
7
star
13

chrome-prettier

HTML
7
star
14

connect-four

JavaScript
6
star
15

react-spectrum

react-color with a whole spectrum of bug fixes
JavaScript
5
star
16

filter-invalid-dom-props

A simple helper function to filter out invalid DOM properties
JavaScript
5
star
17

venue-app-challenge

Make a venue listing page! A challenge for prospective apprentices.
JavaScript
5
star
18

react-on-click-out

a component to execute a function when clicking outside of a node
JavaScript
4
star
19

catalyst

A framework to speed up and ease development in React.
JavaScript
4
star
20

react-should-show

a higher order component to control rendering of children
JavaScript
3
star
21

react-native-compose-styles

JavaScript
3
star
22

most-prs-merged

Simple Node Command-line app that uses Github SDK to generate a list of who merged the most PRs
JavaScript
3
star
23

detect-zoom

JavaScript
3
star
24

largest-rect-in-poly

JavaScript
3
star
25

create-webpack-split-point-atom

An atom plugin to use create-webpack-split-point
JavaScript
3
star
26

socket.io-store

Redis-backed store functionality, like socket.io pre-v1.x
JavaScript
3
star
27

NSString-STUnderCase

Convert an `NSString` from underscore_case to camelCase, and vice versa.
Ruby
2
star
28

maximal-rectangle

javascript module to solve the maximal rectangle problem.
JavaScript
2
star
29

create-webpack-split-point

abstract away creation of React Component that will be asynchronously loaded through System.import in componentDidMount
JavaScript
2
star
30

geometry-utils

utility functions for calculating 2D geometry. Used in api, maximal-rectangle
JavaScript
2
star
31

platform-challenge

Social Tables Intern Challenge
JavaScript
2
star
32

react-paged-table

React table component with in-memory paging
JavaScript
1
star
33

slambdack

Slack Helpers for AWS Lambda
JavaScript
1
star
34

docker-mysql57

MySQL 5.7 - Social Tables Style
1
star
35

docker-redis

Redis - Social Tables Style
1
star
36

socialtables.github.io

https://socialtables.github.io
JavaScript
1
star
37

offload

this is NOT a job queue
JavaScript
1
star
38

example-app

Example application for third-party app developers integrating with Social Tables
JavaScript
1
star
39

intern-challenge

Social Tables Intern Challlenge
JavaScript
1
star
40

whitesource-config

Configuration for Whitesource aka Mend security scanning
1
star