- Add
Column Splittercomponent toAllowed Controlsof your main placeholder settings items. - Add your renderings to
Allowed Controlsofcolumnplaceholder settings item. - In Content or Experience Editor add
Column Splittercomponent to your main placeholder, use +/- buttons to add/remove column in Experience Editor - Set column sizes in component properties.
- Add your renderings to
columnplaceholder.
-
Prerequisite: Follow SXA Grid System with Sitecore JSS to configure grid system for your SXA Site. You only need to configure site settings items and grid system, changes to components, or pipelines described in this blog are not necessary. If you synchronized items from this repository, you can inherit your
/sitecore/content/{sxa tenant}/{sxa site}/Settingsfrom/templates/Feature/ColumnSplitter/My Site Settingstemplate and select proper grid system inGrid Mappingfield (for bootstrap you would need to also update Grid Definition item, more in the blog). -
Deploy code and pipelines configuration from this repository. Sync items serialized with Unicorn. Check
Feature.ColumnSplitter.Serialization.configfor serialization project settings. -
If you don't want to synchronize items, follow the instruction to create new ones:
-
Create Rendering Parameters Template item inheriting from
/sitecore/templates/Feature/Experience Accelerator/Page Structure/Rendering Parameters/ColumnSplitter.
-
Optionally add
_Standard Valuesitem for the template, with default column splitter values (e.g. two column split on desktop and one column on mobile). You can edit columns field using Raw values. -
Create new
Placeholder Settingsitem for placeholdercolumn, assign your renderings toAllowed Controlsfield.
-
Create
Json Renderingitem poiting to your JSS implementation:
-
-
Create and deploy equivalent JSS component. Implementation for React:
import React from 'react';
import { Placeholder } from '@sitecore-jss/sitecore-jss-react';
const ColumnSplitter = ({ rendering, params }) => {
const columns = params.EnabledPlaceholders?.split(',');
return (
<div className="row">
{columns?.map((value) => {
return (
<div key={value} className={`col ${params[`ColumnWidth${value}`]}`}>
<Placeholder name={`column-${value}`} rendering={rendering} />
</div>
);
})}
</div>
);
};
export default ColumnSplitter;



