- Add
Column Splitter
component toAllowed Controls
of your main placeholder settings items. - Add your renderings to
Allowed Controls
ofcolumn
placeholder settings item. - In Content or Experience Editor add
Column Splitter
component to your main placeholder, use +/- buttons to add/remove column in Experience Editor - Set column sizes in component properties.
- Add your renderings to
column
placeholder.
-
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}/Settings
from/templates/Feature/ColumnSplitter/My Site Settings
template and select proper grid system inGrid Mapping
field (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.config
for 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 Values
item 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 Settings
item for placeholdercolumn
, assign your renderings toAllowed Controls
field. -
Create
Json Rendering
item 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;