
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@embed-ai/react
Advanced tools
This package contains the reusable React components for Embed AI.
This guide explains how to use the FeedGrid and FeedCard components to display a feed of items with support for infinite scrolling, refreshing, and user interactions.
FeedGrid: A container component that manages the layout of the feed, including loading states, error messages, and infinite scroll triggers.FeedCard: A component that renders an individual item in the feed, with buttons for actions like sharing, replying, and tipping.Here's an example of how to use FeedGrid and FeedCard to create a dynamic feed:
import { useInView } from "react-intersection-observer";
import { useEffect } from "react";
import { FeedGrid, FeedCard, type FeedItem } from "@embed-ai/react";
interface FeedData {
items: FeedItem[];
nextPage: () => void;
}
function MyFeed() {
// State management for your feed data
const [data, setData] = React.useState<FeedData | null>(null);
const [isLoading, setIsLoading] = React.useState(true);
const [error, setError] = React.useState<Error | null>(null);
// Fetch initial data
React.useEffect(() => {
// Your data fetching logic here
}, []);
const { ref, inView } = useInView({ threshold: 0 });
useEffect(() => {
if (inView && data?.nextPage) {
data.nextPage();
}
}, [inView, data]);
const handleRefresh = () => {
// Your refresh logic here
};
return (
<FeedGrid
title="My Feed"
isLoading={isLoading}
error={error}
isFetchingNextPage={false} // Your logic here
hasNextPage={!!data?.nextPage}
onRefresh={handleRefresh}
isRefreshing={false} // Your logic here
loaderRef={ref}
isEmpty={!data?.items.length}
>
{data?.items.map((item) => (
<FeedCard
key={item.item_id}
item={item}
onShare={() => console.log("Share clicked")}
onReply={() => console.log("Reply clicked")}
onViewProfile={() => console.log("View profile clicked")}
onTip={() => console.log("Tip clicked")}
/>
))}
</FeedGrid>
);
}
FeedGrid
title: The title of the feed.isLoading: Whether the initial data is loading.error: An error object to display an error message.isFetchingNextPage: Whether the next page of data is being fetched.hasNextPage: Whether there is a next page of data to fetch.onRefresh: A function to call when the user requests a refresh.isRefreshing: Whether a refresh is in progress.loaderRef: A ref to attach to the infinite scroll trigger element.isEmpty: Whether the feed is empty.FeedCard
item: The FeedItem object to render.onShare, onReply, onViewProfile, onTip: Callback functions for user actions.The components are built with Tailwind CSS and designed to be easily customizable. Each component supports style overrides and follows a customization-first approach.
You can customize the appearance by:
// Custom styling for FeedGrid container
<FeedGrid
title="My Custom Feed"
className="bg-gray-100 p-8 rounded-xl"
// ... other props
>
{data?.items.map((item) => (
<FeedCard
key={item.item_id}
item={item}
className="bg-white/90 backdrop-blur-sm border-2 border-blue-200 hover:border-blue-400 transition-all"
// ... other props
/>
))}
</FeedGrid>
/* Custom CSS variables for theming */
:root {
--card-bg: #ffffff;
--card-border: #e5e7eb;
--text-primary: #111827;
--text-muted: #6b7280;
--primary-color: #3b82f6;
--primary-hover: #2563eb;
}
/* Dark theme example */
.dark {
--card-bg: #1f2937;
--card-border: #374151;
--text-primary: #f9fafb;
--text-muted: #9ca3af;
--primary-color: #60a5fa;
--primary-hover: #3b82f6;
}
The components are designed to fit into any design system:
For advanced customization, you can wrap the components or create your own variants using the same data structures.
FAQs
The reusable React component library for embed AI.
We found that @embed-ai/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.