skip section navigation

GitHubStars

GitHubStars links to a repository and can show a star count you already have. it doesn’t fetch GitHub data, so rendering the link doesn’t need an API request or token.

Star ciabi/loafkit on GitHub

usage

svelte
<script>
	import { GitHubStars } from '@ciabi/loafkit-ui';
</script>

<GitHubStars repository="ciabi/loafkit" />

the component accepts letters, digits, dots, underscores and hyphens in each part, excluding . and .. as whole parts. invalid input renders an explanatory span instead of a link.

only a nonnegative safe integer is displayed; zero is a real count, while null, negative and noninteger values hide it. the visible number is formatted with en-US grouping.

anchor attributes other than href and children are supported, including class, style, target and rel. the destination always comes from repository. if you load a current count in your app, handle caching and failed requests there and keep the repository link useful without it.

API reference

GitHubStars

Component
repository

repository path in owner/repository form.

count

a nonnegative safe-integer star count supplied by your app.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.