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.
Properties
Section titled “Properties”handle
Section titled “handle”handle: Handle is_valid
Section titled “is_valid”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
Section titled “type_name”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
Section titled “accessible_role”accessible_role: AccessibleRole Read-only property that holds the value of the accessible-role property in Slint, if present.
accessible_label
Section titled “accessible_label”accessible_label: str Read-only property that holds the value of the accessible-label property in Slint, if present.
accessible_value
Section titled “accessible_value”accessible_value: str Read-write property that holds the value of the accessible-value property in Slint.
accessible_value_maximum
Section titled “accessible_value_maximum”accessible_value_maximum: float Read-only property that holds the value of the accessible-value-maximum property in Slint, if present.
accessible_value_minimum
Section titled “accessible_value_minimum”accessible_value_minimum: float Read-only property that holds the value of the accessible-value-minimum property in Slint, if present.
accessible_value_step
Section titled “accessible_value_step”accessible_value_step: float Read-only property that holds the value of the accessible-value-step property in Slint, if present.
accessible_description
Section titled “accessible_description”accessible_description: str Read-only property that holds the value of the accessible-description property in Slint, if present.
accessible_checked
Section titled “accessible_checked”accessible_checked: bool Read-only property that holds the value of the accessible-checked property in Slint, if present.
accessible_checkable
Section titled “accessible_checkable”accessible_checkable: bool Read-only property that holds the value of the accessible-checkable property in Slint, if present.
accessible_placeholder_text
Section titled “accessible_placeholder_text”accessible_placeholder_text: str Read-write property that holds the value of the accessible-placeholder-text property in Slint.
accessible_enabled
Section titled “accessible_enabled”accessible_enabled: bool Read-write property that holds the value of the accessible-enabled property in Slint.
accessible_read_only
Section titled “accessible_read_only”accessible_read_only: bool Read-write property that holds the value of the accessible-read-only property in Slint.
accessible_item_selectable
Section titled “accessible_item_selectable”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
Section titled “accessible_item_selected”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
Section titled “accessible_item_count”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
Section titled “accessible_item_index”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
Section titled “accessible_orientation”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
Section titled “accessible_live_region”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
Section titled “layout_kind”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
Section titled “absolute_position”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
Section titled “absolute_rect”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
Section titled “computed_opacity”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.
Methods
Section titled “Methods”invoke_accessible_default_action
Section titled “invoke_accessible_default_action”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
Section titled “invoke_accessible_increment_action”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
Section titled “invoke_accessible_decrement_action”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
Section titled “invoke_accessible_expand_action”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
Section titled “single_click”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
Section titled “double_click”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
Section titled “query_descendants”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