Component reference

Git Branch Visualizer

Branches and commits as a graph. Hover a commit, pick a branch, merge or branch off.

<GitBranchVisualizer variant="minimal" />Clean surfaces and measured motion.

Installation

Use the shadcn CLI to copy the component source and its dependencies into your own project. Installs motion, plus the Ovio theme, world, motion, keys, format, toy, auto-height items.

npx shadcn add JanaSundar/ovio/git-branch-visualizer
↳You own the source. Ovio components arrive in your codebase so you can edit any part of their style, behavior, or data flow.

Usage

Set the visual world on the component, or wrap the page in an OvioProvider to set a default for everything inside it.

TSXvariant="minimal"
import { GitBranchVisualizer } from "@/components/ovio/git-branch-visualizer/git-branch-visualizer"

<GitBranchVisualizer
  variant="minimal"
  commits={commits}
  head="main"
/>

Built with: SVG · Motion for React
Motion in Minimal: Small springs, opacity and layout shifts that show state.

Data

Fetch it on the server with getCommitGraph("owner/name", { limit }) and pass the result as props. The helper is lib/github.ts, added with the CLI.

npx shadcn add JanaSundar/ovio/github
SourceGitHub's GraphQL API: the default branch's last 100 commits with their parents. The newest merges are kept with every commit their branch brought in, up to limit (14); commits pushed straight to the default branch between them are skipped so the branches fit. Merged branches keep the name their merge commit records.
AuthRequired. GraphQL rejects anonymous requests; any GITHUB_TOKEN works.
LimitsOne query per refresh, against 5,000 points an hour per token.
CachingCached for an hour by default (revalidate: 3600), so traffic adds no API calls. A failed refresh keeps serving the last good data, and a spent limit throws RateLimitError with the time it resets.
This demoLive data from JanaSundar/ovio, through the same helper. If the API fails, the sample shows instead.

Props

Control the data, selected world, animation behavior, and callbacks.

PropTypeDescription
commits{ id; branch; message; author; date; parents?; tag? }[]History, oldest first. Two parents make a merge; tag draws a release label.
variant| "minimal" | "craft" | "retro" | "toy"Which world to render. Defaults to the nearest OvioProvider, then minimal.
headstringChecked-out branch. Defaults to the first commit's branch.
repostringHeader label, e.g. "ada-dev/lumen".
value / defaultValuestringSelected commit id, controlled or not. Defaults to the newest.
onValueChange(id: string, commit) => voidFires when the selected commit changes.
actionsbooleanShows Merge, Branch from and Reset, played out locally. Default true.
onMerge(commit) => voidFires with the merge commit.
onBranch(branch: string, from) => voidFires with the new branch and the commit it starts from.
classNamestringMerged onto the root.