Suggested Reading
You already know that it’s easy to create a configurable Section on deco.cx. In this post we’ll outline all the possible ways that you can declare theprops
types and how that
impacts the form we render on deco.cx’s Admin.
Customizing sections
Sections, as regular Preact components, acceptsprops
as their first argument and use those values in their markup to display texts,
images or configure some behavior.
Usually, these props
are passed in another component, but when you’re using
deco.cx these props are configured in the Admin, which makes it easy for
business users to change content in their Sites.
To declare how these props
will be configured you can use the Typescript
type, specifying which props and their respective type like string
,
number
, Array<T>
, etc..
Example:
- Section configuration in a deco.cx’s Site.
- Preview of section editing in Admin

Types accepted
The deco.cx editor accepts a subset of types Typescript for section configuration. This is the list of supported types in time:Native Types
string
number
object literal
array
string options
Special Types
Image
This type renders an image upload widget in the editor, making it possible for users to upload images from their own computer. The type is a wrapper forstring
, so the Section will get the URL of the
image that will be hosted on deco.cx servers.
Optional: deco.cx provides a component that optimizes
the image loading and can be used in conjunction with this property. Example:
Video
Similar to Image, properties with this type will be edited through a video upload widget. Example of use here.Enriching the editor
When using native types, the editor will use the prop’s name as the input Label by default. But it’s possible to customize this using JSDoc tags.- Example: Section code:
- Editor:

@title
, @description
,
@format
among others. For example, to accept emails only:
uri
, color
. You can read more about it in
the
annotations doc.