https://github.com/termoxin/react-poll
The component for creating polls in React
https://github.com/termoxin/react-poll
beauty javascript jsx poll react ui widget
Last synced: 2 months ago
JSON representation
The component for creating polls in React
- Host: GitHub
- URL: https://github.com/termoxin/react-poll
- Owner: termoxin
- License: mit
- Created: 2019-06-04T15:07:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:24:50.000Z (over 3 years ago)
- Last Synced: 2025-06-07T04:37:37.360Z (about 1 year ago)
- Topics: beauty, javascript, jsx, poll, react, ui, widget
- Language: TypeScript
- Homepage:
- Size: 4.53 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
```sh
npm install @termoxin/react-poll
```
## Usage
**Using NPM**
1 . Require @termoxin/react-poll after installation
```js
import ReactPoll.Poll from "@termoxin/react-poll";
```
2 . Include semantic-css for styling component
```html
```
3 . Include @termoxin/react-poll component
```js
```
## EXAMPLE
[Example's code](https://github.com/termoxin/react-poll-examples/tree/master/src)
[Check demo](https://termoxin.github.io/react-poll-examples/)
## Options
Notes:
- The tooltip sets `type: fill` as **default** attributes. You don't have to add these options if you don't want to change the defaults
| Global | Type | Values | Description |
| --------- | :-----: | :----------- | :------------------------------------------------------------------------------------------------- |
| questions | Array | | These is an array to use for `` |
| type | string | arrows, fill | Poll type |
| logging | boolean | true, false | Logs switch on/off for `` component |
| name | string | | A name that's showing in logs (after each a completed poll, component creates a log in locaStorage |
**Data structure for questions**:
| Property | Type | Values | Description |
| ------------- | :---------------------- | :-------------------- | :--------------------------------------------------------------------------------------------- |
| id | number or string | | The question id |
| text | string | | The question text |
| type | string | fill, checkbox, radio | The question type |
| description | string | | The question description |
| answers | string or array | | The variety of answers |
| correctAnswer | string | | The answers. The data depends on question type(fill, radio - string, checkbox - Array) |
## Contributing
We welcome your contribution! Fork the repo, make some changes, submit a pull-request!