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-editorimport { 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 sourceDiffView(props: DiffViewProps): NativeNodeaccessibilityLabelstring—
Declares accessibilityLabel (optional). Reactive JSX expressions update this property in place.
stringView sourcestyleStyleProp—
Layout, typography, paint, and interaction-state styles. Arrays merge left to right.
StylePropView sourcedisabledboolean—
Declares disabled (optional). Reactive JSX expressions update this property in place.
booleanView sourceinvalidboolean—
Expose web-style invalid state; the `style.invalid` variant paints while it is set.
booleanView sourceselectedboolean—
Expose web-style selected state; the `style.selected` variant paints while it is set.
booleanView sourcegroupboolean | 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 | stringView sourcerolestring—
tabIndexnumber—
Declares tabIndex (optional). Reactive JSX expressions update this property in place.
numberView sourcefocusOnPointerboolean—
overlayboolean—
focusTrapboolean—
restorePreviousFocusboolean—
autoFocusboolean—
aria-modalboolean—
ariaModalboolean—
Declares ariaModal (optional). Reactive JSX expressions update this property in place.
booleanView sourcedismissOnEscapeboolean—
Declares dismissOnEscape (optional). Reactive JSX expressions update this property in place.
booleanView sourcedismissOnPointerOutsideboolean—
Declares dismissOnPointerOutside (optional). Reactive JSX expressions update this property in place.
booleanView sourcetooltipstring—
tooltipPlacementPopoverPlacement—
Declares tooltipPlacement (optional). Reactive JSX expressions update this property in place.
PopoverPlacementView sourcetooltipDelaynumber—
tooltipGapnumber—
Declares tooltipGap (optional). Reactive JSX expressions update this property in place.
numberView sourcetooltipViewportMarginnumber—
Declares tooltipViewportMargin (optional). Reactive JSX expressions update this property in place.
numberView sourcehitSlopnumber | string—
Declares hitSlop (optional). Reactive JSX expressions update this property in place.
number | stringView sourcehitSlopTopnumber | string—
Declares hitSlopTop (optional). Reactive JSX expressions update this property in place.
number | stringView sourcehitSlopRightnumber | string—
Declares hitSlopRight (optional). Reactive JSX expressions update this property in place.
number | stringView sourcehitSlopBottomnumber | string—
Declares hitSlopBottom (optional). Reactive JSX expressions update this property in place.
number | stringView sourcehitSlopLeftnumber | string—
Declares hitSlopLeft (optional). Reactive JSX expressions update this property in place.
number | stringView sourcearia-labelstring—
Declares aria-label (optional). Reactive JSX expressions update this property in place.
stringView sourceariaLabelstring—
Declares ariaLabel (optional). Reactive JSX expressions update this property in place.
stringView sourceref((node: NativeNode) => void) | NativeNode—
Declares ref (optional). Reactive JSX expressions update this property in place.
((node: NativeNode) => void) | NativeNodeView sourceonClickEventHandler—
Declares onClick (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonMouseEnterEventHandler—
Declares onMouseEnter (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonMouseLeaveEventHandler—
Declares onMouseLeave (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonPointerEnterEventHandler—
Declares onPointerEnter (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonPointerLeaveEventHandler—
Declares onPointerLeave (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonPointerEventHandler—
Captured pointer stream from press through release/cancel, including outside the element.
EventHandlerView sourceonInputEventHandler—
Declares onInput (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonChangeEventHandler—
Declares onChange (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonSubmitEventHandler—
Declares onSubmit (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonDismissEventHandler—
Declares onDismiss (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonKeyDownEventHandler—
Focused key press. Declare a `tabIndex` to make an ordinary container focusable.
EventHandlerView sourceonKeyUpEventHandler—
Declares onKeyUp (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonMouseDownEventHandler—
Declares onMouseDown (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonMouseUpEventHandler—
Declares onMouseUp (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonMouseMoveEventHandler—
Declares onMouseMove (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonDoubleClickEventHandler—
onWheelEventHandler—
Declares onWheel (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonContextMenuEventHandler—
onPinchEventHandler—
Declares onPinch (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonRotateEventHandler—
Declares onRotate (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonSmartMagnifyEventHandler—
Declares onSmartMagnify (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonPressureEventHandler—
Declares onPressure (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonFocusEventHandler—
Declares onFocus (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonBlurEventHandler—
Declares onBlur (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourcekeymapKeymap—
onActionEventHandler—
draggableboolean | DragSource—
onDragStartEventHandler—
Declares onDragStart (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonDragEndEventHandler—
Declares onDragEnd (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourcedropKindsDropKind | readonly DropKind[]—
Payload kinds this element accepts, declared ahead of the native drag.
DropKind | readonly DropKind[]View sourceonDropEventHandler—
Declares onDrop (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourceonFilesDroppedEventHandler—
Declares onFilesDropped (optional). Reactive JSX expressions update this property in place.
EventHandlerView sourcepatchstring—
oldTextstring—
newTextstring—
oldPathstring—
Declares oldPath (optional). Reactive JSX expressions update this property in place.
stringView sourcenewPathstring—
Declares newPath (optional). Reactive JSX expressions update this property in place.
stringView sourceoptionsDiffViewOptions—
Declares options (optional). Reactive JSX expressions update this property in place.
DiffViewOptionsView sourcepresentationDiffPresentation—
Declares presentation (optional). Reactive JSX expressions update this property in place.
DiffPresentationView sourcethemeDiffTheme—
Declares theme (optional). Reactive JSX expressions update this property in place.
DiffThemeView sourcesyntaxThemeSyntaxTheme—
Declares syntaxTheme (optional). Reactive JSX expressions update this property in place.
SyntaxThemeView source