Skip to content


Implements Telegram Mini Apps popup.


To initialize the component, use the initPopup function:

import { initPopup } from '@tma.js/sdk';

const [popup] = initPopup();

Opening New Popup

To open a popup, it is required to call the open method specifying popup properties: title, message, and a list of up to 3 buttons.

    title: 'Hello!',
    message: 'Here is a test message.',
    buttons: [{ id: 'my-id', type: 'default', text: 'Default text' }],
  .then(buttonId => {
      buttonId === null 
        ? 'User did not click any button'
        : `User clicked a button with ID "${buttonId}"`

console.log(popup.isOpened); // true

This method returns a promise, which will be fulfilled with the clicked button identifier. In the case where the user didn't click any button, the method will return null.


List of events, which could be tracked:

EventListenerTriggered when
changed() => voidSomething in component changed
changed:isOpened(value: boolean) => voidisOpened property changed

Methods Support

List of methods, which could be used in support checks: open

Released under the MIT License.