Get Updates

Open Source

A beautiful and interactive open-source project showcase component with animations and contributor statistics.

Christer Hagen

Written by Christer Hagen

Proudly open-source

Our source code is available on GitHub - feel free to read, review, or contribute to it however you want!

2+ Contributors
Join our growing community
codehagen's avatar
contributor2's avatar

The Open Source component provides a beautiful way to showcase your GitHub repository's stars and contributors. Perfect for open-source project landing pages, documentation sites, and portfolio projects.

Installation

Examples

Custom Title and Description

Join our community

PrismUI is built by the community, for the community. We'd love to have you join us!

2+ Contributors
Join our growing community
codehagen's avatar
contributor2's avatar

Different Repository

Built with Next.js

Next.js is the foundation of our framework. Check out their repository to learn more.

2+ Contributors
Join our growing community
contributor1's avatar
contributor2's avatar

Usage

Basic Usage

import OpenSource from "@/components/prismui/open-source"
 
export default function Example() {
  return (
    <OpenSource
      repository="username/repository"
      defaultStats={{
        stars: 0,
        contributors: []
      }}
    />
  )
}

With GitHub Token

<OpenSource
  repository="username/repository"
  githubToken={process.env.GITHUB_TOKEN}
  defaultStats={{
    stars: 0,
    contributors: []
  }}
/>

Custom Content

<OpenSource
  repository="username/repository"
  title="Custom Title"
  description="Your custom description here"
  buttonText="Custom Button Text"
  defaultStats={{
    stars: 0,
    contributors: []
  }}
/>

Customization

Custom Styling

<OpenSource
  className="custom-class"
  // Add any custom styles or classes
/>

Custom Default Stats

<OpenSource
  defaultStats={{
    stars: 100,
    contributors: [
      {
        login: "username",
        avatar_url: "https://github.com/username.png"
      }
    ]
  }}
/>

Custom Loading State

<Suspense fallback={<YourCustomLoadingComponent />}>
  <OpenSource {...props} />
</Suspense>

Notes

  • Built with Framer Motion for smooth animations
  • Server Component with client-side fallback
  • Automatic data fetching with caching
  • Responsive design with mobile-first approach
  • TypeScript support with proper types
  • SSR compatible with "use client" directive
  • Optimized performance with proper suspense boundaries
  • ARIA attributes for accessibility
  • Rate limit aware with proper error handling

Features

  • Real-time GitHub stats
  • Animated star count
  • Contributor avatars with hover effects
  • Responsive layout
  • Custom content support
  • GitHub API integration
  • Error handling
  • Loading states
  • TypeScript support
  • SSR compatibility
  • Accessibility features

Props

PropTypeDescriptionDefault
repositorystringThe GitHub repository in format "owner/repo"Required
githubTokenstringOptional GitHub OAuth token for API requestsundefined
titlestringCustom title text"Proudly open-source"
descriptionstringCustom description text"Our source code is available..."
buttonTextstringCustom button text"Star on GitHub"
classNamestringAdditional CSS classesundefined