01
Overview
Compact inline display of added, modified, and removed line counts for a file diff.
Choosing this component
- Showing the line-change summary for a single file or commit in a code review, pull-request list, or activity feed.
- Toolbars and compact layouts — use
density="toolbar"to snap to the shared control-height tier. - Suppressing zero-count values cleanly with
zeroVisible={false}when a file has only additions or only deletions.
Choosing something else
- General numeric metrics (revenue, users, errors) — use
StatisticorStatisticGroupfor dashboard figures. - Full diff rendering (side-by-side or unified views of the actual line changes) — DiffStatistics only summarises counts; use a diff renderer component for the actual content.
Related components
Statistic— general-purpose metric tile for non-diff numeric values.StatisticGroup— grid container for multipleStatistictiles.
Usage
02
When to use
Use when
- Surfacing a quick numeric summary of changes alongside or in lieu of a full diff surface.
- Annotating a list of files or pull requests with line-change counts as part of the source-diff-viewer suite.
Avoid when
- Rendering the actual hunked diff content — pair with `DiffViewer` from `@lostgradient/editor` for the full document comparison.
- Generic numeric badges that have nothing to do with diffs — reach for stat or badge instead.
03
Examples
Basic diff statistics
Line-change counts with semantic colors.
04
Props
| Name | Type | Default | Description |
|---|---|---|---|
added required | number | Number of added lines. | |
removed required | number | Number of removed lines. | |
modified required | number | Number of modified lines. | |
variant | 'default' | 'compact' | 'default' | Layout variant. default shows full statistic markup; compact trims it
for tight surfaces. Distinct from density, which adjusts control height. |
density | 'toolbar' | Toolbar density opt-in (compact variant only). When set, pills snap to
the shared --cinder-control-height-sm tier. | |
zeroVisible | boolean | true | Whether zero-value statistics render. Set false to hide them. |