Blocks attributes
You can do this editor.Blocks.get('text').set({ attributes: { class: 'my-custom-class' } })
Read full answer below โQuestion
const blocktext = blockManager.get('text').set({ label: 'Modified text', attributes: { } })
I want to add an attribute to the original text block, I want the attribute to give the user the option of giving the component, time to appear and disappear at another time.
My question is, what are the attributes that I can make use of? and does it work if I refer in the attribute to a javascript that allows him to do this function?
Answers (1)
You can do this editor.Blocks.get('text').set({ attributes: { class: 'my-custom-class' } })
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2417
API in Component not working after Deployment
Block.js => Component.js => We are able to call the API and it works in Deployment when we are passing the whole html with script, body, st...
Issue #894
Add a custom attribute
Hi everyone, I am creating new blocks, when I use the following method: editor.BlockManager.add(blockId, { label: blockLabel, content: {......
Issue #3207
Form is not submitting
I am trying to create as custom block. But the form is not submitting when i use components inside content. I am able to get all the form d...
Issue #1545
How I Get ID From Block?
Hi, i have my block and I get print in Div id results from my javascript class component... How i get ID from my block ??? editor.BlockMana...
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
GJS.Market Is Now Available for India ๐ฎ๐ณ
GJS.Market is expanding its global presence with a dedicated experience for developers, agencies, SaaS companies, and digital creators in India
Tutorial
How to Build an AI-Powered Page Builder with GrapesJS in 2026
What we learned building GJSDocs โ from simple AI text generation to structured, context-aware visual editing
Tutorial
How Much Does It Cost to Build a SaaS Page Builder in 2026?
How much does it cost to build a SaaS page builder in 2026? Explore realistic development costs, timelines, features, and how using GrapesJS can reduce
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.