Skip to content
Snippets Groups Projects
Select Git revision
  • 033e48d31ab8ab284a551b7b1798c108f0df5c4f
  • main default protected
2 results

README.md

Blame
  • eliott's avatar
    Eliott Sammier authored
    033e48d3
    History

    SurveyJS Quiz Widgets

    A repository of custom SurveyJS widgets used for quizzes.

    Available widgets

    Screenshot of gapfill-select widget

    Screenshot of gapfill-select widget

    Usage

    Each widget is its standalone file in src/widgets, as a JavaScript module. You can simply add it to your source files and import the widget object :

    import {gapfillSelectWidget} from "./widgets/gapfill-select.js";

    (If you don't want to use JS modules, you can also remove the export keywords and use it as a classic script file)

    Then, before loading your survey's model, register the widget into SurveyJS's custom widgets collection :

    Survey.CustomWidgetCollection.Instance.add(gapfillSelectWidget, gapfillSelectWidget.name);

    And voilà! You have a new question type, which can be used in your survey's JSON model just like a built-in type.

    The rest of the src directory is a simple example of how to use these widgets. For more info on custom widgets, see the SurveyJS documentation.