Capabilities enable Tecton modules to communicate with the platform they're embedded in. Use Actions to trigger platform behaviors, and Sources to access platform data.
q2-tecton-sdk for features rendered inside of a platform configured with q2-tecton-platform. They are not available for design-system-only usecases.import tecton from 'q2-tecton-sdk';
await tecton.connect();
// Actions
tecton.actions.setTitle('My Page');
tecton.actions.navigateTo('/accounts');
// Sources
const locale = await tecton.sources.loc();
const canTransfer = await tecton.sources.canUser('transfer');Tecton modules render inside iframes, providing the security isolation needed when code from different teams and companies runs on the same page. This isolation introduces challenges:
Capabilities solve these challenges by providing a safe, reliable communication channel between modules and platforms.
All extensions must establish a connection to the platform:
import { connect } from 'q2-tecton-sdk';
const tecton = await connect();Once connected, Actions and Sources are available on the tecton object for use in your module. See below for examples of how to use them and a list of common capabilities provided by Tecton.
Actions trigger the platform to perform operations. Common categories:
showModal({ title, message }) - Display a modal dialogsetTitle(title) - Set the page titleprintWindow() - Print the current viewtecton.actions.showModal({
title: 'Greeting',
message: 'Hello! Welcome to the app.'
});Sources provide data from the platform to your module. Two patterns:
const isAllowed = await tecton.sources.canUser('viewAccounts');tecton.sources.languageChanged((newLanguage) => {
// Update UI for new language
});canUser(permission) - Check user permissionslanguageChanged(callback) - React to language changespromptForMFA({ message }) - Launch multi-factor authentication workflow