Skip to content

Layouts

Storefront layouts define the visual structure of storefront pages — how product, catalog, and category pages arrange their content areas. Each layout is a Vue component that distributes content into named slots.

layouts/
├── product/
│   └── example-product/
│       ├── Main.vue
│       ├── type.ts
│       ├── settings/
│       │   ├── content.ts
│       │   ├── design.ts
│       │   └── translations.ts
│       └── assets/
├── catalog/
│   └── example-catalog/
│       ├── Main.vue
│       ├── type.ts
│       ├── settings/
│       │   ├── content.ts
│       │   └── design.ts
│       └── slots/
│           └── custom-bottom-bar/
│               ├── CustomBottomBar.vue
│               ├── server.ts
│               └── client.ts
└── category/
    └── example-category/
        ├── Main.vue
        ├── type.ts
        └── settings/
            ├── content.ts
            └── design.ts

Each layout directory must be placed under one of the three storefront page directories: product/, catalog/, or category/. A storefront page in your template is linked to a storefront layout — when a template page of type PRODUCT, CATALOG, or CATEGORY is defined, a corresponding layout must exist.

How Layouts Work

A layout is a Vue component (Main.vue) that uses named <slot> elements to define where the storefront places its built-in content areas. Each storefront page type has a predefined set of slot names.

Product layout example:

vue
<template>
  <div>
    <slot :name="Slot.TOP_BAR" />
    <div class="product-main">
      <slot :name="Slot.GALLERY" />
      <slot :name="Slot.SIDEBAR" />
      <slot :name="Slot.DESCRIPTION" />
    </div>
    <slot :name="Slot.REVIEW_LIST" />
    <slot :name="Slot.RELATED_PRODUCTS" />
  </div>
</template>

<script setup lang="ts">
import { ProductLayoutSlot as Slot } from '@lightspeed/crane-api';
</script>

Catalog layout with a custom slot:

vue
<template>
  <div>
    <slot :name="Slot.PRODUCT_LIST" />
    <slot :name="Slot.CUSTOM_SLOT" slot-id="custom-bottom-bar" />
  </div>
</template>

<script setup lang="ts">
import { CatalogLayoutSlot as Slot } from '@lightspeed/crane-api';
</script>

Storefront Pages

Each layout must be placed in a directory matching a storefront page type. The page type determines which slot names are available in the layout component. In the example layouts we might not include all slots that's available, for example,BOTTOM_BAR. You would need to manually add them if needed.

Product

Layouts under layouts/product/. Import ProductLayoutSlot from @lightspeed/crane-api.

Slot nameDescriptionRequired design settings
TOP_BARArea above the product detailsbreadcrumbsPosition, showNavigationArrows
GALLERYProduct image gallerygalleryLayout, showProductPhotoZoom, showAltTextAsDescription
SIDEBARSidebar alongside the galleryshowWeight, showAttributes, showProductDescription, showProductSku, showInStockLabel, showNumberOfItemsInStock, showQuantity, optionSize, optionShape, showOutlets, showDeliveryTime, showWholesalePrices, showReviewSection, favoritesEnabled, showShareButtons, showLoyalty, breadcrumbsPosition
DESCRIPTIONProduct description areashowWeight, showAttributes, showProductDescription
REVIEW_LISTCustomer reviewsshowReviewSection, showReviewsSectionInOneCardView
RELATED_PRODUCTSRelated product suggestionsNone
BOTTOM_BARArea below the product detailsNone
CUSTOM_SLOTPlaceholder for a custom slot componentNone

Catalog

Layouts under layouts/catalog/. Import CatalogLayoutSlot from @lightspeed/crane-api.

Slot nameDescriptionRequired design settings
PRODUCT_LISTProduct listing grid or listcategoryViewMode, productFiltersVisibleOnCatalogPages, productFiltersPositionOnCatalogPages, productFiltersOpenedByDefaultOnCategoryPage, productFiltersOrientationPosition, showSortViewAsOptions, productCardSpacingType, productCardLayout, imageAspectRatio, imageSize, productTitleBehavior, productSubtitleBehavior, productPriceBehavior, productListSwatchesProductOptionBehavior, productSkuBehavior, productBuyButtonBehavior, productRatingSectionBehavior, productRatingViewBehavior, showProductRatingAvg, showProductTotalNumberOfReview, showProductFrame, showProductImages, showAdditionalImageOnHover, categoryTitleBehavior
BOTTOM_BARArea below the product listshowFooterMenu, showSigninLink
CUSTOM_SLOTPlaceholder for a custom slot componentNone

Category

Layouts under layouts/category/. Import CategoryLayoutSlot from @lightspeed/crane-api.

Slot nameDescriptionRequired design settings
CATEGORY_TITLECategory heading areaNone
PRODUCT_LISTProduct listing grid or listcategoryViewMode, productFiltersVisibleOnCatalogPages, productFiltersPositionOnCatalogPages, productFiltersOpenedByDefaultOnCategoryPage, productFiltersOrientationPosition, showSortViewAsOptions, productCardSpacingType, productCardLayout, imageAspectRatio, imageSize, productTitleBehavior, productSubtitleBehavior, productPriceBehavior, productListSwatchesProductOptionBehavior, productSkuBehavior, productBuyButtonBehavior, productRatingSectionBehavior, productRatingViewBehavior, showProductRatingAvg, showProductTotalNumberOfReview, showProductFrame, showProductImages, showAdditionalImageOnHover, categoryTitleBehavior
BOTTOM_BARArea below the product listshowFooterMenu, showSigninLink
CUSTOM_SLOTPlaceholder for a custom slot componentNone

Layout Files

Each layout directory can contain the following files:

FileRequiredDescription
Main.vueYesVue component defining the layout structure
type.tsYesType definitions for content and design editors
settings/content.tsYesContent editor settings for the layout
settings/design.tsYesDesign editor settings for the layout
settings/translations.tsNoTranslation keys for the layout
assets/NoStatic assets used by the layout (images, icons)
slots/NoCustom slot components (see Slots)

ℹ️ No server/client entry points

Unlike sections, layouts do not have server.ts or client.ts entry points at their root. Only custom slots within a layout have their own server and client entry points.

The settings/content.ts, settings/design.ts, and settings/translations.ts files use the same editor factories and follow the same conventions as section settings. Refer to the section settings documentation for details:

Validation Errors

Crane validates your layouts during the build step. Below are the errors you may encounter and how to resolve them.

Layout Errors

ErrorCauseResolution
Store layout sectionId "..." must be one of: catalog, category, productLayout is placed in an invalid directoryMove the layout directory under product/, catalog/, or category/
Asset size ... exceeds threshold of ...A layout asset file exceeds 2 MiBReduce the file size or compress the asset
Slot "..." cannot be used because required design settings are missing: ...The layout uses a built-in storefront slot, but settings/design.ts does not define every design editor that slot needsCompare with the generated example layout and add the missing design settings
Store section with id "..." and page type "..." must have a corresponding layout definedA storefront page in your template has no matching layoutCreate a layout for the corresponding storefront page type

Schema Errors

ErrorCauseResolution
Unrecognized key(s) in objectExtra properties in the layout configurationRemove properties not defined in the schema

⚠️ Asset Size Limit

Each individual layout asset must not exceed 2 MiB. Oversized assets will cause a validation error during the build step.

Next Steps