rc-twitter-embed
v1.0.0
Published
Lightweight, license-gated React component for embedding a Twitter/X timeline
Maintainers
Readme
rc-twitter-embed
Drop a Twitter/X timeline into a React app with one component.
Works with React 16 through 19, and is safe to import in server-rendered apps (Next.js and
similar) — widgets.js is only requested once the component actually mounts in a browser.
Install
npm install rc-twitter-embedExample
import { TwitterTimelineEmbed } from 'rc-twitter-embed';
function Profile() {
return (
<TwitterTimelineEmbed
sourceType="profile"
screenName="twitter"
options={{ height: 400 }}
/>
);
}Props
sourceType— one ofprofile,likes,timeline,list,collection,url,widget. Depending on which you pick, pair it withscreenName,userId,id,widgetId,ownerScreenName/slug, orurl(see TwitterTimelineEmbed.tsx for exactly which fields eachsourceTypeexpects).placeholder— shown in place of the timeline while it's loading.onLoad(element)— fires once the widget has finished rendering.theme,linkColor,borderColor,lang,tweetLimit,ariaPolite,autoHeight,noHeader,noFooter,noBorders,noScrollbar,transparent,options— passed straight through to Twitter's own timeline widget. Full reference: Twitter Widgets JavaScript API.
