Skip to content
CelPlume
select · Enteropen · Escclose Powered by Pagefind

GitHub Card

Display GitHub repository cards with githubCard() and githubCards() from the Docs Kit.

githubCard() renders a single GitHub repository card; githubCards() renders a grid (two columns) or a full-width stack. The whole card is a link and the title shows owner/repo. Metadata (description, language) and star/fork counts are fetched from the GitHub API at build time, then refreshed in the browser.

A standalone card is capped at 480px and horizontally centered.

CelPlume/CelestPlumeCelest Plume DocTypeScript00
---
import GitHubCard from '../../../../components/kit/GitHubCard.astro';
---
<GitHubCard owner="CelPlume" repo="CelestPlume" />

githubCards() renders any number of cards in a responsive two-column grid; cards in a row share the height of the tallest one.

---
import GitHubCards from '../../../../components/kit/GitHubCards.astro';
---
<GitHubCards
items={[
{ owner: 'CelPlume', repo: 'CelestPlume' },
{ owner: 'CelPlume', repo: 'BookmarkHarbor' },
]}
/>

Pass layout="stack" to render one card per row, each filling the full row width.

---
import GitHubCards from '../../../../components/kit/GitHubCards.astro';
---
<GitHubCards items={[{ owner: 'CelPlume', repo: 'squoosh' }]} layout="stack" />

GitHubCard takes one set of options; GitHubCards takes items (an array of the same options) plus an optional layout.

OptionTypeDefaultDescription
ownerstringRepository owner (user or organization).
repostringRepository name.
targetstring'_blank'Link target for the repository URL.
authstring''GitHub token for the build-time request.
layout'grid' | 'stack''grid'GitHubCards only: two columns or one card per row.
  • The whole card links to the repository; the title shows owner/repo.
  • Build-time data comes from the GitHub REST API; a failed request renders a plain link card.
  • Star/fork counts and missing metadata refresh in the browser and are cached in localStorage to respect the API rate limit.
  • Requires network access to api.github.com at build and runtime.