Skip to content

TextField

import { TextField, Vertical } from "@material";
export component Example inherits Window {
width: 200px;
height: 100px;
Vertical {
TextField {
label: "Name";
}
}
}
slint
TextField example

A widget used to enter a single line of text with additional features like icons and supporting text.

booldefault: true

When false, the text field is disabled and cannot be interacted with.

booldefault: false

Indicates whether the text field should display an error state.

bool(out)

Set to true when the text field currently has the focus.

stringdefault: ""

The label text displayed above the text input.

imagedefault: the empty image

An icon displayed at the beginning of the text input.

stringdefault: ""

Additional text displayed below the text input, often used for hints or error messages.

string(in-out)default: ""

The text being edited.

imagedefault: the empty image

An icon displayed at the end of the text input.

enum InputTypedefault: text

Use this to configure TextInput for editing special input, such as password fields.

set-selection-offsets(anchor: int, focus: int)

Section titled “set-selection-offsets(anchor: int, focus: int)”

Selects the text between two UTF-8 offsets: anchor is the end of the selection that stays put and focus the end the cursor moves to, so focus may precede anchor to select backwards. Pass the same value for both to place the text cursor at that offset without selecting anything.

Selects all text in the text field.

Clears the current text selection.

Copies the selected text to the clipboard and removes it from the text field.

Copies the selected text to the clipboard.

Pastes the text content of the clipboard at the cursor position.

Invoked when the enter key is pressed.

Emitted when the text has changed because the user modified it.

Invoked when a key is pressed, the argument is a KeyEvent struct. Use this callback to handle keys before TextField does. Return accept to indicate that you’ve handled the event, or return reject to let TextField handle it.

Invoked when a key is released, the argument is a KeyEvent struct. Use this callback to handle keys before TextField does. Return accept to indicate that you’ve handled the event, or return reject to let TextField handle it.

Invoked when the leading icon is clicked.

Invoked when the trailing icon is clicked.


© 2026 SixtyFPS GmbH