Skip to content

ProjectCard

Card component for displaying individual project summaries. Uses compound component pattern for flexible composition.

Import

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

Usage

Explicit project prop

tsx
<ProjectCard>
  <ProjectCard.Header project={project} />
  <ProjectCard.Description project={project} />
  <ProjectCard.Tags project={project} />
  <ProjectCard.Stats project={project} />
  <ProjectCard.Status project={project} />
  <ProjectCard.Links project={project} />
</ProjectCard>

With context (inside SmartProjectGrid or ProjectGridProvider)

When used inside a SmartProjectGrid or ProjectGridProvider, the project prop can be omitted — sub-components will read the project from context:

tsx
<SmartProjectGrid projects={projects} showSearch>
  {(project) => (
    <ProjectCard>
      <ProjectCard.Header />
      <ProjectCard.Description />
      <ProjectCard.Tags />
      <ProjectCard.Stats />
      <ProjectCard.Status />
      <ProjectCard.Links />
    </ProjectCard>
  )}
</SmartProjectGrid>

Props

ProjectCard (Root)

PropTypeRequiredDescription
childrenReact.ReactNodeYesChild components to render inside the card
projectProjexProjectNoOptional project data (used for data attributes on the root element)

ProjectCard.Header

PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.

ProjectCard.Description

PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.

Returns null if project.description is empty.

ProjectCard.Tags

PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.

Returns null if project.stack is empty.

ProjectCard.Stats

PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.

Returns null if project.stats is empty or contains no values.

ProjectCard.Status

PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.
PropTypeRequiredDescription
projectProjexProjectNoProject data to display. Falls back to context if omitted.

Returns null if no links are available.

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-links-Links container
data-projex-status-Status badge
data-projex-status-valueactive | shipped | ...Current status
data-projex-type-Type badge
data-projex-type-valuegithub | npm | ...Project type
data-projex-tag-Individual tag
data-projex-link-Link element
data-projex-link-typegithub | live | docs | demo | npm | product-hunt | customLink type
data-projex-link-labelstringCustom link label
data-projex-statstars | forks | downloads | version | upvotes | commentsStat type
data-projex-github-card-Present when project type is 'github'
data-projex-og-imagestringOpenGraph image URL (if project has image)
data-projex-og-titlestringOpenGraph title (project name)
data-projex-og-descriptionstringOpenGraph description (if project has description)

Example

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

function ProjectShowcase({ projects }) {
  return (
    <div className="grid grid-cols-3 gap-4">
      {projects.map((project) => (
        <ProjectCard key={project.id}>
          <ProjectCard.Header project={project} />
          <ProjectCard.Description project={project} />
          <ProjectCard.Tags project={project} />
          <ProjectCard.Stats project={project} />
          <ProjectCard.Status project={project} />
          <ProjectCard.Links project={project} />
        </ProjectCard>
      ))}
    </div>
  )
}