GitHub Stars

A GitHub repository star count with compact formatting and a tooltip for the exact total.

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/github-stars.json

Usage

usage.svelte

Features

  • Displays the star count of a specified GitHub repository
  • Optical alignment for better visual balance with the GitHub icon
  • Formats large numbers for better readability (e.g., 1.2k for 1200)
  • Includes a tooltip that shows the full star count on hover

Examples

Fetch repository stars

Fetch the latest star count from the GitHub REST API.

Props

GithubStars

GitHub repository link with compact and full star counts.

NameTypeDefaultDescription
repostringrequiredGitHub repository in owner/repo format.
stargazersCountnumberrequiredNumber of stars to display.
localesIntl.LocalesArgument'en-US'Locale or locales used to format the star count.