Skip to content

Widgets

Official Telegram Widgets Documentation

Share Widget


Official documentation

A widget to let users forward content from your website or app to their friends, channels or Saved Messages on Telegram.

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

<template>
  <ShareWidget 
    url="https://vue-tg.pages.dev" 
    comment="Telegram integration for Vue" 
  />
</template>

Props

NameTypeDescription
urlstringURL to share.
commentstringOptional. Additional comment to be included with the shared URL.
sizestringOptional. Size of the widget ("large", "medium").
Default is "medium".
no-labelbooleanOptional. If set to true, hides the label text on the widget button.
tagstringOptional. Specify a custom HTML-tag to wrap the widget.
Default is "div".

Post Widget


Official documentation

A widget to embed messages from public groups and channels on your website.

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

<template>
  <PostWidget url="durov/68" />
</template>

Props

NameTypeDescription
urlstringURL of the post.
widthstringOptional. Width of the widget.
author-photobooleanOptional. Display the author's photo.
colorstringOptional. Accent color.
dark-colorstringOptional. Accent color in dark mode.
darkbooleanOptional. Indicates whether to use dark mode.
tagstringOptional. Specify a custom HTML-tag to wrap the widget.
Default is "div".

Login Widget


Official documentation

A widget to authorize users on your website.

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

function handleUserAuth(user: LoginWidgetUser) {
  // ...
}
</script>

<template>
  <LoginWidget 
    bot-username="samplebot"
    @auth="handleUserAuth"
  />
</template>

Props

NameTypeDescription
bot-usernamestringUsername of the bot.
redirect-urlstringOptional. URL to redirect to after authentication.
sizestringOptional. Size of the widget ("large", "medium", "small").
Default is "large".
corner-radiusnumberOptional. Corner radius of the button.
user-photobooleanOptional. Display the user's profile photo.
request-writebooleanOptional. Request access to send messages from the bot.
tagstringOptional. Specify a custom HTML-tag to wrap the widget.
Default is "div".

Events

NameTypeDescription
auth(user: LoginWidgetUser) => voidEmits when the user is successfully authorized.
Note: does not emit when a redirect URL is specified.

Discussion Widget


Official documentation

A widget to embed discussions from any public channel on your website.

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

<template>
  <DiscussionWidget url="contest/198" />
</template>

Props

NameTypeDescription
urlstringURL of the discussion.
comments-limitnumberOptional. Limit on the number of comments.
heightstringOptional. Height of the widget.
colorstringOptional. Accent color.
dark-colorstringOptional. Accent color in dark mode.
darkbooleanOptional. Indicates whether to use dark mode.
colorfulbooleanOptional. Indicates whether to use different colors for names.
tagstringOptional. Specify a custom HTML-tag to wrap the widget.
Default is "div".