addLayoutChild()
Supported from API_LEVEL
4.0
. For API compatibility, please refer to API_LEVEL.
Adds a child node to the current widget.
Type
(child: UIWidget, index?: number) => void
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
child | UIWidget | Yes | Child widget instance to add |
index | number | No | Insertion position index |
Example
import { createWidget, widget } from '@zos/ui'
const container = createWidget(widget.VIRTUAL_CONTAINER)
const button = createWidget(widget.BUTTON)
// Add child node to the end of container
container.addLayoutChild(button)
// Add child node at specified position
container.addLayoutChild(button, 0)