Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 2.35 KB

File metadata and controls

58 lines (40 loc) · 2.35 KB

Twitter Components

npm version Weekly downloads Total downloads

Add Twitter posts to your site using your own data.

Documentation

an example tweet rendered with Twitter Components

Install

bun add twitter-components

Also works with npm, pnpm, and Yarn.

Use

<twitter-post id="post" theme="dark"></twitter-post>
import "twitter-components/register";

const post = document.querySelector("twitter-post");
post.data = {
  author: "John Doe",
  handle: "john_doe",
  url: "https://x.com/john_doe/status/1",
  timestamp: "2026-09-13T12:30:00Z",
  content: "would you look at that! i can make fake tweets",
  stats: { likes: 12480, views: 84947 },
};

Use .options for themes, counts, dates, media, and actions. Replace individual regions with slots. Render HTML on the server with renderTwitterPost or renderTwitterTimeline from twitter-components/server.

Develop

bun install
bun run check
bun run docs:dev
bun run build

The same scripts work with npm, pnpm, and Yarn. Run docs:build for the static docs.

Notes

This project is licensed under the MIT license. See NOTICE.md for design references used.

Skyra-project's discord-components was a big inspiration for me to create this project.