<Element />
Defines the Node for a given User Element
Reference#
Props#
isReact.ElementTypeThe User Element to renderidStringRequired if the <Element /> is being created inside a User ComponentcanvasbooleanIf true, a Canvas Node will be created.customRecord<string, any>Sets the Node's custom propertieshiddenbooleanSets the Node's hidden property. If true, this will hide the Node...elementPropsObjectThe props of the element specified in 'is'
Usage#
Configure Nodes in <Frame />#
Since the <Frame /> component creates a Node automatically for all of its children elements, thus the <Element /> component can be used to simply configure the values of the Node that is being created.
Defining Linked Nodes#
When used inside a User Component, <Element /> works identically as used inside <Frame /> but because there isn't a Node in-place, thus it has to create a new Linked Node - which is essentially a Node that is linked to the Node of the containing User Component via an arbitary id:
<Element />used inside User Component must specify anidprop
Examples#
Setting custom properties#
User Components may consume custom properties from their corresponding Node. These properties essentially act like additional props.
Let's say we have a Hero component that has a css custom property and as usual, we set its default values via the craft property.
Now, if you'd like to actually set these values when you call the component, you can do it like so: