Skip to content

Editor

A retained native code editor with syntax coloring, line numbers, indentation, and both-axis 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 { createSignal } from "solid-js";
import { Editor, loadLanguagePack } from "@quickgui/extension-editor";
// quickgui.config.ts
extensions: ["@quickgui/extension-editor"]

#Usage

const [source, setSource] = createSignal("export function answer() { return 42; }\n");

<Editor
  value={source()}
  language="typescript"
  lineNumbers
  tabSize={2}
  onInput={(event) => setSource(event.value ?? "")}
  style={{ width: "100%", height: 360 }}
/>;

#Syntax highlighting

language selects a registered Tree-sitter grammar and highlight query. Query captures map through syntaxTheme to eight foreground-only paint classes, so color never changes text metrics. Source or language changes reparse the bounded document; palette changes only remap retained captures, and scrolling does no syntax work. Parsing is limited to 2 MiB, individual lines over 32 KiB stay plain, and the capture count is capped. This does not require a language server.

#API reference

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

Editor(props: EditorProps): 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
valuestring—

Controlled UTF-8 document.

string
View source
languageEditorLanguage—

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

EditorLanguage
View source
lineNumbersboolean—

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

boolean
View source
tabSizenumber—

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

number
View source
insertSpacesboolean—

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

boolean
View source
autoIndentboolean—

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

boolean
View source
readOnlyboolean—

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

boolean
View source
contentPaddingContentPadding—

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

ContentPadding
View source
gutterPaddingGutterPadding—

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

GutterPadding
View source
gutterBackgroundColorValue—

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

ColorValue
View source
gutterColorColorValue—

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

ColorValue
View source
activeLineBackgroundColorValue—

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

ColorValue
View source
activeLineNumberColorColorValue—

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

ColorValue
View source
syntaxThemeSyntaxTheme—

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

SyntaxTheme
View source