Giscus Component

screenshot of Giscus Component
react
solid
svelte
vue

Component library for giscus, a comment system powered by GitHub Discussions.

Overview

The giscus-component is a wrapper component for giscus, a comments system powered by GitHub Discussions. It is currently available for React, Vue, Svelte, Solid, and as a WebComponent. This component allows users to easily integrate the giscus comments system into their web applications.

Features

  • Supports React, Vue, Svelte, Solid, and WebComponent
  • Easy installation and integration
  • Allows customization of <iframe> styles

Using the React, Vue, Svelte, or Solid component

  1. Install the corresponding package for the desired framework.
  2. Import the default export from the package.
  3. Use the component in your code.

Example for React:

import GiscusComponent from '@giscus/react';

// Use the component in your code
<GiscusComponent repo="owner/repo" issue-id="123" />

Using the Web component

  1. Install the giscus package.
  2. Import it in your code.
  3. Use it in your HTML.

Example:

import 'giscus';

// Use it in your HTML
<giscus-repo repo="owner/repo" issue-id="123"></giscus-repo>

Changing the <iframe> styles

You can style the <iframe> in your CSS by selecting the web component or the iframe part specifically. For example:

giscus-repo {
  background-color: #f4f4f4;
  border: none;
}

giscus-repo iframe {
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

You can also make the widget scrollable by creating a parent container with a limited height and overflow: scroll, for example:

.giscus-container {
  height: 400px;
  overflow: scroll;
}

Note that these styles only apply to the <iframe> element and not its contents. To style the contents, a custom theme needs to be used.

Summary

The giscus-component is a versatile wrapper component for integrating the giscus comments system into web applications. It supports multiple frameworks and provides easy installation and customization options. Developers can easily add a commenting feature to their websites using this component.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

solid
Solid

SolidJS is a declarative JavaScript library for building user interfaces, offering a reactive programming model for efficient updates. It stands out for its reactivity system that minimizes unnecessary re-renders and its small bundle size, making it a performant choice for developing lightweight and reactive web applications.

svelte
Svelte

Svelte is a modern front-end framework that compiles your code at build time, resulting in smaller and faster applications. It uses a reactive approach to update the DOM, allowing for high performance and a smoother user experience.

vue
Vue

Vue.js is a lightweight and flexible JavaScript framework that allows developers to easily build dynamic and reactive user interfaces. Its intuitive syntax, modular architecture, and focus on performance make it a popular choice for modern web development.

web-components
Web Components

Web components provide a way to create reusable, encapsulated UI components using standard web technologies such as HTML, CSS, and JavaScript. They allow developers to create complex UI components that can be easily shared across multiple projects and frameworks. Web components are built using four main specifications: Custom Elements, Shadow DOM, HTML Templates, and ES Modules.