All Projects → hugobarragon → react-quizzes

hugobarragon / react-quizzes

Licence: MIT license
A React.js solution that offers a UI for creating surveys, forms and quizzes.

Programming Languages

typescript
32286 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-quizzes

Formium
The headless form builder for the modern web.
Stars: ✭ 78 (+212%)
Mutual labels:  survey, form-builder
Surveyjs Nodejs
Sample NodeJS backend for SurveyJS: Survey Library and Survey Creator
Stars: ✭ 65 (+160%)
Mutual labels:  survey, form-builder
antd-react-form-builder
Example
Stars: ✭ 74 (+196%)
Mutual labels:  form-builder, antd
surveyjs angular cli
SurveyJS + Angular CLI Quickstart Template
Stars: ✭ 39 (+56%)
Mutual labels:  survey, form-builder
Angular Surveys
Angular survey / form builder inspired by Google Forms
Stars: ✭ 219 (+776%)
Mutual labels:  survey, form-builder
Surveyjs react quickstart
React QuickStart Boilerplate - SurveyJS: Survey Library and Survey Creator
Stars: ✭ 88 (+252%)
Mutual labels:  survey, form-builder
Survey Creator
Online Survey Creator / Form Builder. See it in action:
Stars: ✭ 497 (+1888%)
Mutual labels:  survey, form-builder
Forms
📝 Simple form & survey app for Nextcloud
Stars: ✭ 127 (+408%)
Mutual labels:  survey, form-builder
surveyjs vue quickstart
SurveyJS + Vue Quickstart Template
Stars: ✭ 96 (+284%)
Mutual labels:  survey, form-builder
react-jsonschema-formbuilder
No description or website provided.
Stars: ✭ 45 (+80%)
Mutual labels:  form-builder, antd
hotlist
今日热榜(前端)
Stars: ✭ 51 (+104%)
Mutual labels:  antd
research.package
A Flutter package implementing support for surveys like ResearchStack and ResearchKit
Stars: ✭ 43 (+72%)
Mutual labels:  survey
fofax
fofax is a command line query tool based on the API of https://fofa.info/, simple is the best!
Stars: ✭ 479 (+1816%)
Mutual labels:  survey
gutenberg-forms
The Next Generation WordPress Form Builder.
Stars: ✭ 98 (+292%)
Mutual labels:  form-builder
api-server
OpenSCRM是一套基于Go和React的高质量企业微信私域流量管理系统 。遵守Apache2.0协议,全网唯一免费商用。企业微信、私域流量、SCRM。
Stars: ✭ 981 (+3824%)
Mutual labels:  antd
CodeSignal-Practice Solutions
No description or website provided.
Stars: ✭ 28 (+12%)
Mutual labels:  antd
ui-nuclear-mobile
A configurable Mobile UI based on Antd Mobile and Vue
Stars: ✭ 61 (+144%)
Mutual labels:  antd
sexy form.rb
Dead simple HTML form field builder for Ruby with built-in support for many popular UI libraries such as Bootstrap
Stars: ✭ 38 (+52%)
Mutual labels:  form-builder
vue-survey-builder
Survey builder for vue.js applications
Stars: ✭ 103 (+312%)
Mutual labels:  survey
python-wifi-survey-heatmap
A Python application for Linux machines to perform WiFi site surveys and present the results as a heatmap overlayed on a floorplan
Stars: ✭ 231 (+824%)
Mutual labels:  survey

react-quizzes

MIT License npm version

Demo: Edit react-quizzesExample

"IMG"

React form builder and form delivery solution for admins and clients that makes forms easy peasy. Inspired by abandoned project: https://github.com/blackjk3/react-form-builder

Advantages:

  • Supports custom inputs
  • Rich text questions
  • Supports custom styles
  • Internationalization ISO'S
  • Internationalization on questions and answers
  • Internationalization on Builder
  • Centralized form builder and from delivery
  • Drag & Drop to order/sort questions on <QuizzBuilder/>

Installation

Install via NPM

npm install --save react-quizzes

Style

For components design we use, antd-design componentes and if you just need som simple things we provide the antd style just import it like this:
import "react-quizzes/lib/assets/antd.css"
For custom styling check Custom styles section

react-quizzes requires react and react-dom as peerDependency

QuizzBuilder

import { QuizzBuilder } from "react-quizzes" <QuizzBuilder onChange={(QuizzData)
=> console.log(form)} />

API

QuizzBuilder component objective is to provide the user a nice and smooth interface to build quizzes

