addTo(parent, [data_or_index])

Class: ToggleButton. Method inherited from UIComponent.

Description:

Adds this component to a parent container component. An optional index specifies the Z-order position at which to insert the component. It calls ContainerComponent > addChild.

Parameters:

Name Type Description

parent

ContainerComponent

The container component to which this component will be added.

[data_or_index]

number | object

An parameter to pass some extra data (such as Tab Name to add Panel to Tabs), or index at which to insert the child.

Returns:

Returns an instance of this component for chaining.

Type: this

Examples:

Adding a component at specified index

let checkbox = new CheckBox("Enabled checkbox").addTo(panel, 5).position(10, 15); // adds to panel and positions at (10,15) coordinates

Adding a component at specified index

let panel = new Panel().addTo(tabs, {text: "Registration", enabled: true, tooltip: "Create new account", icon: "images/user.png"});

Also See: