Diff Stat

A change's size as lines added and removed, "+297 −2", in green and red.

src/api/client.ts
maya/add-themes
src/ui/Slider.tsx (new)
docs/old-guide.md (deleted)
vendor/ upgrade

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/diff-stat

Usage

import { changeCount, DiffStat } from "./ui/uicontext/components/kit/DiffStat.ts"
export const FileStat = <M>(h: Html.H<M>, before: string, after: string) => DiffStat(h, { ...changeCount(before, after), boxed: true })

API reference

Options

DiffStat options
NameTypeDefaultDescription
additionsrequirednumber——
deletionsrequirednumber——
boxedboolean—In a quiet box, as a badge beside a name
hideZerobooleanoffLeave out a side that's zero: "+83" rather than "+83 −0"; off by default
size"xs" | "sm"——
localestring——

Accessibility

  • The stat is one image named in words, "297 lines added, 2 removed", so color is never the only signal.
  • Numbers use tabular figures and never shorten, so a column of stats lines up.

Source