@coxdev/cox-quiz
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

@coxdev/cox-quiz

Installation

npm i lit @coxdev/cox-quiz

Options

The configuration component can contain the following reactive properties:

  • question (required): An object or a JSON string
    • name: An string, The name for question
    • answers: An array of string
  • correctAnswer: An String

Example:

<cox-quiz question='{"name": "How old are you ??", "answers": ["15", "18", "24", "25"]}' correctAnswer="24"></cox-quiz>

Usage

Vanilla Js

index.html

<body>
  ...
  <!-- If you want to add a quiz. -->
  <cox-quiz question='{"name": "How old are you ??", "answers": ["15", "18", "24", "25"]}' correctAnswer="24"></cox-quiz>
  <script type="module">
    import "@coxdev/cox-quiz";
  </script>
</body>

Running

npm run dev

HTTP Server or Live Server

index.html

<body>
  ...
  <!-- If you want to add a quiz. -->
  <cox-quiz question='{"name": "How old are you ??", "answers": ["15", "18", "24", "25"]}' correctAnswer="24"></cox-quiz>
  <script type="module" src="node_modules/@coxdev/cox-quiz/build/cox-quiz.min.js"></script>
</body>

http-server Running

http-server [path] [options]

live-server Running

Right click to index.html file and choose 'Open with live server'

Readme

Keywords

Package Sidebar

Install

npm i @coxdev/cox-quiz

Weekly Downloads

1

Version

0.3.4

License

MIT

Unpacked Size

23 kB

Total Files

5

Last publish

Collaborators

  • coxdev