Skip to content

DiffView

A virtualized split or unified file diff with synchronized rows and independent pane scrolling.

No language grammars are included by default. Register a linked grammar in Rust, or load one portable pack of selected Tree-sitter Wasm grammars and queries using loadLanguagePack (TypeScript) / LoadLanguagePack (Go).

Unstyled by default: text and line-number colors inherit, and the component adds no background, border, rounding, padding, or syntax/diff palette. Supply application styles and explicit colors to opt into an appearance.

#Import

bun add @quickgui/extension-editor
import { DiffView } from "@quickgui/extension-editor";
// quickgui.config.ts
extensions: ["@quickgui/extension-editor"]

#Usage

<DiffView
  oldPath="before.ts"
  newPath="after.ts"
  oldText={"export const answer = 41;\n"}
  newText={"export const answer = 42;\n"}
  options={{
    layout: "split",
    indicators: "bars",
    lineNumbers: true,
    language: "typescript",
  }}
  style={{ width: "100%", height: 420 }}
/>

#Syntax highlighting

DiffView uses the same registered Tree-sitter grammars as Editor. When its document, language, or syntax palette changes, the Rust core parses each visible old/new file lane once and assigns capture fragments to logical rows. Styled text is materialized and cached only when a row is mounted, with inline addition/deletion emphasis merged at non-overlapping byte boundaries. Scrolling never invokes the parser.

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

DiffView

View source
DiffView(props: DiffViewProps): NativeNode
accessibilityLabelstring—

Declares accessibilityLabel (optional). Reactive JSX expressions update this property in place.

string
View source
styleStyleProp—

Layout, typography, paint, and interaction-state styles. Arrays merge left to right.

StyleProp
View source
disabledboolean—

Declares disabled (optional). Reactive JSX expressions update this property in place.

boolean
View source
invalidboolean—

Expose web-style invalid state; the `style.invalid` variant paints while it is set.

boolean
View source
selectedboolean—

Expose web-style selected state; the `style.selected` variant paints while it is set.

boolean
View source
groupboolean | string—

Makes this element the group its descendants' `groupHover` and `groupActive` styles follow, like Tailwind's `group`: `true` opens an unnamed group, and a string names it so a descendant can follow it past a nearer group with `groupHover: { group: "name" }`.

boolean | string
View source
rolestring—

Declares role (optional). Reactive JSX expressions update this property in place.

string
View source
tabIndexnumber—

Declares tabIndex (optional). Reactive JSX expressions update this property in place.

number
View source
focusOnPointerboolean—

Keep keyboard focus where it is when this element is activated with a pointer.

boolean
View source
overlayboolean—

Paint this subtree in the viewport overlay plane above embedded native views.

boolean
View source
focusTrapboolean—

Contain keyboard focus within this subtree while it is the topmost trap.

boolean
View source
restorePreviousFocusboolean—

Restore the previously focused mounted control when this surface unmounts.

boolean
View source
autoFocusboolean—

Prefer this control when its containing focus trap takes focus.

boolean
View source
aria-modalboolean—

Expose modal semantics to assistive technology.

boolean
View source
ariaModalboolean—

Declares ariaModal (optional). Reactive JSX expressions update this property in place.

boolean
View source
dismissOnEscapeboolean—

Declares dismissOnEscape (optional). Reactive JSX expressions update this property in place.

boolean
View source
dismissOnPointerOutsideboolean—

Declares dismissOnPointerOutside (optional). Reactive JSX expressions update this property in place.

boolean
View source
tooltipstring—

Delayed, pointer-passive native tooltip text shown while this element is hovered.

string
View source
tooltipPlacementPopoverPlacement—

Declares tooltipPlacement (optional). Reactive JSX expressions update this property in place.

PopoverPlacement
View source
tooltipDelaynumber—

Hover delay in milliseconds, clamped by the Rust core to at most ten seconds.

number
View source
tooltipGapnumber—

Declares tooltipGap (optional). Reactive JSX expressions update this property in place.

number
View source
tooltipViewportMarginnumber—

Declares tooltipViewportMargin (optional). Reactive JSX expressions update this property in place.

number
View source
hitSlopnumber | string—

Declares hitSlop (optional). Reactive JSX expressions update this property in place.

number | string
View source
hitSlopTopnumber | string—

