Back to gallery

Diff

View modes

Unified or split, indicator style, overflow, hunk separators, intra-line highlighting and the theme type. The defaults are the library's: bars, line-info separators, scroll and word-alt.

Style
Indicators
Overflow
Separators
Line diff
Language
Code themes light
Code themes dark
Theme type
Configurable diff
Word-level highlighting (word-alt)
Sizes: library default (12px, 1.8x) and a consumer's 13px with the roomy line height of a one-line hunk
No newline at end of file
Split with an added and a deleted file

Context expansion

Collapsed unchanged lines have expander buttons: up, down, both and expand all (chunked above 20 lines in a code diff, 100 in a bare view). Shift-click expands everything. The partial diffs below load their files first; the loader takes 1.5 seconds, so the spinner and the loading label show.

Full diff, bare view (100 line chunks)
Partial diff, loader succeeds after 1.5s
Partial diff, first load fails, retry works

File header

The header toggles the file body (the chevron button has the label 'Toggle file diff'); Alt-click toggles every diff in the same scope. The trailing group shows the line counts, the file actions on hover, the open button and the toggle. The long path truncates and shows a tooltip after 200ms when it overflows. The full-review header adds a file actions menu.

No action yet

Default header, scope 'gallery' (Alt-click toggles A and B together)
Narrow container with a long path
Full-review header with the actions menu and hunk actions
Action buttons: file, hunk and section scopes
file
hunk
section
+12-3+12-3

File-type icons

The full-review header starts with the icon of the file type: the resolver reads the base name, then the name table, the react and sass variants, the extension table and falls back to the default glyph. The glyph takes the color of its token as a light and dark pair.

Annotations, hover and selection

Hover highlights a line and shows the gutter button. A press on a line number starts a selection and a drag over line numbers or line text extends it; Shift-press extends the selected range; pressing the only selected line and releasing unselects it; a drag from the gutter button selects and calls onGutterUtilityClick. A touch press first shows the button on the pressed number. selectedLinesOptions sets the highlighted column and number-only highlighting.

Hover highlight
Highlight column (selectedLinesOptions.activeLineSide)
unified, selectedLines prop

No line interaction yet

split, selectedLines prop

No line interaction yet

split, no selectedLines prop

No line interaction yet

Context menu

A right click, the ContextMenu key or Shift+F10 on a diff opens the menu: Request changes, Open in the preferred app, Open with (New tab and the apps), Open in GitHub, Copy selection (enabled with selected text), Copy path, Copy relative path and Toggle line wrap. With window.electronBridge the template goes to the shell and the operating system draws the menu; without it the in-page menu is used.

Context menu on a diff
disableNativeContextMenu: always the in-page menu
[]

Large files

The line diff has no edit-distance cap (a cap of 4,000 edits would show the first example as one replaced block of 50,000 lines, over the limit): the Myers search runs to the shortest edit script, as the source's diff library does when it is given no maxEditLength or timeout. The panel limits are the source's own: over 15,000 changed lines, 3,145,728 changed characters or a changed line over 1,048,576 characters show 'This file is too large to display here.', and over 2,000 changed lines the word-level highlight is off.

No large diff yet

Empty, error and loading states

Loading placeholder, load failure with Retry, partial-content failure, binary, rename without changes, empty, too large (over 15,000 changed lines, here with an Open in editor button) and a renderer crash.

Retries pressed: 0

Loading
Failed to load after retrying
Full file content failed to load
Binary file
Renamed without changes
No content
Too large, can open in editor
Renderer crash

Inline review

Inline review: a unified diff with a footer of word wrap, Edit, Reject and Accept. Compact shows the old and new text as blocks. Accept and Edit can be disabled, and a change over 262,144 characters or 5,000 lines is refused.

No review action yet

Full
Compact
first line second line third line first line second line, edited third line fourth line
Accept and Edit disabled
Too large to preview
Change is too large to preview

Hover preview

Hovering a reference opens an interactive tooltip above it after 800ms (a second reference opens at once while the first was just open). The preview scrolls, and Enter or Space on it opens the file.

Preview not opened

Page code-block preview (word wrap)
src/example.ts
notes.txt

Light and dark

Each panel sets its own theme scope, so the appearance control above does not change them. The two lower panels nest the opposite theme inside, and the nested diffs follow the nearest scope.

Light theme

Dark theme

Dark theme, with a light panel inside

Light theme, nested in dark

Light theme, with a dark panel inside

Dark theme, nested in light

Right to left

In a right-to-left container the header mirrors, and the path keeps its left-to-right text direction (the button uses direction: rtl for truncation and the spans restore ltr).