0.0.0-beta6 • Published 6 years ago

likert-react v0.0.0-beta6

Weekly downloads
43
License
MIT OR Apache-2.0
Repository
github
Last release
6 years ago

React Likert Scale

npm version

A react component for answering questionnaires according to the Likert scale in a graphical way.

React Likert scale example

Usage

import LikertScale from 'likert-react';
import React from 'react';
import { render } from 'react-dom';

const root = document.getElementById('app');

document.addEventListener('DOMContentLoaded', () => {
  const reviews = [
    { question: 'Code is readable' },
    { question: 'Tests are comprehensive' },
    { question: 'Webpack is configured well' }
  ];
  const onClick = (q, n) => console.info('question: ' + q + ' answer: ' + n);
  render(
    <LikertScale
      reviews={reviews}
      onClick={onClick}
    />, root)
});

Props

Propdescriptionrequireddefault
reviewsRepresents all the questions and their the currently chosen values. Follows the following format: { question: string, review: ?number ⫾ [number] }. If review is an array, frozen is automatically set to true and the average of the reviews is displayed.yesundefined
onClickA callback that gets triggered when an option is selected. Arguments passed to the callback: reviewQuestion: string, review: numbernoundefined
highlightColorColor used to highlight chosen answersno#3498db
separatorTypeThree options: dotted-line, striped and full-linenodotted-line
iconsAn array of React-components representing each number on the scale, ordered from lowest to highest. The answer scale goes from 1 to the amount of given icons. The components should be given unique keys.no5 smiley icons from Google
frozenSet to true to make the answers immutable.nofalse

SeparatorType Examples

full-line

full-line example

striped

striped example

0.0.0-beta6

6 years ago

0.0.0-beta5

7 years ago

0.0.0-beta4

7 years ago

0.0.0-beta3

7 years ago

1.0.0

7 years ago

0.0.0-beta2

7 years ago

0.0.0-beta1

7 years ago