Create a component
webflow.registerComponent(name, root)
webflow.registerComponent(options)
Registers a new component definition with the specified name and root element or the specified options.
-
To create a component definition and insert it within an existing element, pass the name for the new component and the root element.
-
To create a component that is not inside any element, pass an object with the name for the new component and optionally a group and description. (Beta)
Syntax
Create a component in an existing root element:
Create a component that is not inserted onto the page (Beta):
Parameters
Creating within a root element:
name: string - The name of the component, which must not be empty and must be unique.root: AnyElement - The root element of the component.
Creating outside of a root element:
-
options: object - An object with these options:name: string - The name of the component, which must not be empty and must be unique.group: string - (optional) The group/folder to place the component in.description: string - (optional) A description for the component.
Returns
Promise< Component>
A Promise that resolves to the registered component.