GooseUI

Components

GitHub Star Dialog


Modal asking to star your open source project. A big counter ticks up to the current star count over an aurora of glowing dots, the title offers the next place (“Be the 34th”), and the GitHub button bursts into stars. It is a native <dialog>: the browser handles the focus trap, Escape and the top layer. The aurora is pure CSS (blurred blobs under a dot-grid mask plus film grain), inspired by Aurora Dots and Film Grain from Glint UI. JavaScript fetches the star count, ticks the counter, opens the dialog on a trigger or a timer and remembers the choice in localStorage.

Browser Support

Limited availability
9 features
Details
<dialog>

Displays the modal dialog

Your browser:
@starting-style

Animates the entry

Your browser:
transition-behavior

Animates closing

Your browser:
:has()

Locks page scrolling while open

Your browser:
::backdrop

Dims and blurs the page behind

Your browser:
Masks

Cuts the aurora into a dot grid

Your browser:
mix-blend-mode

Blends the film grain

Your browser:
color-mix()

Tints the counter glow with the theme color

Your browser:
text-wrap: pretty

Improves text wrapping

Your browser:

Preview

Click the button to open the dialog.

33 people have already starred

Be the 34th

Every star lifts GooseUI in GitHub search. Yours will be number 34.

Installation

npx shadcn@latest add @gooseui/github-star-dialog
pnpm dlx shadcn@latest add @gooseui/github-star-dialog
yarn dlx shadcn@latest add @gooseui/github-star-dialog
bunx --bun shadcn@latest add @gooseui/github-star-dialog

Usage

import { Button } from "@/components/ui/button"
import { GitHubStarDialog } from "@/components/ui/github-star-dialog"

export default function Page() {
  return (
    <GitHubStarDialog
      owner="goosen-x"
      repo="gooseui"
      trigger={<Button>Support us</Button>}
    />
  )
}

Examples

Goal

Pass goal to show a slim progress bar under the counter. Its label is goalText.

33 people have already starred

17 to go

Be the 34th

Every star lifts GooseUI in GitHub search. Yours will be number 34.

<GitHubStarDialog
  owner="goosen-x"
  repo="gooseui"
  goal={50}
  goalText={(remaining, goal) => remaining > 0 ? `${remaining} to ${goal}` : "Goal reached!"}
/>

Translation

Every text is a prop. Titles, the badge and the description accept functions that get the number and its formatted form, so you can handle plurals and ordinals in any language. locale formats the numbers.

<GitHubStarDialog
  owner="goosen-x"
  repo="gooseui"
  locale="de-DE"
  title={(next, formatted) => `Werde Nummer ${formatted}`}
  badge={(stars, formatted) => `${formatted} Sterne bisher`}
  description="Jeder Stern hilft anderen, das Projekt zu finden."
  thanksText="Danke!"
  closeLabel="Schließen"
  dismissText="Später"
  ctaText="Auf GitHub markieren"
/>

Auto-open

The dialog opens once, 20 seconds after the page loads. If the user dismisses it or clicks the GitHub button, it will not open on its own again.

<GitHubStarDialog
  owner="goosen-x"
  repo="gooseui"
  defaultOpen
  delay={20000}
  storageKey="gooseui-star-dialog"
/>

Live star count

Without initialStars the count is fetched from the GitHub API. Unauthenticated requests are limited to 60 per hour per IP, so in production pass a cached value from the server.

Be the 1st

Every star lifts GooseUI in GitHub search. Yours will be number 1.

// Server component
const res = await fetch("https://api.github.com/repos/goosen-x/gooseui", {
  next: { revalidate: 3600 },
})
const { stargazers_count } = await res.json()

<GitHubStarDialog owner="goosen-x" repo="gooseui" initialStars={stargazers_count} />

Controlled mode

const [open, setOpen] = React.useState(false)

<GitHubStarDialog
  owner="goosen-x"
  repo="gooseui"
  open={open}
  onOpenChange={setOpen}
  onStar={() => track("star_click")}
/>

Props

Props

PropTypeDefaultDescription
ownerstring-Repository owner on GitHub
repostring-Repository name on GitHub
goalnumber-Star goal. When set, a progress bar toward it appears
initialStarsnumber-Star count to use instead of a GitHub request
localestring"en-US"Locale for number formatting
titleReactNode | (next, formatted) => ReactNode"Be the {next}th"Dialog title. A function gets the next number and its formatted form
descriptionReactNode | (next, formatted) => ReactNode-Text below the title. A function gets the next number and its formatted form
badgeReactNode | (stars, formatted) => ReactNode | null"{stars} people have already starred"Pill under the counter. A function gets the star count and its formatted form. null hides it
thanksTextReactNode"Thank you!"Title after the GitHub button is clicked
goalTextReactNode | (remaining, goal) => ReactNode"{remaining} to go"Label next to the progress bar. Gets the stars left and the formatted goal
progressLabelstring"Stars progress"Accessible name of the progress bar
closeLabelstring"Close"Accessible name of the close button
dismissTextReactNode"Maybe later"Secondary button text
ctaTextReactNode"Star on GitHub"Primary button text
triggerReactElement-Element that opens the dialog. It receives an onClick handler
openboolean-Controlled open state
onOpenChange(open: boolean) => void-Open state change handler
defaultOpenbooleanfalseOpen automatically on mount
delaynumber0Delay before auto-open, ms
storageKeystring-localStorage key. After dismissal or a star, auto-open stops
onStar() => void-Called when the GitHub button is clicked
classNamestring-Additional classes for the dialog

Features

  • Aurora of glowing dots and film grain in pure CSS, no WebGL
  • Counter ticks up to the live star count from the GitHub API
  • “Be the Nth” title with correct ordinals, star burst on click
  • Every text is a prop, with functions for plurals and ordinals
  • Auto-open with a delay and dismissal remembered via localStorage
  • Native <dialog>: focus trap, close on Escape and backdrop click
  • Respects prefers-reduced-motion: the aurora and the counter stand still