nook
Browse the docs

Components

Commit History

Native

A list of commits joined by a line, with hashes, authors and refs.

See the prompt
  1. Add saved filters to the task listmainv2.4.0

    Maya Chen committed

    9c8bbeb
  2. Merge branch 'fix/checkout-total'

    Arif Rahman committed

    e497c95
  3. Fix rounding of the checkout totalfix/checkout-total

    Arif Rahman committed

    2737990
  4. Speed up search with an index

    Lena Fischer committed

    237609a

Installation

npx nook-ui@latest add commit-history

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Commit History" component to this project, exactly as Nook ships it.

A list of commits joined by a line, with hashes, authors and refs.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add commit-history`. It writes `components/ui/commit-history.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/commit-history.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

```tsx
import { Commit, CommitHistory } from "@/components/ui/commit-history";

export default function CommitHistoryDefault() {
  return (
    <CommitHistory className="max-w-lg">
      <Commit href="#c1" message="Add saved filters to the task list" hash="9c8bbeb" author="Maya Chen" time="2 hours ago" dateTime="2026-11-14T08:10" refs={["main", "v2.4.0"]} />
      <Commit href="#c2" message="Merge branch 'fix/checkout-total'" hash="e497c95" author="Arif Rahman" time="5 hours ago" dateTime="2026-11-14T05:02" merge />
      <Commit href="#c3" message="Fix rounding of the checkout total" hash="2737990" author="Arif Rahman" time="yesterday" dateTime="2026-11-13T16:40" refs={["fix/checkout-total"]} />
      <Commit href="#c4" message="Speed up search with an index" hash="237609a" author="Lena Fischer" time="2 days ago" dateTime="2026-11-12T11:15" />
    </CommitHistory>
  );
}
```

API
- `CommitHistory`: The list.
- `Commit`: One commit.
  - `message` (`ReactNode`): The first line of the commit message.
  - `hash` (`string`): The short hash.
  - `author` (`string`): Who made it.
  - `time` (`string`): When, written for people: "2 hours ago".
  - `refs` (`string[]`): Branches and tags that point at it.
  - `href` (`string`): Makes the message a link.
  - `merge` (`boolean`): Marks a merge commit.

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: An ordered list, newest first. Times use the `time` element. Merge commits are told apart by their message as well as the hollow dot.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

import { Commit, CommitHistory } from "@/components/ui/commit-history";

export default function CommitHistoryDefault() {
  return (
    <CommitHistory className="max-w-lg">
      <Commit href="#c1" message="Add saved filters to the task list" hash="9c8bbeb" author="Maya Chen" time="2 hours ago" dateTime="2026-11-14T08:10" refs={["main", "v2.4.0"]} />
      <Commit href="#c2" message="Merge branch 'fix/checkout-total'" hash="e497c95" author="Arif Rahman" time="5 hours ago" dateTime="2026-11-14T05:02" merge />
      <Commit href="#c3" message="Fix rounding of the checkout total" hash="2737990" author="Arif Rahman" time="yesterday" dateTime="2026-11-13T16:40" refs={["fix/checkout-total"]} />
      <Commit href="#c4" message="Speed up search with an index" hash="237609a" author="Lena Fischer" time="2 days ago" dateTime="2026-11-12T11:15" />
    </CommitHistory>
  );
}

Props

CommitHistory

The list.

Commit

One commit.

PropTypeDefaultDescription
messageReactNode–The first line of the commit message.
hashstring–The short hash.
authorstring–Who made it.
timestring–When, written for people: "2 hours ago".
refsstring[]–Branches and tags that point at it.
hrefstring–Makes the message a link.
mergeboolean–Marks a merge commit.

Accessibility

An ordered list, newest first. Times use the `time` element. Merge commits are told apart by their message as well as the hollow dot.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.