KitVirtualTextView
Virtualized document view with native editing of the selected line.

Supply lines, generation and active-index, then choose TextViewAccess.read-only or .edit-line. In edit mode, bind line-draft and handle select-line, commit-line and copy-requested.
Callbacks retain the line token and generation even after reordering. The view edits a selected line; use KitTextArea to edit a complete multiline buffer.
Complete example
This complete Slint file is a visual composition used to produce the screenshot above. Internal strings without a label property retain the kit’s default language; system dialogs follow the host platform. Projected state and callbacks requesting a decision need host wiring; the standalone fixture does not supply that controller. Set up the Rust project, then see the typed controller application for working editing, validation and selection.
// SPDX-License-Identifier: GPL-3.0-or-later
import { KitTheme, KitThemes, KitVirtualTextView } from "@kit/kit.slint";
export component Example inherits Window {
title: "KitVirtualTextView example";
preferred-width: 620px;
preferred-height: 360px;
max-width: 100000px;
max-height: 100000px;
background: root.theme.canvas;
in-out property <KitTheme> theme: KitThemes.light;
in-out property <string> status;
VerticalLayout {
padding: 24px; spacing: 16px; alignment: start;
Text { text: "Virtual Text View"; color: root.theme.text-primary; font-size: 20px * root.theme.text-scale; font-weight: 600; }
KitVirtualTextView { theme: root.theme; height: 230px; generation: 1; lines: [{ token: 101, number: 1, text: "# Field notes", selected: false }, { token: 205, number: 2, text: "A shared space for observations.", selected: true }, { token: 309, number: 3, text: "Keep identities stable as rows move.", selected: false }, { token: 413, number: 4, text: "Use native editing for selected lines.", selected: false }]; }
if root.status != "": Text { text: root.status; color: root.theme.text-secondary; font-size: 12px * root.theme.text-scale; wrap: word-wrap; }
}
}
Public API
Inherits Rectangle.
The declarations below come from the component source. Parent properties remain available; see the controller guide for state management.
Properties
| Name | Type | Direction |
|---|---|---|
theme |
KitTheme |
in |
lines |
[TextLine] |
in |
generation |
int |
in |
active-index |
int |
in |
access |
TextViewAccess |
in |
line-draft |
string |
in-out |
error |
string |
in |
label |
string |
in |
scroll-y |
length |
out |
Types and variants
Names below use Slint syntax. Shared Rust domain types live in slint_kit; presentation enums come from the Rust types generated by Slint.
| Type | Declaration |
|---|---|
enum NavigationStep |
next, previous, first, last, page-next, page-previous |
struct TextLine |
token: int, number: int, text: string, selected: bool |
enum TextViewAccess |
read-only, edit-line |
Callbacks
navigate(NavigationStep)select-line(int,int)commit-line(int,int,string)copy-requested(int,int)
Functions
take-focus()