Logoshadcn-docs-template
DocsDemo
Sections
  • Get Started
Getting Started
  • Introduction
  • Installation
Customization
  • Customizing the Template
  • MDC Components
  • Composables
  • Writing Documentation
Components
  • DocTabs
  • Callout
  • ComponentPreview
  • CommandMenu
  • CopyButton
  • DocsSidebar
  • DocsTableOfContents
  • PageHeader
  • SiteHeader
  • CopyCodeButton
  • DocsCopyPage
  • CodeBlockCommand
  • CommandMenuItem
  • CommandMenuKbd
  • GitHubLink
  • LucideIcon
  • MainNav
  • MobileNav
  • ModeSwitcher
  • PageHeaderDescription
  • PageHeaderHeading
  • SiteBody
  • SiteConfig
  • SiteFooter
  • OgImage (Custom)

GitHubLink

PreviousNext

A button component that links to your GitHub repository and displays the star count.

The GitHubLink component displays a link to your GitHub repository with a live star count.

Usage

<script setup lang="ts">
import { GitHubLink } from '@/components/GitHubLink'
</script>

<template>
  <GitHubLink />
</template>

Features

Star Count

  • Fetches star count from Ungh API
  • Displays formatted count (e.g., "1.2k" for 1200+ stars)
  • Shows skeleton loader while fetching
  • Caches data for 12 hours

Configuration

Uses siteConfig.links.ungh for the API endpoint:

// app/lib/siteConfig.ts
export const siteConfig = {
  links: {
    ungh: "https://ungh.cc/repos/username/repo",
  },
}

API Reference

GitHubLink

No props. Automatically uses configuration from siteConfig.

Behavior

  • Fetches star count on mount
  • Caches data in Nuxt payload
  • Shows skeleton while loading
  • Displays formatted star count or "—" if unavailable
  • Links to siteConfig.links.github

Customization

Update the GitHub URL in siteConfig.links.github:

export const siteConfig = {
  links: {
    github: "https://github.com/your-username/your-repo",
    ungh: "https://ungh.cc/repos/your-username/your-repo",
  },
}
CommandMenuKbdLucideIcon

On This Page

UsageFeaturesStar CountConfigurationAPI ReferenceGitHubLinkBehaviorCustomization
© shadcn-vue.com