Skip to content

Element

Element represents a weak reference to a UI element. Use root_element to access an instance of the root element. Use query_descendants to initiate a query into the sub-tree of elements of this element.

Use the accessible_* properties and functions to introspect and change state in UI elements in an appearance independent way. For more details about the different accessibilty properties, check out the documentation in the Slint language ↗.

Reading a property or calling a function on an element that no longer exists in the UI raises RequestError. Use is_valid to check whether the element still exists. To keep working with an element whose instance gets replaced, obtain it from a query with tracking.

handle: Handle
is_valid: bool

Read-only property that is true if the element reference is still valid, i.e. if the element is still in the UI.

id: str

Read-only property that holds the element’s qualified id.

A qualified id consists of the name of the surrounding component as well as the provided local name, separate by a double colon.

component PushButton {
/* .. */
}
export component App {
mybutton := PushButton { } // known as `App::mybutton`
PushButton { } // no id
}
type_name: str

Read-only property that holds the element’s type name.

bases: list[str]

Read-only property that holds a list of the element’s base types.

component ButtonBase {
/* .. */
}
component PushButton inherits ButtonBase {
/* .. */
}
export component App {
mybutton := PushButton { } // <-- bases is ["PushButton", "ButtonBase"]
}
accessible_role: AccessibleRole

Read-only property that holds the value of the accessible-role property in Slint, if present.

accessible_label: str

Read-only property that holds the value of the accessible-label property in Slint, if present.

accessible_value: str

Read-write property that holds the value of the accessible-value property in Slint.

accessible_value_maximum: float

Read-only property that holds the value of the accessible-value-maximum property in Slint, if present.

accessible_value_minimum: float

Read-only property that holds the value of the accessible-value-minimum property in Slint, if present.

accessible_value_step: float

Read-only property that holds the value of the accessible-value-step property in Slint, if present.

accessible_description: str

Read-only property that holds the value of the accessible-description property in Slint, if present.

accessible_checked: bool

Read-only property that holds the value of the accessible-checked property in Slint, if present.

accessible_checkable: bool

Read-only property that holds the value of the accessible-checkable property in Slint, if present.

accessible_placeholder_text: str

Read-write property that holds the value of the accessible-placeholder-text property in Slint.

accessible_enabled: bool

Read-write property that holds the value of the accessible-enabled property in Slint.

accessible_read_only: bool

Read-write property that holds the value of the accessible-read-only property in Slint.

accessible_item_selectable: bool Slint ≥ 1.18

Read-only property that holds the value of the accessible-item-selectable property in Slint.

Requires Slint 1.18 or newer. Older versions always report False.

accessible_item_selected: bool Slint ≥ 1.18

Read-only property that holds the value of the accessible-item-selected property in Slint.

Requires Slint 1.18 or newer. Older versions always report False.

accessible_item_count: int Slint ≥ 1.18

Read-only property that holds the value of the accessible-item-count property in Slint.

Requires Slint 1.18 or newer. Older versions always report 0.

accessible_item_index: int Slint ≥ 1.18

Read-only property that holds the value of the accessible-item-index property in Slint.

Requires Slint 1.18 or newer. Older versions always report 0.

accessible_orientation: Orientation Slint ≥ 1.18

Read-only property that holds the value of the accessible-orientation property in Slint, if present.

Requires Slint 1.18 or newer. Older versions always report Orientation.Horizontal.

accessible_live_region: AccessibleLiveness | None Slint ≥ 1.18

Read-only property that holds the value of the accessible-live-region property in Slint, if present.

Requires Slint 1.18 or newer. Older versions always report AccessibleLiveness.Off.

layout_kind: LayoutKind | None

Read-only property that returns the layout kind if this element is a layout container, or None if it is not a layout element.

Layout elements such as HorizontalLayout, VerticalLayout, and GridLayout are lowered to Rectangle during compilation. This property lets you distinguish layout containers from plain rectangles.

size: LogicalSize

Read-only property that holds size of the element in logical pixels, as a tuple of width and height.

absolute_position: LogicalPosition

Read-only property that holds the absolute position of the element in logical pixels within the window, as a tuple of x and y.

absolute_rect: LogicalRect

Read-only property that holds the absolute position and the size of the element in logical pixels within the window. Unlike reading absolute_position and size one after the other, both come from the same instance of the element, even if the UI replaces it in between.

computed_opacity: float

Read-only property that holds the opacity that is applied when rendering this element. This is the product of the opacity property multipled with any opacity specified by parent elements.

invoke_accessible_default_action()

Invokes the default accessible action on the element. For example a MyButton element might declare an accessible default action that simulates a click, as in the following example:

component MyButton {
// ...
callback clicked();
in property <string> text;
TouchArea {
clicked => { root.clicked() }
}
accessible-role: button;
accessible-label: self.text;
accessible-action-default => { self.clicked(); }
}
invoke_accessible_increment_action()

Invokes the element’s accessible-action-increment callback, if declared. On widgets such as spinboxes, this typically increments the value.

invoke_accessible_decrement_action()

Invokes the element’s accessible-action-decrement callback, if declared. On widgets such as spinboxes, this typically increments the value.

invoke_accessible_expand_action()

Invokes the element’s accessible-action-expand callback, if declared. On widgets such as spinboxes, this typically decrements the value.

single_click(button: PointerEventButton, modifiers: KeyboardModifiers | None = None)

Simulates a single mouse click sequence on the element’s center, with the KeyboardModifiers in modifiers held down. The modifiers need Slint 1.19 or newer; older versions ignore them.

double_click(button: PointerEventButton, modifiers: KeyboardModifiers | None = None)

Simulates a mouse double click sequence on the element’s center, with the KeyboardModifiers in modifiers held down. The modifiers need Slint 1.19 or newer; older versions ignore them.

query_descendants() -> ElementQuery

Creates a new element query into all sub-elements of this elements. This includes the children as well as the children of the children, and so forth. Use ElementQuery to refine your query. When your query is ready, run it by calling find_first, find_one, or find_all.


© 2026 SixtyFPS GmbH