Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-google-forms
Advanced tools
React component to use Google Forms in a React app.
Google Forms is great free option for creating forms and for data collecting purposes. It can be used to make surveys, quizzes or event registration sheets. It can be shared by sending a link. However, if you want to use Google Forms on your React app, the default option is embedding it with an HTML <iframe>
element which doesn't let you customize the form's style to better fit the style of your app.
This React component gets your Google Form using Google Form Restyler based on the form's URL and turns it into a fully customizable HTML <form>
.
Coming soon..
src
parameter out of the iframe element. This is the URL you will need later and should look something like this:https://docs.google.com/forms/d/e/..../viewform?embedded=true
On the command line, cd to the root of your project and run:
npm install react-google-forms
Import the component:
import RGF from 'react-google-forms'
Usa it like any normal React component:
<RGF config={formConfig} />
You must provide a config
object as a prop to the RGF component. The object can have the following properties:
Key | isRequired | Type | Description | Default value |
---|---|---|---|---|
formURL | true | String | Url to your Google Form. See Getting the form URL. | undefined |
loadingText | false | String(/JSX), | Text or JSX (e.g. custom spinner) to render while getting the form from Google Forms. | 'Loading' |
inputs | true | Array | Array of Objects describing the inputs in your Google Form. See Configuring inputs. | undefined |
submitButtonText | false | String | Text to be shown in the Submit button. | 'Submit' |
submitButtonAttributes | false | Object | Any additional HTML to be assigned to the submit button | undefined |
redirectURL | true | String | URL where to redirect onSubmit | undefined |
dev | false | Boolean | Use development mode or production mode | true |
attributes | false | Object | Any additional HTML attributes to be assigned to the form element. | undefined |
The config object requires an inputs
array describing the answer fields in your Google Form. The array should contain an object for each Google Forms answer field.
Key | isRequired | Type | Description |
---|---|---|---|
type | true | String | Type of the input. Supported types: checkbox/radio/select/text/textarea. |
options | See description | Array | Names/labels of the options. See Configuring input options. Required for checkbox/radio/select. |
attributes | false | Object | Any additional HTML attributes to be assigned to the input element. |
The inputs array requires an options
array describing the different options for certain input types. The array should contain an object for each option.
Key | isRequired | Type | Description | Default value |
---|---|---|---|---|
text | true | String | Text to be shown next to radio/checkbox or in the select menu | undefined |
labelPosition | false | String | Position of the label for radio/checkbox. Either 'left' or 'right'. | 'left' |
attributes | false | Object | Any additional HTML attributes to be assigned to input options. | undefined |
If you have encountered an error or have a suggestion on how to improve the code, please submit an issue.
If you're able to make the changes by yourself, feel free to do so and submit a pull request.
Licensed under the MIT License.
FAQs
React component to use Google forms in a React app
The npm package react-google-forms receives a total of 0 weekly downloads. As such, react-google-forms popularity was classified as not popular.
We found that react-google-forms demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.