Repeaters
Block repeater​
The BlockRepeater
component is a simple way to repeat blocks of content. Use Block
for wrapping fields.
- Component
- Component - advanced
- API schema
<BlockRepeater
field="blocks"
label="Content"
discriminationField="type"
>
<Block discriminateBy="content" label="">
...
</Block>
</Reapeater>
<BlockRepeater
field="blocks"
label="Content"
discriminationField="type"
sortableBy="order"
removalType="delete"
addButtonText="Add footer block"
>
<Block discriminateBy="content" label="">
...
</Block>
</BlockReapeater>
export class TodoList {
tasks = def.oneHasMany(Task, "todoList");
}
export class Task {
order = def.intColumn();
done = def.boolColumn();
content = def.stringColumn();
todoList = def.manyHasOne(TodoItem, "tasks");
}
Props​
Prop | Description |
---|---|
| string The name of the column in Contember schema where to store data. Required |
| ReactNode The label for the field. Required |
| string | SugaredRelativeSingleField Required |
| undefined | string The name of the column in Contember schema that is used to sort the options. |
| boolean |
| undefined | RemovelType |
| undefined | string |
Repeater​
The Repeater
component renders a repeater with given child components.
- Component
- Component - advanced
- API schema
<Repeater field="tasks" label="Todo list" orderBy="content">
<TextAreaField field="content" label="Task" />
</Reapeater>
<Repeater field="tasks" label="Todo list" sortableBy="order">
<CheckboxField field="done" label="Done" defaultValue="false" />
<TextAreaField field="content" label="Task" />
</Reapeater>
export class TodoList {
tasks = def.oneHasMany(Task, "todoList");
}
export class Task {
order = def.intColumn();
done = def.boolColumn();
content = def.stringColumn();
todoList = def.manyHasOne(TodoItem, "tasks");
}
Props​
Prop | Description |
---|---|
| string The name of the column in Contember schema where to store data. Required |
| ReactNode The label for the field. Required |
| undefined | string The name of the column in Contember schema that is used to sort the options. |
| undefined | string The name of the column in Contember schema that is used to order the options. |