Section API
Sections are React components that have the capability to be rendered and interacted with the Storefront Customizer.
Sections allow you, as a developer, to create components that are editable by a Storefront editor and have a live preview of your component changing as you edit the Storefront. All your sections live in the /sections
folder of your project.
Creating a Section component
This component is like creating any React component, however, it has a custom prop and custom prototype that enables it to be an editable section. Let's take a look at its anatomy.
The cms
prop on the component will match up with your components Schema
fields. You can see that there is a text component on the Schema field named howdy
which becomes an input text field in the Customizer where its value can now be rendered through your React component. You can get a full list of supported fields in our documentation here.
Exporting your section
In your component's folder, you have an index.js
where you can export your component.
Registering your Section to the Customizer
The final step to start using your component is to register it in the index.js
of the /sections
folder. This will allow your component to be available in the Customizer.
import your section into
/sections/index.js.
Add it to the exports array.
Refresh the Customizer.
Additional Documentation
Last updated