Slint Kit Documentation

Virtualized data

KitDataTable

Data table with virtualized rows and controller-requested sorting.

Data table with virtualized rows and controller-requested sorting.
Native screenshot of the same example, rendered with Skia.

Supply columns, rows, generation and active-index from a stable-identity model. Handle sort-requested(column-token), navigate and activate(row-token, generation).

Headers present DataSortDirection.unsorted, .ascending or .descending without sorting locally. The viewport stays finite, columns can scroll horizontally, and reveal-active() shows the active row.

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 { DataAlignment, DataSortDirection, KitDataTable, KitTheme, KitThemes } from "@kit/kit.slint";

export component Example inherits Window {
    title: "KitDataTable example";
    preferred-width: 620px;
    preferred-height: 400px;
    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: "Data Table"; color: root.theme.text-primary; font-size: 20px * root.theme.text-scale; font-weight: 600; }
        KitDataTable { theme: root.theme; height: 250px; generation: 1; columns: [{ token: 11, label: "Project", sortable: true, sort: DataSortDirection.ascending, alignment: DataAlignment.leading }, { token: 23, label: "Status", sortable: true, sort: DataSortDirection.unsorted, alignment: DataAlignment.leading }, { token: 38, label: "Owner", sortable: false, sort: DataSortDirection.unsorted, alignment: DataAlignment.leading }]; rows: [{ token: 101, cells: ["Field notes", "In progress", "Alex"], selected: true, disabled: false }, { token: 205, cells: ["Design system", "Review", "Jamie"], selected: false, disabled: false }, { token: 309, cells: ["Launch plan", "Draft", "Taylor"], selected: false, disabled: false }]; activate(token, generation) => { root.status = "Project token " + token; } }
        if root.status != "": Text { text: root.status; color: root.theme.text-secondary; font-size: 12px * root.theme.text-scale; wrap: word-wrap; }
    }
}

Download this example

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
control-size ControlSize in
columns [TableColumn] in
rows [TableRow] in
generation int in
active-index int in
label string in
minimum-column-width length 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 ControlSize compact, medium, comfortable
enum DataAlignment leading, center, trailing
enum DataSortDirection unsorted, ascending, descending
enum NavigationStep next, previous, first, last, page-next, page-previous
struct TableColumn token: int, label: string, sortable: bool, sort: DataSortDirection, alignment: DataAlignment
struct TableRow token: int, cells: [string], selected: bool, disabled: bool

Callbacks

Functions

See also