$ npm install react-nps
or
$ yarn add react-nps
import NPS from "react-nps";
Then in your render :
onClose = (event) => {
event.preventDefault();
this.setState({ open: false });
}
...
<NPS onClose={this.onClose} onSubmit={this.onSubmit} open={this.state.open} />
animated: boolean default true
: whether the panel is animated or notanimationDuration: number default 2
: duration of the animation in second - works only if animated istrue
message: string
: message displayed on the NPS componentonClose: function
: called when clicked on the close button or when a score is submittedonSubmit: function
: function called when a score is submittedopen: boolean default true
: whether the panel is open or notstyle: object
: the button style, possible keys are:backgroundColor
,backgroundActiveColor
,textColor
, andtextActiveColor
Initially inspired by react-nps-input