Mini Apps Integration β
Official Telegram Mini Apps Documentation
Field Mapping β
Event Handling β
The package provides a set of functions for event handling. By convention, the name of the functions consists of the prefix on
+ the name of the Telegram event in camelCase. So themeChanged
event turns into onThemeChanged
and so on. onEvent is also available if you prefer it instead.
import { useWebAppTheme } from 'vue-tg'
const { onThemeChanged } = useWebAppTheme()
onThemeChanged(() => {
// handle theme update
})
Mapping β
Event name | Handler |
---|---|
themeChanged | useWebAppTheme β onThemeChanged |
viewportChanged | useWebAppViewport β onViewportChanged |
mainButtonClicked | useWebAppMainButton β onMainButtonClicked |
backButtonClicked | useWebAppBackButton β onBackButtonClicked |
settingsButtonClicked | useWebAppSettingsButton β onSettingsButtonClicked |
invoiceClosed | useWebAppNavigation β onInvoiceClosed |
popupClosed | useWebAppPopup β onPopupClosed |
qrTextReceived | useWebAppQrScanner β onQrTextReceived |
scanQrPopupClosed | useWebAppQrScanner β onScanQrPopupClosed |
clipboardTextReceived | useWebAppClipboard β onClipboardTextReceived |
writeAccessRequested | useWebAppRequests β onWriteAccessRequested |
contactRequested | useWebAppRequests β onContactRequested |
biometricManagerUpdated | useWebAppBiometricManager β onBiometricManagerUpdated |
biometricAuthRequested | useWebAppBiometricManager β onBiometricAuthRequested |
biometricTokenUpdated | useWebAppBiometricManager β onBiometricTokenUpdated |
Managing event subscriptions β
By default, event handlers are automatically unsubscribed when the component is unmounted. But you can unsubscribe before that if you need to:
import { useWebAppTheme } from 'vue-tg'
const { onThemeChanged } = useWebAppTheme()
const handler = onThemeChanged(() => {
// handle theme update
})
// unsubscribe
handler.off()
You can also disable automatic unsubscribing completely:
import { useWebAppTheme } from 'vue-tg'
const { onThemeChanged } = useWebAppTheme()
const handler = onThemeChanged(
() => {
// handle theme update
},
{ manual: true },
)
// unsubscribe
handler.off()
WARNING
Please note that in manual
mode, you are responsible for managing subscription. If subscription is not managed properly, it can lead to memory leaks and other issues.
Components β
Alert β
A component that shows message in a simple alert with a 'Close' button when is rendered.
<script lang="ts" setup>
import { Alert } from 'vue-tg'
function handleAlertClose() {
// ...
}
</script>
<template>
<Alert message="Hello!" @close="handleAlertClose" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
message | string | true | The message to be displayed in the body of the alert popup. |
Events β
Name | Type | Description |
---|---|---|
close | () => void | Emits when the opened popup is closed. |
BackButton β
A component that enables the back button when is rendered.
<script lang="ts" setup>
import { BackButton } from 'vue-tg'
function handleBackButton() {
// ...
}
</script>
<template>
<BackButton @click="handleBackButton" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
visible | boolean | false | Shows whether the button is visible. Set to true by default. |
Events β
Name | Type | Description |
---|---|---|
click | () => void | Emits when the back button is pressed. |
BiometricManager β
A component that init the biometric manager when is rendered.
<script lang="ts" setup>
import { BiometricManager } from 'vue-tg'
const handleInit = () => {
// ...
}
</script>
<template>
<BiometricManager @init="handleInit" />
</template>
Events β
Name | Type | Description |
---|---|---|
init | () => void | Emits when the biometric manager is init. |
ClosingConfirmation β
A component that enables the confirmation dialog while the user is trying to close the Mini App.
<script lang="ts" setup>
import { ClosingConfirmation } from 'vue-tg'
</script>
<template>
<ClosingConfirmation />
</template>
Confirm β
A component that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons when is rendered.
<script lang="ts" setup>
import { Confirm } from 'vue-tg'
function handleConfirmClose(ok: boolean) {
// ...
}
</script>
<template>
<Confirm message="Hello?" @close="handleConfirmClose" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
message | string | true | The message to be displayed in the body of the confirm popup. |
Events β
Name | Type | Description |
---|---|---|
close | (ok: boolean) => void | Emits when the opened popup is closed. |
ExpandedViewport β
A component that expands the Mini App to the maximum available height when is rendered.
<script lang="ts" setup>
import { ExpandedViewport } from 'vue-tg'
</script>
<template>
<ExpandedViewport />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
force | boolean | false | Expands the viewport despite user interaction. Disables vertical swipes if supported. Set to false by default. |
MainButton β
A component that enables the main button when is rendered.
<script lang="ts" setup>
import { MainButton } from 'vue-tg'
function handleMainButton() {
// ...
}
</script>
<template>
<MainButton @click="handleMainButton" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
visible | boolean | false | Shows whether the button is visible. Set to true by default. |
disabled | boolean | false | Shows whether the button is disable. |
progress | boolean | false | Shows whether the button is displaying a loading indicator. |
text | string | false | Current button text. |
color | string | false | Current button color. |
textColor | string | false | Current button text color. |
Events β
Name | Type | Description |
---|---|---|
click | () => void | Emits when the main button is pressed. |
Popup β
A component that shows a native popup when is rendered.
<script lang="ts" setup>
import { Popup } from 'vue-tg'
function handlePopupClose(buttonId: string) {
// ...
}
</script>
<template>
<Popup message="Hello" @close="handlePopupClose" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
message | string | true | The message to be displayed in the body of the popup. |
title | string | false | The text to be displayed in the popup title. |
buttons | PopupButton[] β | false | List of buttons to be displayed in the popup. |
Events β
Name | Type | Description |
---|---|---|
close | (buttonId: string) => void | Emits when the opened popup is closed. |
ScanQr β
A component that shows a native popup for scanning a QR code when is rendered.
<script lang="ts" setup>
import { ScanQr } from 'vue-tg'
function handleScanResult(data: string) {
// ...
}
</script>
<template>
<ScanQr @result="handleScanResult" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
text | string | false | The text to be displayed under the 'Scan QR' heading. |
Events β
Name | Type | Description |
---|---|---|
result | (data: string) => void | Emits when the QR code scanner catches a code with text data. |
SettingsButton β
A component that enables the settings button when is rendered.
<script lang="ts" setup>
import { SettingsButton } from 'vue-tg'
function handleSettingsButton() {
// ...
}
</script>
<template>
<SettingsButton @click="handleSettingsButton" />
</template>
Props β
Name | Type | Required | Description |
---|---|---|---|
visible | boolean | false | Shows whether the button is visible. Set to true by default. |
Events β
Name | Type | Description |
---|---|---|
click | () => void | Emits when the settings button is pressed. |
Composables β
useWebApp β
// Hover to inspect type
import { useWebApp } from 'vue-tg'
Name | Description |
---|---|
initData | A string with raw data transferred to the Mini App, convenient for validating data. WARNING: Validate data from this field before using it on the bot's server. |
initDataUnsafe | An object with input data transferred to the Mini App. WARNING: Data from this field should not be trusted. You should only use data from initData on the bot's server and only after it has been validated. |
version | The version of the Bot API available in the user's Telegram app. |
platform | The name of the platform of the user's Telegram app. |
isVersionAtLeast | Returns true if the user's app supports a version of the Bot API that is equal to or higher than the version passed as the parameter. |
onEvent | A method that sets the app event handler. Check the list of available events. |
sendData | A method used to send data to the bot. When this method is called, a service message is sent to the bot containing the data data of the length up to 4096 bytes, and the Mini App is closed. See the field web_app_data in the class Message. This method is only available for Mini Apps launched via a Keyboard button. |
ready | A method that informs the Telegram app that the Mini App is ready to be displayed. It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded. Once this method is called, the loading placeholder is hidden and the Mini App is shown. If the method is not called, the placeholder will be hidden only when the page is fully loaded. |
close | A method that closes the Mini App. |
isReady | Boolean indicating if the app is ready. π customβ‘οΈ readonly reactive |
isPlatform | Function to check if the app is running on a specified platform. π custom |
isPlatformUnknown | Boolean indicating if the platform is unknown. π custom |
isFeatureSupported | Function to check if a specified feature is supported. π custom |
useWebAppBackButton β
// Hover to inspect type
import { useWebAppBackButton } from 'vue-tg'
Name | Description |
---|---|
isBackButtonVisible | Shows whether the button is visible. Set to false by default. β‘οΈ reactive |
onBackButtonClicked | Bot API 6.1+ A method that sets the backButtonClicked event handler. |
showBackButton | Bot API 6.1+ A method to make the button active and visible. |
hideBackButton | Bot API 6.1+ A method to hide the button. |
useWebAppBiometricManager β
// Hover to inspect type
import { useWebAppBiometricManager } from 'vue-tg'
Name | Type |
---|---|
isBiometricInited | Shows whether biometrics object is initialized. β‘οΈ readonly reactive |
isBiometricAvailable | Shows whether biometrics is available on the current device. β‘οΈ readonly reactive |
biometricType | The type of biometrics currently available on the device. Can be one of these values: - finger, fingerprint-based biometrics, - face, face-based biometrics, - unknown, biometrics of an unknown type. β‘οΈ readonly reactive |
isBiometricAccessRequested | Shows whether permission to use biometrics has been requested. β‘οΈ readonly reactive |
isBiometricAccessGranted | Shows whether permission to use biometrics has been granted. β‘οΈ readonly reactive |
isBiometricTokenSaved | Shows whether the token is saved in secure storage on the device. β‘οΈ readonly reactive |
biometricDeviceId | A unique device identifier that can be used to match the token to the device. β‘οΈ readonly reactive |
initBiometric | Bot API 7.2+ A method that initializes the BiometricManager object. It should be called before the object's first use. If an optional callback parameter was passed, the callback function will be called when the object is initialized. |
requestBiometricAccess | Bot API 7.2+ A method that requests permission to use biometrics according to the params argument of type BiometricRequestAccessParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user granted access. |
authenticateBiometric | Bot API 7.2+ A method that authenticates the user using biometrics according to the params argument of type BiometricAuthenticateParams. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the user authenticated successfully. If so, the second argument will be a biometric token. |
updateBiometricToken | Bot API 7.2+ A method that updates the biometric token in secure storage on the device. To remove the token, pass an empty string. If an optional callback parameter was passed, the callback function will be called and the first argument will be a boolean indicating whether the token was updated. |
openBiometricSettings | Bot API 7.2+ A method that opens the biometric access settings for bots. Useful when you need to request biometrics access to users who haven't granted it yet. Note that this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button) |
onBiometricManagerUpdated | Bot API 7.2+ A method that sets the biometricManagerUpdated event handler. |
onBiometricAuthRequested | Bot API 7.2+ A method that sets the biometricAuthRequested event handler. |
onBiometricTokenUpdated | Bot API 7.2+ A method that sets the biometricTokenUpdated event handler. |
useWebAppClipboard β
// Hover to inspect type
import { useWebAppClipboard } from 'vue-tg'
Name | Type |
---|---|
onClipboardTextReceived | Bot API 6.4+ A method that sets the clipboardTextReceived event handler. |
readTextFromClipboard | Bot API 6.4+ A method that requests text from the clipboard. The Mini App will receive the event clipboardTextReceived. If an optional callback parameter was passed, the callback function will be called and the text from the clipboard will be passed as the first argument. Note: this method can be called only for Mini Apps launched from the attachment menu and only in response to a user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button). |
useWebAppClosingConfirmation β
// Hover to inspect type
import { useWebAppClosingConfirmation } from 'vue-tg'
Name | Type |
---|---|
isClosingConfirmationEnabled | True, if the confirmation dialog is enabled while the user is trying to close the Mini App. False, if the confirmation dialog is disabled. β‘οΈ reactive |
enableClosingConfirmation | Bot API 6.2+ A method that enables a confirmation dialog while the user is trying to close the Mini App. |
disableClosingConfirmation | Bot API 6.2+ A method that disables the confirmation dialog while the user is trying to close the Mini App. |
useWebAppCloudStorage β
// Hover to inspect type
import { useWebAppCloudStorage } from 'vue-tg'
Name | Type |
---|---|
setStorageItem | Bot API 6.9+ A method that stores a value in the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z , a-z , 0-9 , _ and - are allowed. The value should contain 0-4096 characters. You can store up to 1024 keys in the cloud storage. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was stored. |
getStorageItem | Bot API 6.9+ A method that receives a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z , a-z , 0-9 , _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the value will be passed as the second argument. |
getStorageItems | Bot API 6.9+ A method that receives values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z , a-z , 0-9 , _ and - are allowed. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the values will be passed as the second argument. |
removeStorageItem | Bot API 6.9+ A method that removes a value from the cloud storage using the specified key. The key should contain 1-128 characters, only A-Z , a-z , 0-9 , _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the value was removed. |
removeStorageItems | Bot API 6.9+ A method that removes values from the cloud storage using the specified keys. The keys should contain 1-128 characters, only A-Z , a-z , 0-9 , _ and - are allowed. If an optional callback parameter was passed, the callback function will be called. In case of an error, the first argument will contain the error. In case of success, the first argument will be null and the second argument will be a boolean indicating whether the values were removed. |
getStorageKeys | Bot API 6.9+ A method that receives the list of all keys stored in the cloud storage. In case of an error, the callback function will be called and the first argument will contain the error. In case of success, the first argument will be null and the list of keys will be passed as the second argument. |
useWebAppHapticFeedback β
// Hover to inspect type
import { useWebAppHapticFeedback } from 'vue-tg'
Name | Type |
---|---|
impactOccurred | Bot API 6.1+ A method tells that an impact occurred. The Telegram app may play the appropriate haptics based on style value passed. Style can be one of these values: - light, indicates a collision between small or lightweight UI objects, - medium, indicates a collision between medium-sized or medium-weight UI objects, - heavy, indicates a collision between large or heavyweight UI objects, - rigid, indicates a collision between hard or inflexible UI objects, - soft, indicates a collision between soft or flexible UI objects. |
notificationOccurred | Bot API 6.1+ A method tells that a task or action has succeeded, failed, or produced a warning. The Telegram app may play the appropriate haptics based on type value passed. Type can be one of these values: - error, indicates that a task or action has failed, - success, indicates that a task or action has completed successfully, - warning, indicates that a task or action produced a warning. |
selectionChanged | Bot API 6.1+ A method tells that the user has changed a selection. The Telegram app may play the appropriate haptics. Do not use this feedback when the user makes or confirms a selection; use it only when the selection changes. |
useWebAppMainButton β
// Hover to inspect type
import { useWebAppMainButton } from 'vue-tg'
Name | Type |
---|---|
mainButtonText | Current button text. Set to Continue for the main button and Cancel for the secondary button by default. β‘οΈ reactive |
mainButtonColor | Current button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default. β‘οΈ reactive |
mainButtonTextColor | Current button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default. β‘οΈ reactive |
isMainButtonVisible | Shows whether the button is visible. Set to false by default. β‘οΈ reactive |
isMainButtonActive | Shows whether the button is active. Set to true by default. β‘οΈ reactive |
isMainButtonProgressVisible | Readonly. Shows whether the button is displaying a loading indicator. β‘οΈ reactive |
setMainButtonText | A method to set the button text. |
onMainButtonClicked | A method that sets the mainButtonClicked event handler. |
showMainButton | A method to make the button visible. Note that opening the Mini App from the attachment menu hides the main button until the user interacts with the Mini App interface. |
hideMainButton | A method to hide the button. |
enableMainButton | A method to enable the button. |
disableMainButton | A method to disable the button. |
showMainButtonProgress | A method to show a loading indicator on the button. It is recommended to display loading progress if the action tied to the button may take a long time. By default, the button is disabled while the action is in progress. If the parameter leaveActive=true is passed, the button remains enabled. |
hideMainButtonProgress | A method to hide the loading indicator. |
setMainButtonParams | A method to set the button parameters. The params parameter is an object containing one or several fields that need to be changed: text - button text; color - button color; text_color - button text color; has_shine_effect - Bot API 7.10+ enable shine effect; position - position of the secondary button; is_active - enable the button; is_visible - show the button. |
useWebAppNavigation β
// Hover to inspect type
import { useWebAppNavigation } from 'vue-tg'
Name | Type |
---|---|
onInvoiceClosed | Bot API 6.1+ A method that sets the invoiceClosed event handler. |
openInvoice | Bot API 6.1+ A method that opens an invoice using the link url. The Mini App will receive the event invoiceClosed when the invoice is closed. If an optional callback parameter was passed, the callback function will be called and the invoice status will be passed as the first argument. |
openLink | A method that opens a link in an external browser. The Mini App will not be closed. Bot API 6.4+ If the optional options parameter is passed with the field try_instant_view=true, the link will be opened in Instant View mode if possible. Note that this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button) |
openTelegramLink | A method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called. Up to Bot API 7.0 The Mini App will be closed after this method is called. |
switchInlineQuery | Bot API 6.7+ A method that inserts the bot's username and the specified inline query in the current chat's input field. Query may be empty, in which case only the bot's username will be inserted. If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field. You can specify which types of chats the user will be able to choose from. It can be one or more of the following types: users, bots, groups, channels. |
useWebAppPopup β
// Hover to inspect type
import { useWebAppPopup } from 'vue-tg'
Name | Type |
---|---|
onPopupClosed | Bot API 6.2+ A method that sets the popupClosed event handler. |
showAlert | Bot API 6.2+ A method that shows message in a simple alert with a 'Close' button. If an optional callback parameter was passed, the callback function will be called when the popup is closed. |
showConfirm | Bot API 6.2+ A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button. |
showPopup | Bot API 6.2+ A method that shows a native popup described by the params argument of the type PopupParams. The Mini App will receive the event popupClosed when the popup is closed. If an optional callback parameter was passed, the callback function will be called and the field id of the pressed button will be passed as the first argument. |
useWebAppQrScanner β
// Hover to inspect type
import { useWebAppQrScanner } from 'vue-tg'
Name | Type |
---|---|
showScanQrPopup | Bot API 6.4+ A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams. The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data. If an optional callback parameter was passed, the callback function will be called and the text from the QR code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed. Starting from Bot API 7.7, the Mini App will receive the scanQrPopupClosed event if the user closes the native popup for scanning a QR code. |
closeScanQrPopup | Bot API 6.4+ A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method. Run it if you received valid data in the event qrTextReceived. |
onQrTextReceived | Bot API 6.4+ A method that sets the qrTextReceived event handler. |
onScanQrPopupClosed | Bot API 7.7+ A method that sets the scanQrPopupClosed event handler. |
useWebAppRequests β
// Hover to inspect type
import { useWebAppRequests } from 'vue-tg'
Name | Type |
---|---|
onContactRequested | Bot API 6.9+ A method that sets the contactRequested event handler. |
onWriteAccessRequested | Bot API 6.9+ A method that sets the writeAccessRequested event handler. |
requestContact | Bot API 6.9+ A method that shows a native popup prompting the user for their phone number. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number. |
requestWriteAccess | Bot API 6.9+ A method that shows a native popup requesting permission for the bot to send messages to the user. If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access. |
useWebAppSettingsButton β
// Hover to inspect type
import { useWebAppSettingsButton } from 'vue-tg'
Name | Type |
---|---|
isSettingsButtonVisible | Shows whether the context menu item is visible. Set to false by default. β‘οΈ reactive |
onSettingsButtonClicked | Bot API 6.1+ A method that sets the settingsButtonClicked event handler. |
showSettingsButton | Bot API 7.0+ A method to make the Settings item in the context menu visible. |
hideSettingsButton | Bot API 7.0+ A method to hide the Settings item in the context menu. |
useWebAppShare β
// Hover to inspect type
import { useWebAppShare } from 'vue-tg'
Name | Type |
---|---|
shareToStory | Bot API 7.8+ A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL. An optional params argument of the type StoryShareParams describes additional sharing settings. |
useWebAppTheme β
// Hover to inspect type
import { useWebAppTheme } from 'vue-tg'
Name | Type |
---|---|
colorScheme | The color scheme currently used in the Telegram app. Either βlightβ or βdarkβ. Also available as the CSS variable var(--tg-color-scheme) .β‘οΈ readonly reactive |
themeParams | An object containing the current theme settings used in the Telegram app. β‘οΈ readonly reactive |
headerColor | Current header color in the #RRGGBB format.β‘οΈ reactive |
backgroundColor | Current background color in the #RRGGBB format.β‘οΈ reactive |
setHeaderColor | Bot API 6.1+ A method that sets the app header color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color.Up to Bot API 6.9 You can only pass Telegram.WebApp.themeParams.bg_color or Telegram.WebApp.themeParams.secondary_bg_color as a color or bg_color, secondary_bg_color keywords. |
setBackgroundColor | Bot API 6.1+ A method that sets the app background color in the #RRGGBB format. You can also use keywords bg_color and secondary_bg_color. |
onThemeChanged | A method that sets the themeParams event handler. |
useWebAppViewport β
// Hover to inspect type
import { useWebAppViewport } from 'vue-tg'
Name | Type |
---|---|
isExpanded | True, if the Mini App is expanded to the maximum available height. False, if the Mini App occupies part of the screen and can be expanded to the full height using the expand() method. β‘οΈ readonly reactive |
viewportHeight | The current height of the visible area of the Mini App. Also available in CSS as the variable var(--tg-viewport-height) .The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can βpullβ the Mini App to its maximum height, while the bot can do the same by calling the expand() method. As the position of the Mini App changes, the current height value of the visible area will be updated in real time. Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window. It should not be used to pin interface elements to the bottom of the visible area. It's more appropriate to use the value of the viewportStableHeight field for this purpose.β‘οΈ readonly reactive |
viewportStableHeight | The height of the visible area of the Mini App in its last stable state. Also available in CSS as a variable var(--tg-viewport-stable-height) .The application can display just the top part of the Mini App, with its lower part remaining outside the screen area. From this position, the user can βpullβ the Mini App to its maximum height, while the bot can do the same by calling the expand() method. Unlike the value of viewportHeight , the value of viewportStableHeight does not change as the position of the Mini App changes with user gestures or during animations. The value of viewportStableHeight will be updated after all gestures and animations are completed and the Mini App reaches its final size.Note the event viewportChanged with the passed parameter isStateStable=true , which will allow you to track when the stable state of the height of the visible area changes.β‘οΈ readonly reactive |
isVerticalSwipesEnabled | True, if vertical swipes to close or minimize the Mini App are enabled. False, if vertical swipes to close or minimize the Mini App are disabled. In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header. β‘οΈ reactive |
expand | A method that expands the Mini App to the maximum available height. To find out if the Mini App is expanded to the maximum height, refer to the value of the Telegram.WebApp.isExpanded parameter |
enableVerticalSwipes | Bot API 7.7+ A method that enables vertical swipes to close or minimize the Mini App. For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures. |
disableVerticalSwipes | Bot API 7.7+ A method that disables vertical swipes to close or minimize the Mini App. This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app. |
onViewportChanged | A method that sets the viewportChanged event handler. |