RepoActivity
A repository's commits for the period, split by branch in one bar. Point at a branch to read it alone.
Repository
relay/web · main
218commits this week
5branches
3open
12merged
Installation
Run this in a project that has a components.json. It adds one file, components/tenor-ui/repo-activity.tsx, and no packages.
pnpm dlx shadcn@latest add https://tenor.design/r/repo-activity.jsonNo components.json? Fetch the file. It works in any React project.
curl --create-dirs -o src/components/tenor-ui/repo-activity.tsx https://tenor.design/r/repo-activity.tsxUsage
Every prop is optional. With none, it renders the content you see above.
<RepoActivity />import { RepoActivity } from "@/components/tenor-ui/repo-activity";
export function WeeklyActivity({ onSync }: { onSync: () => void }) {
return (
<RepoActivity
repository="acme/storefront · main"
branches={[
{ name: "main", commits: 142 },
{ name: "feat/checkout", commits: 68 },
{ name: "fix/cart-totals", commits: 23, color: "#ff5c5c" },
]}
stats={[
{ icon: "branch", count: 3, label: "branches" },
{ icon: "pull", count: 4, label: "open" },
{ icon: "merge", count: 19, label: "merged" },
]}
period="this week"
onSync={onSync}
/>
);
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
theme | "dark" | "light" | "dark" | Dark or light palette. |
heading | string | "Repository" | Heading of the card. |
repository | string | "relay/web · main" | Line under the heading, beside the branch icon. |
branches | readonly RepoActivityBranch[] | repoActivityBranches | Branches in bar order. Each one is a segment and a chip. |
stats | readonly RepoActivityStat[] | repoActivityStats | Counts shown above the bar. |
total | number | None | Headline figure. Defaults to the sum of the branches' commits. |
unit | string | "commits" | What the headline and the segments count. |
period | string | "this week" | The period the headline covers. |
syncLabel | string | "Sync" | Text of the button. |
onSync | () => void | None | Called when the button is pressed. |
It also takes every attribute of its root element, such as className and style.
Theming
Set any of these CSS variables on the component or on an ancestor. Each falls back to the look shown here.
--tui-surface--tui-stroke--tui-text--tui-muted--tui-chip--tui-on-text--tui-series-1--tui-series-2--tui-series-3--tui-series-4--tui-series-5--tui-font-sans--tui-font-mono