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 ↗.
Properties
Section titled “Properties”is_valid
Section titled “is_valid”is_valid: boolRead-only property that is true if the element reference is still valid, i.e. if the element is still in the UI.
id: strRead-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: strRead-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: AccessibleRoleRead-only property that holds the value of the accessible-role property in Slint, if present.
accessible_label
Section titled “accessible_label”accessible_label: strRead-only property that holds the value of the accessible-label property in Slint, if present.
accessible_value
Section titled “accessible_value”accessible_value: strRead-write property that holds the value of the accessible-value property in Slint.
accessible_value_maximum
Section titled “accessible_value_maximum”accessible_value_maximum: floatRead-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: floatRead-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: floatRead-only property that holds the value of the accessible-value-step property in Slint, if present.
accessible_description
Section titled “accessible_description”accessible_description: strRead-only property that holds the value of the accessible-description property in Slint, if present.
accessible_checked
Section titled “accessible_checked”accessible_checked: boolRead-only property that holds the value of the accessible-checked property in Slint, if present.
accessible_checkable
Section titled “accessible_checkable”accessible_checkable: boolRead-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: strRead-write property that holds the value of the accessible-placeholder-text property in Slint.
accessible_enabled
Section titled “accessible_enabled”accessible_enabled: boolRead-write property that holds the value of the accessible-enabled property in Slint.
accessible_read_only
Section titled “accessible_read_only”accessible_read_only: boolRead-write property that holds the value of the accessible-read-only property in Slint.
layout_kind
Section titled “layout_kind”layout_kind: Optional[LayoutKind]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: Tuple[float, float]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: Tuple[float, float]Read-only property that holds the absolute position of the element in logical pixels within the window, as a tuple of x and y.
computed_opacity
Section titled “computed_opacity”computed_opacity: floatRead-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. Returns zero if the element is not valid.
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)Simulates a single mouse click sequence on the element’s center.
double_click
Section titled “double_click”double_click(button: PointerEventButton)Simulates a mouse double click sequence on the element’s center.
query_descendants
Section titled “query_descendants”query_descendants() -> ElementQueryCreates 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 either find_first
or find_all.
© 2026 SixtyFPS GmbH