Skip to content

Mini Apps Integration ​

Official Telegram Mini Apps Documentation

Field Mapping ​

FieldComposable
initDatauseWebApp
initDataUnsafeuseWebApp
versionuseWebApp
platformuseWebApp
colorSchemeuseWebAppTheme
themeParamsuseWebAppTheme
isExpandeduseWebAppViewport
viewportHeightuseWebAppViewport
viewportStableHeightuseWebAppViewport
headerColoruseWebAppTheme
backgroundColoruseWebAppTheme
isClosingConfirmationEnableduseWebAppClosingConfirmation
isVerticalSwipesEnableduseWebAppViewport
BackButtonuseWebAppBackButton
MainButtonuseWebAppMainButton
HapticFeedbackuseWebAppHapticFeedback
BiometricManageruseWebAppBiometricManager
isVersionAtLeastuseWebApp
setHeaderColoruseWebAppTheme
setBackgroundColoruseWebAppTheme
enableClosingConfirmationuseWebAppClosingConfirmation
disableClosingConfirmationuseWebAppClosingConfirmation
enableVerticalSwipesuseWebAppViewport
disableVerticalSwipesuseWebAppViewport
onEventuseWebApp
offEventHandled automagically πŸͺ„
sendDatauseWebApp
switchInlineQueryuseWebAppNavigation
openLinkuseWebAppNavigation
openTelegramLinkuseWebAppNavigation
openInvoiceuseWebAppNavigation
shareToStoryuseWebAppShare
showPopupuseWebAppPopup
showAlertuseWebAppPopup
showConfirmuseWebAppPopup
showScanQrPopupuseWebAppQrScanner
closeScanQrPopupuseWebAppQrScanner
readTextFromClipboarduseWebAppClipboard
requestWriteAccessuseWebAppRequests
requestContactuseWebAppRequests
readyuseWebApp
expanduseWebAppViewport
closeuseWebApp

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.

ts
import { useWebAppTheme } from 'vue-tg'

const { onThemeChanged } = useWebAppTheme()

onThemeChanged(() => {
  // handle theme update
})

Mapping ​

Event nameHandler
themeChangeduseWebAppTheme β†’ onThemeChanged
viewportChangeduseWebAppViewport β†’ onViewportChanged
mainButtonClickeduseWebAppMainButton β†’ onMainButtonClicked
backButtonClickeduseWebAppBackButton β†’ onBackButtonClicked
settingsButtonClickeduseWebAppSettingsButton β†’ onSettingsButtonClicked
invoiceCloseduseWebAppNavigation β†’ onInvoiceClosed
popupCloseduseWebAppPopup β†’ onPopupClosed
qrTextReceiveduseWebAppQrScanner β†’ onQrTextReceived
scanQrPopupCloseduseWebAppQrScanner β†’ onScanQrPopupClosed
clipboardTextReceiveduseWebAppClipboard β†’ onClipboardTextReceived
writeAccessRequesteduseWebAppRequests β†’ onWriteAccessRequested
contactRequesteduseWebAppRequests β†’ onContactRequested
biometricManagerUpdateduseWebAppBiometricManager β†’ onBiometricManagerUpdated
biometricAuthRequesteduseWebAppBiometricManager β†’ onBiometricAuthRequested
biometricTokenUpdateduseWebAppBiometricManager β†’ 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:

ts
import { useWebAppTheme } from 'vue-tg'

const { onThemeChanged } = useWebAppTheme()

const handler = onThemeChanged(() => {
  // handle theme update
})

// unsubscribe
handler.off()

You can also disable automatic unsubscribing completely:

ts
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.

vue
<script lang="ts" setup>
import { Alert } from 'vue-tg'

function handleAlertClose() {
  // ...
}
</script>

<template>
  <Alert message="Hello!" @close="handleAlertClose" />
</template>

Props ​

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the alert popup.

Events ​

