Star Count
betaAn animated star counter — plain or as a star button — with the stargazers' avatars beside it. The count is a prop; nothing is fetched.
- Display
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add star-countnpm packages installed: class-variance-authority.
import { StarCount } from "@/components/ui/star-count";Default
Gallery
Pill
Changing
<StarCount>
| Prop | Type | Default |
|---|---|---|
count (required)The number of stars. Fetch it yourself; the component makes no network calls. | number | — |
animateOnMountCount up from zero on mount. When false the count starts settled. | boolean | true |
formatIntl.NumberFormat options, e.g. | Intl.NumberFormatOptions | — |
hrefMakes the counter a link, e.g. to the repository. | string | — |
iconThe icon before the number. Defaults to a filled star. | ReactNode | — |
localesPassed to Intl.NumberFormat, for the digits and the screen-reader text. | Intl.LocalesArgument | — |
maxAvatarsHow many stargazers to show before "+N". | number | 5 |
stargazersPeople who starred, shown as an overlapping avatar group before the count. | AvatarGroupItem[] | — |
stargazersLabelAccessible name of the stargazer list. | string | "Stargazers" |
unitThe unit after the number. Defaults to "star" / "stars". | (count: number) => ReactNode | (value) => (value === 1 ? "star" : "stars") |
variant | "plain" | "pill" | "plain" |
Plus every attribute of <div> except children.
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes