Ballmac UI home

Git Graph

A commit history with lane-routed branch and merge lines, branch and tag labels, authors and dates, selection, and listbox keyboard navigation.

Merge branch 'feature/search' into main

e91c0a7Mergemain

Add fuzzy matching to search results

5a8e3c9feature/search

Fix off-by-one in pagination

b72d4f1v2.4.1

Index titles and descriptions

c04b11d

Merge branch 'hotfix/login' into main

9f3e2a8Merge

Expire stale login sessions

ae52f84hotfix/login

Release 2.4.0

1d7a6b0v2.4.0

Initial commit

03f95de

Installation

$ pnpm dlx shadcn@latest add @ballmac/git-graph

Usage

import { GitGraph, layoutCommits } from "@/components/ballmac/git-graph"

The full example is in the Code tab above.

Examples

Linear history

Bump dependencies

7c1a90emain

Add dark mode to settings

2b8d3f4

Refactor billing hooks

f60e1c2

Set up the project

a49d7b5

Select a commit with the mouse or the arrow keys and Enter.

API reference

PropTypeDefault
commits*

Commits, newest first, parents after children.

GitCommit[]—
selected

Selected commit hash (controlled).

string—
defaultSelected

Initially selected hash when uncontrolled.

string—
onSelect

Called with the hash of the chosen commit.

(hash: string, commit: GitCommit) => void—
label

Accessible name of the list.

string—
hideAuthors

Hide the author column.

booleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
ArrowUp / ArrowDownMoves the active commit
Home / EndFirst or last commit
Enter / SpaceSelects the active commit
Screen readersEach option reads message, author, date, short hash, merge and refs

Use with AI

commits is newest first: [{ hash, parents, message, author, date, branches?, tags? }]. Lanes are computed for you (layoutCommits is exported). selected/onSelect for a detail view. Rows are listbox options. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Git Graph (@ballmac/git-graph) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Repository or release history views
  • Explaining a branching strategy in docs

Not for

  • Diffs (diff-viewer)
  • Huge histories without paging

Registry JSON: https://ui.ballmac.com/r/git-graph.json

Credits

Free to use in personal and commercial projects.