GrapesJS Forms
This plugin adds some basic form components and blocks to help working with forms easier
New components: form input textarea select checkbox radio button label
Options
blocksWhich blocks to add, default:['form', 'input', 'textarea', 'select', 'button', 'label', 'checkbox', 'radio'](all),labelTraitMethodMethod trait label, default: 'Method',labelTraitActionAction trait label, default: 'Action',labelTraitStateState trait label, default: 'State',labelTraitIdID trait label, default: 'ID',labelTraitForFor trait label, default: 'For',labelInputNameInput name label, default: 'Input',labelTextareaNameTextarea name label, default: 'Textarea',labelSelectNameSelect name label, default: 'Select',labelCheckboxNameCheckbox name label, default: 'Checkbox',labelRadioNameRadio name label, default: 'Radio',labelButtonNameButton name label, default: 'Button',labelTraitNameName trait label, default: 'Name',labelTraitPlaceholderPlaceholder trait label, default: 'Placeholder',labelTraitValueValue trait label, default: 'Value',labelTraitRequiredRequired trait label, default: 'Required',labelTraitTypeType trait label, default: 'Type',labelTraitOptionsOptions trait label, default: 'Options',labelTraitCheckedChecked trait label, default: 'Checked',labelTypeTextText type label, default: 'Text',labelTypeEmailEmail type label, default: 'Email',labelTypePasswordPassword type label, default: 'Password',labelTypeNumberNumber type label, default: 'Number',labelTypeSubmitSubmit type label, default: 'Submit',labelTypeResetReset type label, default: 'Reset',labelTypeButtonButton type label, default: 'Button',labelNameLabelLabel type label, default: 'Label',labelFormForm type label, default: 'Form',labelSelectOptionSelect option type label, default: '- Select option -',labelOptionOption label, default: 'Option'categoryCategory label, default: 'Forms'
Download
- CDN
https://unpkg.com/grapesjs-plugin-forms
- NPM
npm i grapesjs-plugin-forms
- GIT
git clone https://github.com/artf/grapesjs-plugin-forms.git
Usage
Directly in the browser
<link href="path/to/grapes.min.css" rel="stylesheet"/>
<script src="path/to/grapes.min.js"></script>
<script src="path/to/grapesjs-plugin-forms.min.js"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
fromElement: 1,
container : '#gjs',
plugins: ['grapesjs-plugin-forms'],
pluginsOpts: {
'grapesjs-plugin-forms': {/* ...options */}
}
});
</script>
Modern javascript
import grapesjs from 'grapesjs';
import gjsForms from 'grapesjs-plugin-forms';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [gjsForms],
pluginsOpts: {
[gjsForms]: { /* options */ }
}
// or
plugins: [
editor => gjsForms(editor, { /* options */ }),
],
});
Development
Clone the repository
$ git clone https://github.com/artf/grapesjs-plugin-forms.git
$ cd grapesjs-plugin-forms
Install it
$ npm i
Start the dev server
$ npm start
License
BSD 3-Clause