TComponents. Container_A

new Container_A(parent, propsopt)

Container that can hold other components or HTML elements. It can be used to create row or column containers.

Parameters:
NameTypeAttributesDescription
parentHTMLElement

HTML element that is going to be the parent of the component

propsTComponents.ContainerProps<optional>
Example
const container = new TComponents.Container_A(document.body, {
  children: [new TComponents.Button(null, {})],
  box: true,
  width: '100%',
  height: '100%',
  classNames: ['flex-row', 'items-start', 'justify-start'],
  id: 'my-container'
});

Extends

Members

enabled :boolean

Updates the enabled state of the container component.

Type:
  • boolean
Example
const container = new TComponents.Container_A(document.body, {});
container.enabled = true;

Methods

cssItem(index, className, remove) → {void}

Add/remove a class to a specific child element. The index of the child element is the same as the index of the child element in the children array.

Parameters:
NameTypeDescription
indexnumber

Index of the child element to be styled.

classNamestring

Name of the class to be added (removed).

removeboolean

If true, the class will be removed.

Returns:
Type: 
void

cssItems(className, remove) → {void}

Add/remove a class to all child elements.

Parameters:
NameTypeDescription
classNamestring

Name of the class to be added (removed).

removeboolean

If true, the class will be removed.

Returns:
Type: 
void

(protected) defaultProps() → {TComponents.ContainerProps}

Returns the default values of class properties (excluding parent properties).

mapComponents() → {object}

Maps the components in the container.

Returns:

An object containing the mapped components.

Type: 
object

(async) onInit() → {Promise.<void>}

Initializes the component. This method is called after the component is created and added to the DOM.

Throws:

Throws an error if a child element cannot be found in the DOM.

Type
Error
Returns:
Type: 
Promise.<void>

onRender() → {void}

Renders the container and its children.

Returns:
Type: 
void

(static) loadCssClassFromString(css) → {void}

Add css properties to the component

Parameters:
NameTypeDescription
cssstring

The css string to be loaded into style tag

Returns:
Type: 
void
Example
Container_A.loadCssClassFromString(`
.t-component__container {
  max-width: inherit;
  max-height: inherit;
  width: 100% !important;
  height: 100% !important;
}

.t-component__container-disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.t-component__container-disabled > * {
  pointer-events: none;
}
`);