Using the grapes cli to create a plugin
@arunkumar413 this issue must be posted at grapesjs-cliWhich of the following should be used to define components? you must define your components at `components.js file. loadComponents is the named import of that file. after that you must define your blocks inside blocks.js` file in order to expose your defined compo...
Read full answer below ↓Question
Hi Team,
I'm trying to use the grapes cli tool (https://github.com/artf/grapesjs-cli) to create a plugin to be used with a react project. The cli tool created blocks.js, components.js and an index.js files. The index.js file contains the below code:
export default (editor, opts = {}) => {
const options = {
...{
// default options
},
...opts
};
// Add components
loadComponents(editor, options);
// Add blocks
loadBlocks(editor, options);
// TODO Remove
editor.on("load", () =>
editor.addComponents(
`<div style="margin:100px; padding:25px;">
</div>`,
{ at: 0 }
)
);
Which of the following should be used to define components? Is the loadComponents used for loading the components defined in the components.js or adding the components?
- loadComponents(editor, options)
- editor.addComponents( )
- Or use the components.js file
Could you please make a few codesandboxes to helps us better understand on how to use grapesjs with react, jsx, UI tool kits such as material-UI etc,.
Thanks, Arun
Answers (2)
@arunkumar413 this issue must be posted at grapesjs-cli
Which of the following should be used to define components?
you must define your components at components.js file. loadComponents is the named import of that file.
after that you must define your blocks inside blocks.js file in order to expose your defined components for usage.
cheers!
Could you please make a few codesandboxes to helps us better understand on how to use grapesjs with react, jsx, UI tool kits such as material-UI etc,.
https://github.com/artf/grapesjs/issues/2370#issuecomment-550515205
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2376
using material UI with grapesjs
Hi Team, I'm trying to use the material UI components in with the grapes but the material UI components aren't rendering as expected (https...
Issue #3119
[QUESTION] How to create custom block made of grapesjs components?
Hi, i want to have custom blocks made of grapesjs components. I found solution how to add components: https://github.com/artf/grapesjs/issu...
Issue #1113
[QUESTIONS] New trait type is not working with rendered components?
Hello, thanks for the great framework. I'm trying to apply this to my project. I want to add a new trait for existing LINK '<a>' component....
Issue #3939
Disabled drag and drop in preview
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? v95Reproducible demo link https://codesandbo...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
GrapesJS vs Webflow vs Builder.io vs Puck: Which Visual Builder to Choose in 2026
A practitioner's 2026 comparison of GrapesJS, Webflow, Builder.io, and Puck — pricing, AI features, lock-in, and a one-line rule for picking the right one
Tutorial
Big news from DevFuture — we just repriced everything
Hey GrapesJS community 👋 we just repriced all prices on plugins.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.