Copy and customize a component
With SXA, you can quickly create a copy of an SXA component by using the clone script. With a cloned component, you have an exact copy of the component definition item, rendering parameters template, data source templates, and branches. You copy the existing component, and you name and style it differently. This can be convenient, for example, when you want many Promo components that are all styled differently.
Before copying a component, we recommend that you add a new module for derivative components. This is to avoid that SXA updates overwrite the new component.
Add a new module
To add a new module:
-
Navigate to /sitecore/system/Settings, right-click Features or Foundation, and insert a new folder.
-
Right-click Features or Foundation, and then click Insert > Headless Module.
-
In the dialog box, enter a name and, in the Add to module group list, select the folder you've just created.
-
Click Proceed. The module is created.
Copy and customize a component
To copy and customize a rendering:
-
To clone the component that you want to use, navigate to /sitecore/Layout/Renderings/ and right-click the component that you want to clone.
-
Click Scripts, and click Clone Rendering.
-
In the Create derivative rendering dialog box, fill in the following fields:
Tab |
Field |
Description |
---|---|---|
General |
New rendering name |
Enter the name for the new component. |
Add to module |
Select the module the new component belongs to. | |
Rendering CSS class |
Enter the CSS class for the component. | |
Parameters |
Rendering Parameters |
Select the rendering parameters copy mode:
|
Datasource |
Datasource |
Select the data source copy mode:
|
After creating the copy of the component, make the component available in Pages, so that content authors can add the component to their webpages.