0.3.0 • Published 7 years ago

react-nps-input v0.3.0

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
7 years ago

react-nps-input

Build Status NPM version

A lightweight React component for gathering Net Promoter Score surveys. See demo.

Installation

$ npm install react-nps-input --save

Usage

const React = require('react');
const NPSInput = require('react-nps-input');

const MyApp = React.createClass({
    onSubmit({ score }) {
        console.log(`Score for current user is ${score}/10`);
    },

    render() {
        return (
            <div>
                <NPSInput onSubmit={this.onSubmit}>{({ score }) => {
                    if (score >= 9) {
                        return <p>Awesome thank you!</p>;
                    } else {
                        return <p>Oh :(</p>;
                    }
                }}</NPSInput>
            </div>
        );
    }
})

Props

  • [Function] onSubmit: function to call when the user clicked on a score
  • [Function] onDismissed: function to call when the user clicked to dismiss the form
  • [String] service (Optional): name of the service for the introduction message
  • [Boolean] animated (Optional): show animation for apparition (default is true)
0.3.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago