Skip to content
decodecodeveloper docs
Storefront → Blocks → Retired Fresh runtime

Section

A Section represents a configurable UI element for a deco.cx site.

Retired product documentation — Fresh and the former admin are retired. These instructions are preserved for migration and historical reference. New projects use Blocks 7.x and Studio's Site Editor.

Retired Fresh / Deno reference. These instructions target the original Blocks runtime. The Studio Site Editor is documented separately; adopting it and migrating the framework are separate changes. Examples and screenshots here retain their original runtime context.

Sections are UI components built with Preact that can receive props configured by users on deco.cx's Admin. The Section local implementations live on the sections/ folder in the Site's code, but it's also possible to Install Apps.

Some examples of Sections for an ecommerce store would be:

  • ProductShelf.tsx: displays a product shelf with image, title and price.
  • Header.tsx: displays the standard header of the store, containing logo, menu categories and links for cart and login.
  • Banner.tsx: displays image, text and some Call to action for campaign or specific department.

Interactivity

Note that Sections run on the server-side only, so state and lifecycle such as useState, useEffect and callbacks such as onClick, onInput will not work. In order for those to work, you'll need to use interactive Islands

In deco.cx's Admin, it's possible to interact with Sections in two places:

  • Library: Allows developers to configure the properties of Sections and automatically see the generated UI. (Works similar to Storybook)
  • Pages: Allows Section to be added to Page on the site, also being configurable.

Further reading