GitHub Stars

Display GitHub repo star count with formatted numbers and full-count tooltip.

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.

Loading stars...

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.