Skip to content

Component

Get component instance

This method lets you to retrieve a component instance

Syntax
let componentInstance = await kf.app.page.getComponent(componentId);
Parameters
ParameterstypeDescription
componentIdStringUnique Id of Component

Returns a component instance with following methods

Refresh

This methods lets you to refresh the component.

Syntax
componentInstance.refresh();

Hide

This method hides a component from page

Syntax
componentInstance.hide();

Show

This method renders a component that has been hidden previously in a page.

Syntax
componentInstance.show();

Component Specific methods

OnMount

A lifecycle event for a component which will be called when component is mounted / re-mounted on page.

Syntax
componentInstance.onMount(listenerFunction);
Example
// Consider setting 2nd tab as active when tab component is mounted
componentInstance.onMount(() => {
// function logic goes here...
componentInstance.setActiveTab(2);
});

1. Tab

setActiveTab

The method can be used to set a specified tab index as active.

Parameters
ParameterstypeDescription
tabIndexNumberIndex of tab starting from 1
Syntax
componentInstance.setActiveTab(tabIndex);
Example
// To set 2nd tab as active
componentInstance.setActiveTab(2);