Directory

← Back

twitter-status

Twitter Status Web Component

Author

Rating

Not enough ratings

Popularity

<100

<twitter-status>

Version Status macOS Build Status Linux Build Status Windows Build Status Dependency Status

Twitter Status Web Component

Examples

Live demo

Base example

Example

Example with attached image

Example with image

Example with hyperlinked hashtags/mentions/URLs and links colored from profile settings.

Example with image

Install

Load directly from unpkg:

<script async src="https://unpkg.com/twitter-status@latest/dist/twitter-status.min.js"></script>

Or installed as a dependency:

npm install twitter-status

And imported:

import 'twitter-status';

Polyfill

twitter-status relies on the shadow DOM and custom elements standards. You will likely need a polyfill until browser support is more ubiquitous.

Polyfills can be loaded via unpkg directly.

<script src="https://unpkg.com/@webcomponents/webcomponentsjs@2/bundles/webcomponents-sd-ce.js"></script>

Or installed as a dependency:

npm install @webcomponents/webcomponentsjs

And imported:

import '@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce';

Usage

<twitter-status> takes a single value status that must be the full response of GET statuses/show/:id with the parameters include_entities=true and tweet_mode=extended.

You can embed the tweet in the HTML as a JSON string:

<twitter-status status="{\"id_str\":\"20\",...}"></twitter-status>

Or set the property in JS:

<twitter-status></twitter-status>

<script>
  document.querySelector('twitter-status').status = { "id_str": "20", ... };
</script>

Theme

You can theme the borders. Here is an card example.

<style>
  twitter-status.card {
    box-shadow: 0 3px 4px 1px rgba(0, 0, 0, .08), 0 1px 1px 1px rgba(0, 0, 0, .05);
    border-radius: 2px;
    border-width: 0;
  }
</style>
<twitter-status class="card" status="{\"id_str\":\"20\",...}"></twitter-status>

Example with card edges

Reasons

Why use <twitter-status> instead of Twitter's embedded tweets?

  • Open source - If you don't like something about it you can customize it to fit your exact needs.
  • Lightweight
  • Security - You can perform a security audit of <twitter-status> and know exactly what you are shipping. You don't have to worry about loading Twitter's JavaScript.
  • Privacy - <twitter-status> only loads embedded images and videos from Twitter's CDN. You don't have to worry about loading Twitter's JavaScript.
  • Native web component - <twitter-status> is built with standardized web APIs that will work out of the box with most frameworks.
  • No framework dependancies - Because it's based on native web components, it does not have a dependency on Angular, React, or any other framework.
  • Custom URL handling (coming soon) - When a user click on a #hashtag, @mention, etc, you can configure it that they stay within your site.
  • Cached data - If you are a news organization or displaying tweets from politicians, you can continue displaying deleted tweets.
  • Well tested - <twitter-status> as a nice suit of tests to make sure everything continues to render correctly.

Limitations of <twitter-status>?

  • Web component polyfills - Shadow DOM and custom elements are not supported in all browsers, if you are not already using web components the pollyfills may add additional data cost.
  • Twitter cards - Twitter fetches data about links and embeds those in tweets. The data is not available via the API so <twitter-status> does not have access.
  • Status object - <twitter-status> requires the full tweet object. If you only have an ID you'll have to make a request to the Twitter API before using the component.
  • Activity counts - Because the status objects may be stale, like, retweet, and reply counts are not displayed.
  • Open source - This project is not backed by any financing so work gets done as time permits. There are known status types that are not supported yet.

What other options are there?

<twitter-user>

Looking for a way to embed users? Check out <twitter-user>.

Notes

TwitterStatus is released under an MIT license.

TwitterStatus is not affiliated Twitter, Inc.

Built, tested, and published with Nutmeg.

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

0.4.1 imported 2018-07-26
0.4.0 imported 2018-07-24
0.2.5 imported 2018-07-06
0.3.0 imported 2018-07-06
0.2.4 imported 2018-07-04
0.2.3 imported 2018-07-02
0.2.1 imported 2018-06-29
0.2.2 imported 2018-06-29
0.2.0 imported 2018-06-19
0.1.6 imported 2018-02-19
0.1.5 imported 2018-02-04
0.1.4 imported 2018-01-27
0.1.3 imported 2018-01-21
0.1.0 imported 2018-01-16
0.1.1 imported 2018-01-16
0.1.2 imported 2018-01-16

Dependencies

  • @nutmeg/seed#^0.4.2
  • twitter-text#^2.0.2
Released
2018-01-16
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Browser
Browser Independent

twitter-status - Vaadin Add-on Directory

