AddChildren

You will find here AddChildrenAction definition and its attributes details

What is it?

The AddChildrenAction class is responsible for adding - at the beginning or in the end - or changing all views that inherit from Widget and who accept children.

The AddChildrenAction structure is:

AttributeTypeRequiredDefinition
componentIdStringDefines the widget’s id, in which you want to add the views.
valueList<ServerDrivenComponent>Defines the list of children you want to add.
modeModeDefines the placement of where the children will be inserted in the list or if the contents of the list will be replaced. By default the set mode is APPEND.

Mode

It is an ENUM, which values are:

ValuesDefinition
APPENDAdds the view in the end of the children’s list.
PREPENDAdds the view on the beginning of the children’s list.
REPLACEReplaces all children of the widget.

How to use it?

Container(
    children = listOf(
        Button("AddChildren", onPress = listOf(
            AddChildrenAction(
                componentId = "containerId",
                value = listOf(
                    Text("New text added")
                ),
				mode = Mode.APPEND
            )
        ))
    )
).apply { id = "containerId" }

Last modified February 11, 2021: create content (#298) (43225e15)