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

Is it possible to create a component using react components?

快速解答by pouyamiralayi2

@TRUEND here is an example Cheers!

Read full answer below ↓

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)

👍 Most helpfulpouyamiralayiMarch 9, 2020

@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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.