Embark on embedding components within one another to construct and maintain intricate layouts more effectively. As an illustration, consider transforming a button into a component. Later on, you can embed this button component into various other components across your site. Placing it within your navigation component, hero section component, or feature card component grants you the flexibility to individually update each component in a centralized location and witness the changes cascade through every other instance.
This session will teach you:
- Techniques for embedding an existing component
- Procedure to design a new nested component from portions of an existing component
- Establishing links between nested component attributes and parent component attributes
Embedding an Existing Component
To embed an existing component within another component:
- Choose the desired component for placing another component
- Modify the primary component
- Access the Componentspanel (alternatively, utilize the keyboard shortcut Shift + A)
- Drag a component from the panel and release it into the selected component on the canvas or in the Navigator
Creating a New Nested Component from Existing Elements
To craft a fresh component within an existing component:
- Select the component where you wish to insert another component
- Modify the main component
- Select the desired element for conversion into a component
- Access the Stylepanel or the Element settingspanel
- Click the icon labeled “create component” at the panel’s top
- Name your new component and hit Create
Furthermore, it’s possible to generate a component from a parent element that already hosts a component, leading to a child component nested inside a parent component.
Aligning Nested Component Attributes with Parent Component Attributes
Upon embedding a component — which already features defined component attributes — within another component that also holds component attributes, the choice arises to link the nested component’s attributes to the parent component’s attributes. This paves the way for the nested component attributes to leverage altered values from the parent component instances.
For instance, envision having a card containing a header, body text, and a button. The card functions as a component, while the button element within the card serves as a component (i.e., a nested component). You retain the option to link the button text to any text within the card, provided that each element within the component comes with defined component attributes.
To establish connections between a nested component’s attributes and a parent component’s attributes:
- Select the parent component housing the nested component and modify its main component
- Modify the main component of the nested component that includes the element(s) requiring linkage to a parent component attribute
- Click on the element
- Navigate to the Element settingspanel and create an attribute
- Exit the main component of the nested component
- Move to the primary component of the parent component
- Access the panel on the right
- Click the purple “dot” icon adjacent to the attribute for linkage
- Select “Create & connect new attribute” and create an attribute
- Exit the main component of the parent component
- Choose the parent component’s instance
- Visit the panel on the right
- Allocate a value to the attribute
- Include or eliminate Workspace spots and members - April 15, 2024
- Centering box summary - April 15, 2024
- Store a site for future reference - April 15, 2024