NameTypeDescription
close() => voidEmits when the opened popup is closed.

BackButton ​

A component that enables the back button when is rendered.

vue
<script lang="ts" setup>
import { BackButton } from 'vue-tg'

function handleBackButton() {
  // ...
}
</script>

<template>
  <BackButton @click="handleBackButton" />
</template>

Props ​

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.

Events ​

NameTypeDescription
click() => voidEmits when the back button is pressed.

BiometricManager ​

A component that init the biometric manager when is rendered.

vue
<script lang="ts" setup>
import { BiometricManager } from 'vue-tg'
  
const handleInit = () => {
  // ...
}
</script>

<template>
  <BiometricManager @init="handleInit" />
</template>

Events ​

NameTypeDescription
init() => voidEmits when the biometric manager is init.

ClosingConfirmation ​

A component that enables the confirmation dialog while the user is trying to close the Mini App.

vue
<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.

vue
<script lang="ts" setup>
import { Confirm } from 'vue-tg'

function handleConfirmClose(ok: boolean) {
  // ...
}
</script>

<template>
  <Confirm message="Hello?" @close="handleConfirmClose" />
</template>

Props ​

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the confirm popup.

Events ​

NameTypeDescription
close(ok: boolean) => voidEmits when the opened popup is closed.

ExpandedViewport ​

A component that expands the Mini App to the maximum available height when is rendered.

vue
<script lang="ts" setup>
import { ExpandedViewport } from 'vue-tg'
</script>

<template>
  <ExpandedViewport />
</template>

Props ​

NameTypeRequiredDescription
forcebooleanfalseExpands 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.

vue
<script lang="ts" setup>
import { MainButton } from 'vue-tg'

function handleMainButton() {
  // ...
}
</script>

<template>
  <MainButton @click="handleMainButton" />
</template>

Props ​

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.
disabledbooleanfalseShows whether the button is disable.
progressbooleanfalseShows whether the button is displaying a loading indicator.
textstringfalseCurrent button text.
colorstringfalseCurrent button color.
textColorstringfalseCurrent button text color.

Events ​

NameTypeDescription
click() => voidEmits when the main button is pressed.

A component that shows a native popup when is rendered.

vue
<script lang="ts" setup>
import { Popup } from 'vue-tg'

function handlePopupClose(buttonId: string) {
  // ...
}
</script>

<template>
  <Popup message="Hello" @close="handlePopupClose" />
</template>

Props ​

NameTypeRequiredDescription
messagestringtrueThe message to be displayed in the body of the popup.
titlestringfalseThe text to be displayed in the popup title.
buttonsPopupButton[] β†—falseList of buttons to be displayed in the popup.

Events ​

NameTypeDescription
close(buttonId: string) => voidEmits when the opened popup is closed.

ScanQr ​

A component that shows a native popup for scanning a QR code when is rendered.

vue
<script lang="ts" setup>
import { ScanQr } from 'vue-tg'

function handleScanResult(data: string) {
  // ...
}
</script>

<template>
  <ScanQr @result="handleScanResult" />
</template>

Props ​

NameTypeRequiredDescription
textstringfalseThe text to be displayed under the 'Scan QR' heading.

Events ​

NameTypeDescription
result(data: string) => voidEmits when the QR code scanner catches a code with text data.

SettingsButton ​

A component that enables the settings button when is rendered.

vue
<script lang="ts" setup>
import { SettingsButton } from 'vue-tg'

function handleSettingsButton() {
  // ...
}
</script>

<template>
  <SettingsButton @click="handleSettingsButton" />
</template>

Props ​

NameTypeRequiredDescription
visiblebooleanfalseShows whether the button is visible. Set to true by default.

Events ​

NameTypeDescription
click() => voidEmits when the settings button is pressed.

Composables ​

useWebApp ​

