npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-questionnaire

v1.1.0

Published

Simple react components for building a questionnaire or survey.

Downloads

14

Readme

logouestionnaire using React Components

This repo is a ReactJS based questionnaire it is intended to be modular and simple. It uses simple Twitter Bootstrap-based styling and simple CSS animations.

Embedding

If you want to embed on your website download the compiled file and add the following code to your website.

Then simply import the style and script files as shown (with the correct paths):

<script src="scripts/react-questionnaire.js"></script>
<link rel="stylesheet" href="styles/main.css">

You must define an element on the DOM with id set to questions

<div id="questions">
</div>

Getting started

Make sure you have all the node dependencies using npm install on the root directory of this project.

To make your own Questionnaire simply modify the questions.json provided.

The skippable property is used to define an array of questions that can skipped.

Questions will be displayed based on the question number provided as an id.

The question-typeproperty should be one of the following:

  • small-multiple-options: Used to display a small set of multiple options that could be selected with one or more answers.

  • small-unique-options: Used to display a small set of options but only one answer is selected.

  • small-text-input: Used to display a small text input that could be used to answer questions that need less than 100 characters.

Both the small-multiple-options and small-unique-options need to define the set of options in an array of objects that have:

  • A unique id
  • A description of the answer
  • A true or false value assigned to selected used to define if such option is selected as the default value.

The posturl is used to send the results, there is a sample server provided that uses NodeJS and SQLite3 to save the results.

To start the development server use gulp watch, it will open a browser window with the Questionnaire.

How to hack

If you want to personalize or create your own question types then this guide is for you.

First you need to understand the basic structure of the project.

  • app/scripts/ is where all the js live, everything is managed and compiled by babel and gulp.
  • app/styles/ is where all the styles (css or less) go, there is a bootstrap npm module used to give bootstrapy styling; but main.less overwrites some to give it a cleaner look.
  • app/images/ is self-explanatory.
  • app/configs/ is where both the questions.json a JSON that has both the description of the questionnaire and the configurations of the components, and the config.jsthat holds the variables that involve static configurations.

Inside app/scripts/

  • app/scripts/question-types here are all the React Components used to render the questions.

  • app/scripts/ui-lib small components that help build a better experience for the questionnaire.

  • app/scripts/store.js this is a simple function to store the question answers. The question-type components use it to store the answers as they need.

  • app/scripts/generate_questions.js this function generates the questions based from the questions.json.It generates an array of JSX elements that the Questionnaire Component then uses.

  • app/scripts/questionnaire.js this is the Questionnaire Component used to manage the logic behind displaying the questions and other components.

  • app/scripts/app.js Loads the configs from config.js and injects the question.json file to the Questionnaire Component.

License

MIT