Is there an api or function to insert a value in a data-attribute in the canvas?
Hi @CoCreator-Frank I think the Trait docs page has already the answer to your questions (especially when we explain how to define a custom one). Here, for example, when you change the slider the value is passed to the component via onEvent and on onUpdate it takes the value from the component and passes it back to th...
Read full answer below βQuestion
Hey Grapes Community! I created a custom trait select field that fetches options from our db for <a> components... when <a>(link) is clicked in canvas, component settings displays and our select field is rendered...
I am looking for a solution to pass the selected value from our custom select field to the canvas. And to get value in canvas to insert in custom select field when component is clicked in canvas.
Thanks in advance
Answers (1)
Hi @CoCreator-Frank I think the Trait docs page has already the answer to your questions (especially when we explain how to define a custom one).
Here, for example, when you change the slider the value is passed to the component via onEvent and on onUpdate it takes the value from the component and passes it back to the slider
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1047
[BUG] Model not able to change after changing value in custom Select dropdown menu.
Hey, I'm using CDN link for grapes js from unpkg.com In my project, I've used custom trait as a drop-down select menu which changes HTML us...
Issue #2193
[QUESTION] Reset trait on edit the content of a custom component
Hi, I have a custom component which content can be changed by switching trait select options, but also can be edited similar to the text co...
Issue #2346
When a component is clicked is there a hook to know when the traits have rendered.
Hey Grapes Community, When a component is clicked from within canvas is there a hook or event to know when the traits have rendered in view...
Issue #1227
Re-render view in editor's canvas whenever Trait value changes
Is there any possible way in grapesjs that whenever a user changes the value of a Trait of a custom component the render function should li...
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
Building an AI-Assisted Document Engine with Next.js, GrapesJS, and the AI SDK
Transform your static template editor into an intelligent, generative design workspace with Vercel AI SDK, AI Elements and Next.js.
Tutorial
Ship to Production Faster: Whatβs New in GrapesJS Shadcn
Supercharge your page builder! GrapesJS Shadcn adds live drag previews, rich text / commands, dynamic data, and canvas presets to ship to prod faster.
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.