ts
// Hover to inspect type
import { 
useWebApp
} from 'vue-tg'
NameDescription
initDataA 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.
initDataUnsafeAn 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.
versionThe version of the Bot API available in the user's Telegram app.
platformThe name of the platform of the user's Telegram app.
isVersionAtLeastReturns 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.
onEventA method that sets the app event handler. Check the list of available events.
sendDataA 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.
readyA 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.
closeA method that closes the Mini App.
isReadyBoolean indicating if the app is ready.
πŸ”‹ custom⚑️ readonly reactive
isPlatformFunction to check if the app is running on a specified platform.
πŸ”‹ custom
isPlatformUnknownBoolean indicating if the platform is unknown.
πŸ”‹ custom
isFeatureSupportedFunction to check if a specified feature is supported.
πŸ”‹ custom

useWebAppBackButton ​

ts
// Hover to inspect type
import { 
useWebAppBackButton
} from 'vue-tg'
NameDescription
isBackButtonVisibleShows whether the button is visible. Set to false by default.
⚑️ reactive
onBackButtonClickedBot API 6.1+ A method that sets the backButtonClicked event handler.
showBackButtonBot API 6.1+ A method to make the button active and visible.
hideBackButtonBot API 6.1+ A method to hide the button.

useWebAppBiometricManager ​

ts
// Hover to inspect type
import { 
useWebAppBiometricManager
} from 'vue-tg'
NameType
isBiometricInitedShows whether biometrics object is initialized.
⚑️ readonly reactive
isBiometricAvailableShows whether biometrics is available on the current device.
⚑️ readonly reactive
biometricTypeThe 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
isBiometricAccessRequestedShows whether permission to use biometrics has been requested.
⚑️ readonly reactive
isBiometricAccessGrantedShows whether permission to use biometrics has been granted.
⚑️ readonly reactive
isBiometricTokenSavedShows whether the token is saved in secure storage on the device.
⚑️ readonly reactive
biometricDeviceIdA unique device identifier that can be used to match the token to the device.
⚑️ readonly reactive
initBiometricBot 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.
requestBiometricAccessBot 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.
authenticateBiometricBot 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.
updateBiometricTokenBot 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.
openBiometricSettingsBot 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)
onBiometricManagerUpdatedBot API 7.2+ A method that sets the biometricManagerUpdated event handler.
onBiometricAuthRequestedBot API 7.2+ A method that sets the biometricAuthRequested event handler.
onBiometricTokenUpdatedBot API 7.2+ A method that sets the biometricTokenUpdated event handler.

useWebAppClipboard ​

ts
// Hover to inspect type
import { 
useWebAppClipboard
} from 'vue-tg'
NameType
onClipboardTextReceivedBot API 6.4+ A method that sets the clipboardTextReceived event handler.
readTextFromClipboardBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppClosingConfirmation
} from 'vue-tg'
NameType
isClosingConfirmationEnabledTrue, if the confirmation dialog is enabled while the user is trying to close the Mini App. False, if the confirmation dialog is disabled.
⚑️ reactive
enableClosingConfirmationBot API 6.2+ A method that enables a confirmation dialog while the user is trying to close the Mini App.
disableClosingConfirmationBot API 6.2+ A method that disables the confirmation dialog while the user is trying to close the Mini App.

useWebAppCloudStorage ​

