Socket
Book a DemoInstallSign in
Socket

bloggy-embed

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bloggy-embed

React components to embed blogs from an API.

1.0.2
latest
npmnpm
Version published
Weekly downloads
3
-96.25%
Maintainers
1
Weekly downloads
 
Created
Source

bloggy-embed

📝 bloggy-embed — Embeddable blog components for React for blog content rendering.

Easily showcase your blogs on any React-based website with beautiful prebuilt components like BlogCard and BlogEmbed.

✨ Features

  • 📦 Plug-and-play blog embed components
  • 🎨 Responsive design out of the box
  • 🖋 Tiptap-powered rich text rendering
  • Lightweight & fast
  • 🔄 Works with your own blog API

📦 Installation

npm install bloggy-embed


🚀 Usage Example
Below is an example of how to fetch blog data from your API and display it using bloggy-embed.


// src/App.tsx
import { useState, useEffect } from 'react';
import { BlogCard, BlogEmbed } from 'bloggy-embed';
import type { Blog } from 'bloggy-embed';

const API_URL = 'Your API';

function App() {
  const [blogs, setBlogs] = useState<Blog[]>([]);
  const [selectedBlog, setSelectedBlog] = useState<Blog | null>(null);

  useEffect(() => {
    fetch(API_URL)
      .then((res) => res.json())
      .then((data) => {
        setBlogs(data.message.entries);
      })
      .catch((err) => {
        console.error('Failed to fetch blogs:', err);
      });
  }, []);

  return (
    <div className="min-h-screen bg-gray-50 p-6">
      <h1 className="text-4xl font-bold text-center mb-8">Latest Blogs</h1>

      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        {blogs.map((blog) => (
          <BlogCard key={blog._id} blog={blog} onClick={() => setSelectedBlog(blog)} />
        ))}
      </div>

      {selectedBlog && (
        <div className="fixed inset-0 bg-white z-50 overflow-y-auto px-4 py-6">
          <BlogEmbed
            blog={selectedBlog}
            showBackButton
            onBack={() => setSelectedBlog(null)}
          />
        </div>
      )}
    </div>
  );
}

export default App;


📚 Components
1️⃣ BlogCard
Displays a compact preview of a blog post.

| Prop      | Type         | Description                                             |
| --------- | ------------ | ------------------------------------------------------- |
| `blog`    | `Blog`       | The blog object containing title, content, author, etc. |
| `onClick` | `() => void` | Callback when the card is clicked.                      |


2️⃣ BlogEmbed
Displays the full blog content.

| Prop             | Type         | Description                               |
| ---------------- | ------------ | ----------------------------------------- |
| `blog`           | `Blog`       | The blog object to render.                |
| `showBackButton` | `boolean`    | Whether to show a back button.            |
| `onBack`         | `() => void` | Callback when the back button is clicked. |


🔌 Blog Type Definition
The Blog type is included for convenience:

export interface Blog {
  _id: string;
  title: string;
  content: any; 
  author?: string;
  createdAt?: string;
  coverImage?: string;
}



🎨 Styling
The components come with minimal default styles.

You can wrap them in your own CSS framework or Tailwind utility classes for customization.

Keywords

react

FAQs

Package last updated on 20 Aug 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.