Issue #2629Opened March 9, 2020by vitor-peixoto2 reactions

Is it possible to create a component using react components?

Question

is it possible to create or get a react component from some library and insert as a allowed component for create a template?

import React from 'react';
import CustomButton from './components/CustomButton'
import grapesjs from 'grapesjs'

const editor = grapesjs.init({
...
});

editor.addComponents(<CustomButton color="red" otherProp={...somepros}/>);

//or 

editor.BlockManager.add('CustomButton', {
  label: 'button',
  content: <CustomButton color="red" otherProp={...somepros}/>,
});

Answers (1)

pouyamiralayiMarch 9, 20202 reactions

@TRUEND here is an example Cheers!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.