ts
// Hover to inspect type
import { 
useWebAppCloudStorage
} from 'vue-tg'
NameType
setStorageItemBot 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.
getStorageItemBot 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.
getStorageItemsBot 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.
removeStorageItemBot 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.
removeStorageItemsBot 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.
getStorageKeysBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppHapticFeedback
} from 'vue-tg'
NameType
impactOccurredBot 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.
notificationOccurredBot 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.
selectionChangedBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppMainButton
} from 'vue-tg'
NameType
mainButtonTextCurrent button text. Set to Continue for the main button and Cancel for the secondary button by default.
⚑️ reactive
mainButtonColorCurrent button color. Set to themeParams.button_color for the main button and themeParams.bottom_bar_bg_color for the secondary button by default.
⚑️ reactive
mainButtonTextColorCurrent button text color. Set to themeParams.button_text_color for the main button and themeParams.button_color for the secondary button by default.
⚑️ reactive
isMainButtonVisibleShows whether the button is visible. Set to false by default.
⚑️ reactive
isMainButtonActiveShows whether the button is active. Set to true by default.
⚑️ reactive
isMainButtonProgressVisibleReadonly. Shows whether the button is displaying a loading indicator.
⚑️ reactive
setMainButtonTextA method to set the button text.
onMainButtonClickedA method that sets the mainButtonClicked event handler.
showMainButtonA 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.
hideMainButtonA method to hide the button.
enableMainButtonA method to enable the button.
disableMainButtonA method to disable the button.
showMainButtonProgressA 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.
hideMainButtonProgressA method to hide the loading indicator.
setMainButtonParamsA 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 ​

ts
// Hover to inspect type
import { 
useWebAppNavigation
} from 'vue-tg'
NameType
onInvoiceClosedBot API 6.1+ A method that sets the invoiceClosed event handler.
openInvoiceBot 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.
openLinkA 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)
openTelegramLinkA 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.
switchInlineQueryBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppPopup
} from 'vue-tg'
NameType
onPopupClosedBot API 6.2+ A method that sets the popupClosed event handler.
showAlertBot 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.
showConfirmBot 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.
showPopupBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppQrScanner
} from 'vue-tg'
NameType
showScanQrPopupBot 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.
closeScanQrPopupBot 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.
onQrTextReceivedBot API 6.4+ A method that sets the qrTextReceived event handler.
onScanQrPopupClosedBot API 7.7+ A method that sets the scanQrPopupClosed event handler.

useWebAppRequests ​

ts
// Hover to inspect type
import { 
useWebAppRequests
} from 'vue-tg'
NameType
onContactRequestedBot API 6.9+ A method that sets the contactRequested event handler.
onWriteAccessRequestedBot API 6.9+ A method that sets the writeAccessRequested event handler.
requestContactBot 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.
requestWriteAccessBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppSettingsButton
} from 'vue-tg'
NameType
isSettingsButtonVisibleShows whether the context menu item is visible. Set to false by default.
⚑️ reactive
onSettingsButtonClickedBot API 6.1+ A method that sets the settingsButtonClicked event handler.
showSettingsButtonBot API 7.0+ A method to make the Settings item in the context menu visible.
hideSettingsButtonBot API 7.0+ A method to hide the Settings item in the context menu.

useWebAppShare ​

ts
// Hover to inspect type
import { 
useWebAppShare
} from 'vue-tg'
NameType
shareToStoryBot 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 ​

ts
// Hover to inspect type
import { 
useWebAppTheme
} from 'vue-tg'
NameType
colorSchemeThe color scheme currently used in the Telegram app. Either β€œlight” or β€œdark”.
Also available as the CSS variable var(--tg-color-scheme).
⚑️ readonly reactive
themeParamsAn object containing the current theme settings used in the Telegram app.
⚑️ readonly reactive
headerColorCurrent header color in the #RRGGBB format.
⚑️ reactive
backgroundColorCurrent background color in the #RRGGBB format.
⚑️ reactive
setHeaderColorBot 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.
setBackgroundColorBot 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.
onThemeChangedA method that sets the themeParams event handler.

useWebAppViewport ​

ts
// Hover to inspect type
import { 
useWebAppViewport
} from 'vue-tg'
NameType
isExpandedTrue, 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
viewportHeightThe 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
viewportStableHeightThe 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
isVerticalSwipesEnabledTrue, 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
expandA 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
enableVerticalSwipesBot 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.
disableVerticalSwipesBot 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.
onViewportChangedA method that sets the viewportChanged event handler.