Declares hitSlopTop (optional). Reactive JSX expressions update this property in place.

number | string
View source
hitSlopRightnumber | string—

Declares hitSlopRight (optional). Reactive JSX expressions update this property in place.

number | string
View source
hitSlopBottomnumber | string—

Declares hitSlopBottom (optional). Reactive JSX expressions update this property in place.

number | string
View source
hitSlopLeftnumber | string—

Declares hitSlopLeft (optional). Reactive JSX expressions update this property in place.

number | string
View source
aria-labelstring—

Declares aria-label (optional). Reactive JSX expressions update this property in place.

string
View source
ariaLabelstring—

Declares ariaLabel (optional). Reactive JSX expressions update this property in place.

string
View source
ref((node: NativeNode) => void) | NativeNode—

Declares ref (optional). Reactive JSX expressions update this property in place.

((node: NativeNode) => void) | NativeNode
View source
onClickEventHandler—

Declares onClick (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onMouseEnterEventHandler—

Declares onMouseEnter (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onMouseLeaveEventHandler—

Declares onMouseLeave (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onPointerEnterEventHandler—

Declares onPointerEnter (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onPointerLeaveEventHandler—

Declares onPointerLeave (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onPointerEventHandler—

Captured pointer stream from press through release/cancel, including outside the element.

EventHandler
View source
onInputEventHandler—

Declares onInput (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onChangeEventHandler—

Declares onChange (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onSubmitEventHandler—

Declares onSubmit (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onDismissEventHandler—

Declares onDismiss (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onKeyDownEventHandler—

Focused key press. Declare a `tabIndex` to make an ordinary container focusable.

EventHandler
View source
onKeyUpEventHandler—

Declares onKeyUp (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onMouseDownEventHandler—

Declares onMouseDown (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onMouseUpEventHandler—

Declares onMouseUp (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onMouseMoveEventHandler—

Declares onMouseMove (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onDoubleClickEventHandler—

Second press of one exact native multi-click sequence.

EventHandler
View source
onWheelEventHandler—

Declares onWheel (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onContextMenuEventHandler—

Secondary-button press. Use `ContextMenu` for a declared native menu.

EventHandler
View source
onPinchEventHandler—

Declares onPinch (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onRotateEventHandler—

Declares onRotate (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onSmartMagnifyEventHandler—

Declares onSmartMagnify (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onPressureEventHandler—

Declares onPressure (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onFocusEventHandler—

Declares onFocus (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onBlurEventHandler—

Declares onBlur (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
keymapKeymap—

Bounded accelerator table resolved by the core while this element is focused.

Keymap
View source
onActionEventHandler—

Typed binding id dispatched by `keymap`.

EventHandler
View source
draggableboolean | DragSource—

Declared drag payload promoted when this element starts a drag.

boolean | DragSource
View source
onDragStartEventHandler—

Declares onDragStart (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onDragEndEventHandler—

Declares onDragEnd (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
dropKindsDropKind | readonly DropKind[]—

Payload kinds this element accepts, declared ahead of the native drag.

DropKind | readonly DropKind[]
View source
onDropEventHandler—

Declares onDrop (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
onFilesDroppedEventHandler—

Declares onFilesDropped (optional). Reactive JSX expressions update this property in place.

EventHandler
View source
patchstring—

Captured Git or ordinary unified patch.

string
View source
oldTextstring—

Declares oldText. Reactive JSX expressions update this property in place.

string
View source
newTextstring—

Declares newText. Reactive JSX expressions update this property in place.

string
View source
oldPathstring—

Declares oldPath (optional). Reactive JSX expressions update this property in place.

string
View source
newPathstring—

Declares newPath (optional). Reactive JSX expressions update this property in place.

string
View source
optionsDiffViewOptions—

Declares options (optional). Reactive JSX expressions update this property in place.

DiffViewOptions
View source
presentationDiffPresentation—

Declares presentation (optional). Reactive JSX expressions update this property in place.

DiffPresentation
View source
themeDiffTheme—

Declares theme (optional). Reactive JSX expressions update this property in place.

DiffTheme
View source
syntaxThemeSyntaxTheme—

Declares syntaxTheme (optional). Reactive JSX expressions update this property in place.

SyntaxTheme
View source