Twitter Status Web Component twitter-status - Vaadin Add-on Directory
<twitter-status> ==== [![Version Status](https://img.shields.io/npm/v/twitter-status.svg?style=flat&label=version&colorB=4bc524)](https://npmjs.com/package/twitter-status) [![macOS Build Status](https://img.shields.io/circleci/project/github/abraham/twitter-status.svg?style=flat&label=macos)](https://circleci.com/gh/abraham/twitter-status) [![Linux Build Status](https://img.shields.io/travis/abraham/twitter-status.svg?style=flat&label=linux)](https://travis-ci.org/abraham/twitter-status) [![Windows Build Status](https://img.shields.io/appveyor/ci/abraham/twitter-status.svg?style=flat&label=windows)](https://ci.appveyor.com/project/abraham/twitter-status) [![Dependency Status](https://david-dm.org/abraham/twitter-status.svg?style=flat)](https://david-dm.org/abraham/twitter-status) Twitter Status Web Component Examples ---- [Live demo](https://codepen.io/abraham/pen/eyLLWy) Base example ![Example](/images/simple.png) Example with attached image ![Example with image](/images/image.png) Example with hyperlinked hashtags/mentions/URLs and links colored from profile settings. ![Example with image](/images/colors.png) Install ---- Load directly from unpkg: ```html ``` Or installed as a dependency: ```sh npm install twitter-status ``` And imported: ```js import 'twitter-status'; ``` Polyfill ---- twitter-status relies on the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM) and [custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) standards. You will likely need a [polyfill](https://github.com/webcomponents/webcomponentsjs) until browser support is more ubiquitous. Polyfills can be loaded via unpkg directly. ```html ``` Or installed as a dependency: ```sh npm install @webcomponents/webcomponentsjs ``` And imported: ```js import '@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce'; ``` Usage ---- <twitter-status> takes a single value `status` that must be the full response of [GET statuses/show/:id](https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id) with the parameters `include_entities=true` and `tweet_mode=extended`. You can embed the tweet in the HTML as a JSON string: ```html ``` Or set the property in JS: ```html ``` Theme ---- You can theme the borders. Here is an card example. ```html ``` ![Example with card edges](/images/card.png) Reasons ---- **Why use <twitter-status> instead of Twitter's embedded tweets?** - Open source - If you don't like something about it you can customize it to fit your exact needs. - Lightweight - A minimal <twitter-status> [example](https://twitter-e9454.firebaseapp.com/twitter-status) comes in at **33KB** before compression. ([With more to save](https://github.com/abraham/twitter-status/issues/79)) - A minimal [Twitter Embed](https://developer.twitter.com/en/docs/twitter-for-websites/embedded-tweets/overview.html) [example](https://twitter-e9454.firebaseapp.com/oembed) comes in at **121KB** before compression. - Security - You can perform a security audit of <twitter-status> and know exactly what you are shipping. You don't have to worry about loading Twitter's JavaScript. - Privacy - <twitter-status> only loads embedded images and videos from Twitter's CDN. You don't have to worry about loading Twitter's JavaScript. - Native web component - <twitter-status> is built with standardized web APIs that will work out of the box with [most frameworks](https://custom-elements-everywhere.com/). - No framework dependancies - Because it's based on native web components, it does not have a dependency on Angular, React, or any other framework. - Custom URL handling ([coming soon](https://github.com/abraham/twitter-status/issues/48)) - When a user click on a #hashtag, @mention, etc, you can configure it that they stay within your site. - Cached data - If you are a news organization or displaying tweets from politicians, you can continue displaying deleted tweets. - Well tested - <twitter-status> as a nice suit of tests to make sure everything continues to render correctly. **Limitations of <twitter-status>?** - Web component polyfills - Shadow DOM and custom elements are [not supported in all browsers](https://developer.mozilla.org/en-US/docs/Web/Web_Components#Browser_support), if you are not already using web components the pollyfills may add additional data cost. - Twitter cards - Twitter fetches data about links and embeds those in tweets. The data is not available via the API so <twitter-status> does not have access. - Status object - <twitter-status> requires the full tweet object. If you only have an ID you'll have to make a request to the Twitter API before using the component. - Activity counts - Because the status objects may be stale, like, retweet, and reply counts are not displayed. - Open source - This project is not backed by any financing so work gets done as time permits. There are [known status types](https://github.com/abraham/twitter-status/issues) that are not supported yet. **What other options are there?** - [Twitter's official embedded tweets](https://developer.twitter.com/en/docs/twitter-for-websites/embedded-tweets/overview.html) - [react-tweet-embed](https://github.com/capaj/react-tweet-embed) - [react-tweet](https://github.com/mannynotfound/react-tweet) <twitter-user> ---- Looking for a way to embed users? Check out [<twitter-user>](https://github.com/abraham/twitter-user). Notes ---- TwitterStatus is released under an MIT license. TwitterStatus is not affiliated Twitter, Inc. Built, tested, and published with [Nutmeg](https://nutmeg.tools).
View on GitHub
View on NPM

twitter-status version 0.1.0
### Dependencies * @nutmeg/seed#^0.4.2 * twitter-text#^2.0.2

twitter-status version 0.1.1
### Dependencies * @nutmeg/seed#^0.4.2 * twitter-text#^2.0.2

twitter-status version 0.1.2
### Dependencies * @nutmeg/seed#^0.4.2 * twitter-text#^2.0.2

twitter-status version 0.1.3
### Dependencies * @nutmeg/seed#^0.4.2 * twitter-text#^2.0.2

twitter-status version 0.1.4
### Dependencies * @nutmeg/seed#^0.6.0 * twitter-text#^2.0.2

twitter-status version 0.1.5
### Dependencies * @nutmeg/seed#0.8.1 * twitter-text#2.0.4

twitter-status version 0.1.6
### Dependencies * @nutmeg/seed#0.9.0 * lit-html#0.9.0 * twitter-text#2.0.4

twitter-status version 0.2.0
### Dependencies * @nutmeg/seed#0.12.1 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.2.1
### Dependencies * @nutmeg/seed#0.12.1 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.2.2
### Dependencies * @nutmeg/seed#0.12.1 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.2.3
### Dependencies * @nutmeg/seed#0.12.2 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.2.4
### Dependencies * @nutmeg/seed#0.12.2 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.2.5
### Dependencies * @nutmeg/seed#0.12.2 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.3.0
### Dependencies * @nutmeg/seed#0.12.2 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.4.0
### Dependencies * @nutmeg/seed#0.13.0 * lit-html#0.10.2 * twitter-text#2.0.4

twitter-status version 0.4.1
### Dependencies * @nutmeg/seed#0.13.0 * lit-html#0.10.2 * twitter-d#0.1.1 * twitter-text#2.0.4

Online