MCPcopy
hub / github.com/GrapesJS/grapesjs / addComponent

Method addComponent

packages/core/src/dom_components/index.ts:502–504  ·  view source on GitHub ↗

* Add new components to the wrapper's children. It's the same * as 'cmp.getComponents().add(...)' * @param {Object|[Component]|Array } component Component/s to add * @param {string} [component.tagName='div'] Tag name * @param {string} [component.type=''] Type of the component. Ava

(component: ComponentAdd, opt: AddComponentsOption = {})

Source from the content-addressed store, hash-verified

500 * });
501 */
502 addComponent(component: ComponentAdd, opt: AddComponentsOption = {}): Component | Component[] {
503 return this.getComponents().add(component, opt);
504 }
505
506 /**
507 * Render and returns wrapper element with all components inside.

Callers 1

setComponentsMethod · 0.45

Calls 2

getComponentsMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected