Skip to content

GitHubCard ​

Pre-built card component for GitHub projects. Displays project name, description, stars, forks, language, and commits in a single component.

Installation ​

bash
npx @manningworks/projex add github-card

Import ​

tsx
import { GitHubCard } from '@manningworks/projex'

Usage ​

Basic Usage ​

tsx
<GitHubCard project={project} />

Hide Forks ​

tsx
<GitHubCard project={project} showForks={false} />

Custom Stats Component ​

tsx
<GitHubCard project={project} statsComponent={<MyCustomStats />} />
tsx
<GitHubCard project={project}>
  <div className="mt-4">
    <button>View Details</button>
  </div>
</GitHubCard>

Props ​

GitHubCard (Root) ​

PropTypeRequiredDefaultDescription
projectProjexProjectNo-Project data to display (renders children only if omitted)
showForksbooleanNotrueWhether to display fork count
statsComponentReact.ReactNodeNo-Custom stats component to render instead of default stats
childrenReact.ReactNodeNo-Content to render in card footer

GitHubCard.Header ​

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

GitHubCard.Description ​

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if project.description is empty.

GitHubCard.Tags ​

PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if project.stack is empty.

GitHubCard.Stats ​

PropTypeRequiredDefaultDescription
projectProjexProjectYes-Project data to display
showForksbooleanNotrueWhether to display fork count

Returns null if no stats are available.

GitHubCard.Status ​

PropTypeRequiredDescription
projectProjexProjectYesProject data to display
PropTypeRequiredDescription
projectProjexProjectYesProject data to display

Returns null if no links are available.

PropTypeRequiredDescription
childrenReact.ReactNodeNoContent to render in footer

Returns null if no children are provided.

Data Attributes ​

AttributeValueDescription
data-projex-card-Root card container
data-projex-card-header-Header section
data-projex-card-description-Description section
data-projex-card-tags-Tags container
data-projex-card-stats-Stats container
data-projex-card-footer-Footer content container
data-projex-status-Status badge
data-projex-status-valueactive | shipped | ...Current status
data-projex-language-Language label
data-projex-language-colorstringLanguage color hex value
data-projex-tag-Individual tag
data-projex-link-Link element
data-projex-link-typegithub | liveLink type
data-projex-statstars | forks | commitsStat type
data-projex-stat-iconstars | forks | commitsStat icon indicator

Example ​

tsx
import { GitHubCard } from '@manningworks/projex'

function GitHubProjects({ projects }) {
  return (
    <div className="grid grid-cols-3 gap-4">
      {projects
        .filter((p) => p.type === 'github')
        .map((project) => (
          <GitHubCard key={project.id} project={project} />
        ))}
    </div>
  )
}

Customization ​

As a preset component, GitHubCard is copied to your project and can be freely modified:

tsx
// components/projex/GitHubCard/GitHubCard.tsx
function GitHubCard({ project, showForks = true, statsComponent, children }: GitHubCardProps) {
  // Your customizations here
}