A script delcaration mistake at "Commponent & JS" documentation page.
The script is right above ps: you can use Discussions if you're not reporting a bug
Read full answer below ↓Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
irrelevant to the issue
Reproducible demo link
https://grapesjs.com/docs/modules/Components-js.html#basic-scripts
Describe the bug
Hey, rather than creating a pull request for such a small change, I share it here.
The introduction code in Basic Scripts at https://grapesjs.com/docs/modules/Components-js.html#basic-scripts misses a keyword, that may confuse or mislead new users as there is no other example of declaring component script on the page:
model: {
defaults: {
script,
should be:
model: {
defaults: {
script: script,
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (2)
The script is right above

ps: you can use Discussions if you're not reporting a bug
Thanks for reporting this, @bit-ocean.
The issue with A script delcaration mistake at "Commponent & JS" documentation page. appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modifications overlap, creating an inconsistent state.
What to try:
- Add a setTimeout wrapper to ensure the DOM has settled:
setTimeout(() => {
// your operation here
}, 0);
-
Check initialization order — make sure components are fully loaded before you interact with them
-
Use the editor's event system — listen to completion events:
editor.on('component:mount', (component) => {
// safe to interact with component here
});
Recommended next steps:
- Test with the latest GrapesJS version if you haven't
- Provide a minimal reproducible example (CodeSandbox) — this helps the team identify the root cause faster
- Include GrapesJS version, browser, and console errors in your report
Related Questions and Answers
Continue research with similar issue discussions.
Issue #5525
Performance issue when adding more than 20 classes to a single component
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge v119.0.2151.72 Reproducible demo link...
Issue #4384
index.d.ts says that components must be Backbone.Collection<Component> but the docs say Component[] is also accepted
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? AnyReproducible demo link https://grapesjs.c...
Issue #6250
Clone page prompt 'Converting circular structure to JSON'
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome 129.0.6668.101Reproducible demo link...
Issue #4000
Pasting a component in root body layer throws TypeError
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v89 Reproducible demo link https://...
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
GrapesJS vs Webflow vs Tilda (2026): Honest Comparison, Pricing & Which to Pick
GrapesJS vs Webflow vs Tilda compared head-to-head: real 2026 pricing, SEO features, code export, and which one actually fits your project
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.