Updated
Git Graph
ProCustomize
Speed0.08s
Colors
Installation
ProGit Graph is a Pro component
Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.
Install with a key
- Add the Pro registry to
components.json:components.json { "registries": { "@uibrik-pro": { "url": "https://uibrik.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/git-graph
Loading your installation…
Usage
import { GitGraph } from "@/components/uibrik/git-graph/git-graph";const commits = [ { hash: "e41c9a2f8b", message: "Merge branch 'feature/timeline'", author: "Ada Lin", date: "12m ago", parents: ["9b07de13c4", "5fa2c81d09"], refs: ["HEAD -> main"], additions: 412, deletions: 37, files: 9 }, { hash: "9b07de13c4", message: "Bump version to 2.4.0", author: "Ravi Shah", date: "1h ago", parents: ["c2d8f0a7e1"], refs: ["tag: v2.4.0"], additions: 2, deletions: 2, files: 1 }, // …12 more];const avatars = { "Ada Lin": "/registry/git-graph/ada.webp", "Ravi Shah": "/registry/git-graph/ravi.webp", "Tom Nash": "/registry/git-graph/tom.webp", "Jo Kim": "/registry/git-graph/jo.webp",};<GitGraph animate speed={0.08} showDetails searchable colors={["#5b7bd6", "#d4875a", "#3f9e7a", "#a372cf"]} commits={commits} avatars={avatars} onSelect={(hash) => {}} // Commit={{ hash: "…", message: "…", author: "…", date: "…", parents: ["…"] }} // selected="…" // defaultSelected="…"/>Where to use Git Graph
Developer tools and Git clients
Lanes are laid out like git log --graph, so branches, merges and tags read the way developers expect.
Pairs with Code Block
Release and deploy history
Tags and HEAD sit on their commits, and selecting one shows who shipped what with its diff stats.
Pairs with Deploy Pipeline
Version history for any document
Hovering a version lights up everything it was built from, which makes branching edits easy to follow.
Pairs with Prompt Versions
Props
GitGraph- animate
- Type boolean
- true
- Play the history in from the oldest commit on mount.
- speed
- Type number
- 0.08
- Seconds between one commit and the next during the playback.
- showDetails
- Type boolean
- true
- Show the selected commit's or range's details under the graph.
- searchable
- Type boolean
- true
- Show the search field above the graph.
- colors
- Type string[]
- ["#5b7bd6","#d4875a","#3f9e7a","#a372cf"]
- Lane colours, from the leftmost lane.
- commits
- Type Commit[]
- SAMPLE_COMMITS
- Newest first, like git log.
- Commit
- Type { hash: string; message: string; author: string; date: string; parents: string[]; refs?: string[]; additions?: number; deletions?: number; files?: number }
- –
- `refs` takes "main", "HEAD -> main" or "tag: v2.4.0". Parents missing from the list run off the bottom.
- selected
- Type string | null
- –
- Selected hash (controlled). Pair with onSelect.
- defaultSelected
- Type string | null
- –
- Hash selected on mount. Defaults to the newest commit.
- onSelect
- Type (hash: string) => void
- –
- Called when a commit is clicked, picked with the arrow keys or reached from a parent link. Shift-click compares a range instead.
- avatars
- Type Record<string, string>
- SAMPLE_AVATARS
- Photo URL for each author name. Authors without one show their initials.
- className
- Type string
- –
- Classes for the card.