Props Type Default Description
onChange Function `` will returns builded quizz in QuizzData type
initialValue QuizzData `` initial value to QuizzBuilder, useful if user wants to edit a saved quizz
toolBox QuizzToolBox default QuizzToolBox list of inputs to use, defaults to react-quizz but custom inputs can be supplied
language string en Language that QuizzBuilder will show
messages QuizzMessages default QuizzMessages Object with each language and each language with each text translation

Quiz

A component that provides the final user a quiz/form to fill

import { Quiz } from "react-quizzes" <Quiz data={Mockdata} onSubmit={(values) =>
console.log("form submited values", values)} />

API

Props Type Default Description
data QuizzData `` data to build the final user form to be filled
onSubmit Fucntion `` returns the submitted form values
submitButton boolean true shows/hides default submit button*
toolBox QuizzToolBox default QuizzToolBox list of inputs to use, defaults to react-quizz but custom inputs can be supplied
language string en Language that Quiz questions and options will show
messages QuizzMessages default QuizzMessages Object with each language and each language with each text translation
  • if submit button is hidden the default onSubmit will not work, you must implement a custom submit

Custom submit

There is a prop wrappedComponentRef that gives you access to make basically anything, reset form, set initial values change the values based on something....

wrappedComponentRef

import { Quiz } from "react-quizzes";

saveQuizRef = (quizRef) => {
  // saves Quizz component ref
  this.quizRef = quizRef;
};
// custom submit function
handleCustomSubmit = () => {
  const form = this.quizRef.props.form;
  form.validateFields((err, values) => {
    if (!err) {
      // if no errors, no errors means required answers are filled
      console.log("Received values of form: ", values);
      form.resetFields(); // resets form after recieveing values
    }
  });
};
<Fragment>
  <Quiz
    wrappedComponentRef={this.saveQuizRef}
    submitButton={false} // hides inside submit button
    data={Mockdata}
  />
  <Button onClick={this.handleCustomSubmit}>Custom Submit btn</Button>
</Fragment>;

Translations/Internationalization

New languages support can be added or replace the existing ones
Existing translations

Edit react-quizzesExample RU locale

import { QuizzBuilder } from "react-quizzes"
import { defaultMessages } from "react-quizzes/lib/translations/TranslatedText";

// existing keys can be found on above link
defaultMessages["pt"]={
  "toolbox.textinput.name": "Caixa de Texto",
  "confirm.action": "Tem a  certeza?",
  "btn.yes": "Sim",
  "btn.no": "Não",
  "btn.add": "Adicionar",
  ...
}
function App() {
    return <QuizzBuilder
            onChange={(form) => console.log(form)}
            language="pt"
            messages={toolBoxItems}
        />
}

Custom Inputs

Custom inputs can be added to Toolbox, but Toolbox already supplies a great variety of inputs, if you have a new input suggestions fell free to contact this library contributors.

The Toolbox is used on QuizzBuilder and Quiz, so if you created a form with custom input on QuizzBuilder supply the same toolbox to Quiz component so it can display the input

Existing Toolbox

How to add custom input

You just have to pass the prop toolBox and add your new entry to the existing toolbox items, or if you don't want to reuse the existing one just make your one

import { QuizzBuilder } from "react-quizzes"
import defaulttoolBox from "react-quizzes/ToolBox"
import { Avatar } from "antd";
// existing keys can be found on above link
cosnt toolbox=defaulttoolBox()
toolbox.push(
{
      key: "MyInput_",
      name: "toolbox.input.name", // id of translation
      questions: {
            "en": "How are you ?"
            ...
        },
      // description: "toolbox.headertext.description", // desciption under input on toolbox
      icon: <Avatar icon="line" />, // this will go to Dom so can be string|| jsx component
      field_name: "MyInput_", // will add a generated uuidv4
      Component: MyInput // component not instanciated
    }
)

function App() {
    return <QuizzBuilder
            onChange={(form) => console.log(form)}
            toolBox={toolbox}
        />
}

MyInput example

Example: [URL TO FILE]

Custom styles

Default style is supplied import "react-quizzes/lib/assets/antd.css"

but if you need a custom one follow antd-design guidelines and probably you will just want to use less to make it easier

Antd customize theme

License

MIT License

DEV

Start project

  npm i
  npm start

Compile lib for npm

Compile project

  npm i
  npm run compile

Deply lib for Github Pages

Start project

  npm i
  npm run deploy
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].