Skip to content

(Component):add<Type>

Used to create a new component, but returns the parent component so it can be chained.

Synopsis

parentComponent = parentComponent:add<Type>(component)

Parameters

Type string
This is the component type that you want to create.
component Component
The initial values for the component, such as id.

Returns

parentComponent Component
Returns the caller table, so it can be chained

Examples

local list = tab:newList()
  :addText({ text = "My awesome List" })
  :addAlert({ text = "We can add siblings easily!" })
  :newContainer()
    :newCardBody()
      :addCardTitle({ text = "Card title" })
      :addCardText({ text = "Card Text" })
      :addCardFooter({ text = "Card Text" })
      .back
    .back
  :addText({ text = "The bottom of the list" })

See Also