npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@embed-ai/react

v0.5.1

Published

The reusable React component library for embed AI.

Downloads

265

Readme

@embed-ai/react

This package contains the reusable React components for Embed AI.

Usage

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.

Components

  • 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.

Example

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>
  );
}

Key Props

  • 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.

Customization

Styling

The components are built with Tailwind CSS and designed to be easily customizable. Each component supports style overrides and follows a customization-first approach.

Overriding Styles

You can customize the appearance by:

  1. CSS Variables: The components use CSS variables for theming
  2. Tailwind Classes: Override default classes with your own
  3. Custom CSS: Add your own styles via className props

Examples

// 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;
}

Component Structure

The components are designed to fit into any design system:

  • FeedGrid: Provides layout structure without forcing specific styling
  • FeedCard: Uses semantic HTML with accessible markup
  • Responsive: Works with any responsive design system
  • Flexible: All styling can be overridden without breaking functionality

For advanced customization, you can wrap the components or create your own variants using the same data structures.