Display GitHub repo star count with formatted numbers and full-count tooltip.
Installation
Copy the Source Code
Copy and paste the following code into your project:
github-stars.svelte
index.ts
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.
| Name | Type | Default | Description |
|---|---|---|---|
repo | string | required | GitHub repository in owner/repo format. |
stargazersCount | number | required | Number of stars to display. |
locales | Intl.LocalesArgument | 'en-US' | Locale or locales used to format the star count. |