Components and Dynamic Zones
Техническое руководство из исходного проекта Notty. Примеры, параметры и эксплуатационные ограничения.
Все редакцииОбновлено 2026-09-30
This guide describes how to use reusable component fields and dynamicZone fields in Notty CMS schemas and Content API payloads.
Data model
component: embeds one component schema (repeatable: false) or an array (repeatable: true).dynamicZone: array of blocks; each block must include__component.- Component/block
idis optional in API payloads and responses. - Current implementation stores component and dynamic zone values as JSON columns.
Component schema example
{
"uid": "shared.seo-meta",
"category": "shared",
"info": {
"displayName": "SEO Meta",
"description": "SEO metadata"
},
"attributes": {
"metaTitle": { "type": "string", "maxLength": 60 },
"metaDescription": { "type": "text", "maxLength": 160 }
}
}
Content schema example
{
"kind": "collectionType",
"info": {
"singularName": "page",
"pluralName": "pages",
"displayName": "Page"
},
"attributes": {
"title": { "type": "string" },
"seo": {
"type": "component",
"component": "shared.seo-meta"
},
"blocks": {
"type": "dynamicZone",
"components": ["blocks.hero", "shared.seo-meta"]
}
}
}
Content API examples
Create (POST /api/content/page)
{
"title": "Home",
"seo": {
"metaTitle": "Home page"
},
"blocks": [
{
"__component": "blocks.hero",
"title": "Welcome"
},
{
"__component": "shared.seo-meta",
"metaTitle": "Inline SEO"
}
]
}
Response (GET /api/content/page/:id)
{
"id": 1,
"title": "Home",
"seo": {
"metaTitle": "Home page"
},
"blocks": [
{
"__component": "blocks.hero",
"title": "Welcome"
},
{
"__component": "shared.seo-meta",
"metaTitle": "Inline SEO"
}
]
}
Update with block ids (PUT /api/content/page/:id)
{
"blocks": [
{
"id": 202,
"__component": "shared.seo-meta",
"metaTitle": "Updated first block"
},
{
"id": 101,
"__component": "blocks.hero",
"title": "Updated second block"
}
]
}
Update without block ids
{
"blocks": [
{
"__component": "shared.seo-meta",
"metaTitle": "No id block"
},
{
"__component": "blocks.hero",
"title": "No id block 2"
}
]
}
Update rules (id, no id, order)
idin component and dynamic zone items is optional.- If
idis sent, it is preserved in stored JSON and returned by API. - If
idis omitted, items are stored and returned withoutid. - Block order is exactly the order from the request array.
- On update, the full field value is replaced with the provided payload.
Validation rules
dynamicZonemust define non-emptycomponents.- Each
__componentin payload must be present incomponents. - Referenced component schemas must exist.
- Component field payload must match component attribute types and required constraints.
Источник: docs/components-dynamic-zones.md. Снимок документации исходного проекта. Технический справочник сохраняет язык оригинала.