This package offers a convenient wrapper around the @twa-dev/sdk, providing Vue-like components and use-case solutions for Popups, MainButton, BackButton, and Theme integration.
Returns whole instance of @twa-dev/sdk
<script setup lang="ts">
import { useTelegramSdk } from '@tok/telegram-ui/use/sdk';
const sdk = useTelegramSdk();
sdk.HapticFeedback.impactOccurred('light');
// ... and so on
</script>
useTheme will track colorScheme from Telegram sdk in reactive way
<script setup lang="ts">
import { useTheme } from '@tok/telegram-ui/use/theme';
import { watch } from 'vue';
const theme = useTheme();
watch(
theme,
(value) => {
console.log(value);
},
{ immediate: true }
);
</script>