Creating a new section in the CMS
This guide applies only to stores using the CMS with FastStore versions 3 or 4. For stores using Headless CMS (legacy), please refer to this guide.
When your store requires a layout or behavior not natively available, you can create a new section component tailored to your brand or business rules. A section component gives you full control over the structure and content while integrating with the CMS.
In this guide, you'll learn how to create a new CallToAction section in your FastStore project.

A section is a type of component that contains other components and acts as a dynamic container in page layouts. For more details, see Understanding Components and Sections.
Before you begin
-
The CMS must be installed and enabled in your VTEX account. The CMS provides the Admin interface to configure and publish the CallToAction section you built in this guide.
-
The Content plugin must be installed on your machine.
Instructions
Step 1 - Creating the component
-
Open your store project in a code editor.
-
In the folder
src/components, create theCallToAction.tsxfile. -
Add the following code to the
CallToAction.tsxfile:_20import React from "react";_20_20export interface CallToActionProps {_20title: string;_20link: {_20text: string;_20url: string;_20};_20}_20_20export default function CallToAction(props: CallToActionProps) {_20return (_20<section>_20<h2>{props.title}</h2>_20<a href={props.link.url}>{props.link.text}</a>_20</section>_20);_20}_20_20CallToAction.$componentKey = 'CallToAction'; -
Export the
CallToActioncomponent in theindex.tsxfile._10…_10import CallToAction from './CallToAction'_10_10export default {_10…_10CallToAction_10} -
Create the file for the component that will be a section. In
cms/faststore/components, create thecms_component__CallToAction.jsoncfile. -
In the
cms_component__CallToAction.jsoncfile, add the following:_38{_38"$extends": [_38"#/$defs/base-component"_38],_38"$componentKey": "CallToAction",_38"$componentTitle": "Call To Action",_38"title": "Call To Action",_38"description": "Get your 20% off on the first purchase!",_38"type": "object",_38"required": [_38"title",_38"link"_38],_38"properties": {_38"title": {_38"title": "Title",_38"type": "string"_38},_38"link": {_38"title": "Link Path",_38"type": "object",_38"required": [_38"text",_38"url"_38],_38"properties": {_38"text": {_38"title": "Text",_38"type": "string"_38},_38"url": {_38"title": "URL",_38"type": "string"_38}_38}_38}_38}_38} -
Generate the final schema to add the new section. To do this, run the following command in a terminal:
_10vtex content generate-schema cms/faststore/components cms/faststore/pages -o cms/faststore/schema.json -
Open the
schema.jsonfile and check if the section was added to the section list. It should look similar to this:_10…_10{_10"$ref": "#/components/CallToAction"_10}_10…
Step 2 - Verify the component locally
Before syncing your changes with the CMS, run the storefront locally to confirm your new component compiles without errors. This catches typos, missing imports, and invalid schemas before you sync with the CMS.
-
In the project root, start the FastStore development server:
_10yarn dev -
Open the development server in your browser and check the terminal output for compilation errors related to
CallToAction.
The section won't render visually yet because it hasn't been added to any page in the CMS. This is done in Step 4. At this point, you're only verifying that the development server starts and that your component code, schema, and registration are valid.
If the development server starts successfully and reports no compilation errors, you're ready to sync your changes with the CMS.
Step 3 - Sync the changes with the CMS
Push the changes to sync with the CMS. Before doing it, make sure you're logged in to your VTEX account by running in the terminal the vtex login {accountName} command. Change the {accountName} to your store account, for example, vtex login mystore.
Push the schema generated to the CMS to reflect in the Admin. To do this, run the following command:
_10vtex content upload-schema -s faststore cms/faststore/schema.json
The
-s {storeId}parameter (in this case,faststore) specifies the store ID directly, so you won't be prompted to enter it when running the command.
Step 4 - Add the component to the CMS
-
In the Admin, open Storefront > Content, and click an Entry, such as Home, to check whether the component was added.

-
Add the component and complete its fields.
-
Click
Save. -
With the FastStore development server still running from Step 2, refresh to preview the CallToAction section rendered with the values you just configured.