A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/DannyFeliz/vue-tweet below:

DannyFeliz/vue-tweet: Vue 3 component that let you embed tweets in your App by only giving the tweet id

Vue 3 component that lets you embed tweets in your app by only providing the tweet ID.

npm install vue-tweet

# or with yarn
yarn add vue-tweet

# or with pnpm
pnpm add vue-tweet
Basic Usage with Tweet ID
<script setup>
import VueTweet from 'vue-tweet'
</script>

<template>
  <VueTweet tweet-id="1530240085807054848" />
</template>
<script setup>
import VueTweet from 'vue-tweet'
</script>

<template>
  <VueTweet tweet-url="https://x.com/DannyFeliz08/status/1530240085807054848" />
</template>
<script setup>
import { VueTweet } from 'vue-tweet'
</script>

<template>
  <VueTweet tweet-id="1530240085807054848" />
</template>

Note: You must provide either tweet-id or tweet-url.

For detailed information about embedded tweet parameters, see the Embedded Tweet parameter reference.

Slot for custom loading state.

<VueTweet tweet-id="20">
  <template #loading>
    <span>Loading tweet...</span>
  </template>
</VueTweet>

Slot for custom error state.

<VueTweet tweet-id="20">
  <template #error>
    <span>Sorry, that tweet doesn't exist!</span>
  </template>
</VueTweet>
<script setup>
import VueTweet from 'vue-tweet'

function onTweetLoaded(embedHtmlNode) {
  console.log('Tweet loaded successfully:', embedHtmlNode)
}

function onTweetError(error) {
  console.error('Failed to load tweet:', error)
}
</script>

<template>
  <VueTweet
    tweet-id="1530240085807054848"
    theme="dark"
    cards="hidden"
    conversation="none"
    :width="400"
    align="center"
    lang="en"
    :dnt="true"
    @tweet-load-success="onTweetLoaded"
    @tweet-load-error="onTweetError"
  >
    <template #loading>
      <div class="loading-spinner">Loading tweet...</div>
    </template>
    <template #error>
      <div class="error-message">Failed to load tweet</div>
    </template>
  </VueTweet>
</template>
# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

# Type checking
npm run type-check

# Lint files
npm run lint

This package includes TypeScript definitions. You can import the component and types:

import VueTweet, { type TweetProps, type TweetLang } from 'vue-tweet'
  1. Fork it (https://github.com/dannyfeliz/vue-tweet/fork)
  2. Create your feature branch (git checkout -b feature/awesome-feature)
  3. Commit your changes (git commit -am 'Add some awesome feature')
  4. Push to the branch (git push origin feature/awesome-feature)
  5. Create a new Pull Request

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4