UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Animate UI/GitHub Stars Button

Backgrounds
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

GitHub Stars Button

A button showing a repository's GitHub stars, counted up with a filling star.

npx shadcn@latest add https://animate-ui.com/r/buttons-github-stars.json
Open in v0 Docs Repo
Library
Animate UI
License
MIT + Commons Clause

Free to use in your apps; you can’t resell the components themselves.

Stack
React · Tailwind CSS · animated
Packages
@animate-ui/reactclass-variance-authoritycnmotion
Size
115 lines
Demo
Written by UIPin: the library doesn’t ship a usage example, so the preview uses one of ours (in the code below).

Code

@components/animate-ui/buttons/github-stars.tsx

'use client';

import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import {
  Button,
  type ButtonProps,
} from '@animate-ui/react/primitives/buttons/button';
import {
  GithubStars,
  GithubStarsIcon,
  GithubStarsLogo,
  GithubStarsNumber,
  GithubStarsParticles,
  type GithubStarsIconProps,
  type GithubStarsLogoProps,
  type GithubStarsNumberProps,
  type GithubStarsParticlesProps,
} from '@animate-ui/react/primitives/github-stars';
import type { UseIsInViewOptions } from '@animate-ui/react/utils/use-is-in-view';
import { cn } from 'cn';

const githubStarsButtonVariants = cva(
  "focus-visible:border-ring focus-visible:ring-ring/50 inline-flex shrink-0 items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      variant: {
        default: 'bg-primary text-primary-foreground hover:bg-primary/90',
        accent: 'bg-accent text-accent-foreground hover:bg-accent/90',
        outline:
          'bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border',
        ghost: 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50',
      },
      size: {
        default: 'h-9 px-4 py-2 has-[>svg]:px-3',
        sm: 'h-8 gap-1.5 px-3 has-[>svg]:px-2.5',
        lg: 'h-10 px-6 has-[>svg]:px-4',
      },
    },
    defaultVariants: {
      variant: 'default',
      size: 'default',
    },
  },
);

type GitHubStarsButtonProps = ButtonProps &
  UseIsInViewOptions &
  VariantProps<typeof githubStarsButtonVariants> & {
    username?: string;
    repo?: string;
    value?: number;
    delay?: number;
  };

function GitHubStarsButton({
  ref,
  username,
  repo,
  value,
  delay,
  inView,
  inViewMargin,
  inViewOnce,
  variant,
  size,
  className,
  ...props
}: GitHubStarsButtonProps) {
  return (
    <GithubStars
      asChild
      ref={ref as React.Ref<HTMLDivElement>}
      username={username}
      repo={repo}
      value={value}
      delay={delay}
      inView={inView}
      inViewMargin={inViewMargin}
      inViewOnce={inViewOnce}
    >
      <Button
        data-slot="github-stars-button"
        className={cn(githubStarsButtonVariants({ variant, size }), className)}
        {...props}
      />
    </GithubStars>
  );
}

const GitHubStarsButtonLogo = GithubStarsLogo;
const GitHubStarsButtonNumber = GithubStarsNumber;
const GitHubStarsButtonIcon = GithubStarsIcon;
const GitHubStarsButtonParticles = GithubStarsParticles;

type GitHubStarsButtonLogoProps = GithubStarsLogoProps;
type GitHubStarsButtonNumberProps = GithubStarsNumberProps;
type GitHubStarsButtonIconProps<T extends React.ElementType> =
  GithubStarsIconProps<T>;
type GitHubStarsButtonParticlesProps = GithubStarsParticlesProps;

export {
  GitHubStarsButton,
  GitHubStarsButtonLogo,
  GitHubStarsButtonNumber,
  GitHubStarsButtonIcon,
  GitHubStarsButtonParticles,
  githubStarsButtonVariants,
  type GitHubStarsButtonProps,
  type GitHubStarsButtonLogoProps,
  type GitHubStarsButtonNumberProps,
  type GitHubStarsButtonIconProps,
  type GitHubStarsButtonParticlesProps,
};

More like this

Avatar Circles

Magic UI·Media & 3D

Kbd

shadcn/ui·Data display

Carousel

HextaUI·Media & 3D

Carousel

shadcn/ui·Media & 3D

Skeleton

shadcn/ui·Feedback & loaders

Bell Button

Kokonut UI·Buttons

Input Otp

shadcn/ui·Inputs & forms

Toolbar Expandable

Motion Primitives·Navigation

Direction Aware Tabs

Cult UI·Navigation

Cool Mode

Magic UI·Buttons

Toolbar

Kokonut UI·Navigation

Side Panel

Cult UI·Other

Number flow

HextaUI·Text effects

Toolbar Dynamic

Motion Primitives·Navigation

Avatar

shadcn/ui·Media & 3D