File Structure
A Slint Source File
Section titled “A Slint Source File”A .slint source file is a sequence of zero or more top-level items, separated only by whitespace and comments.
A source file that contains only whitespace and comments is well-formed and defines no components.
Top-Level Items
Section titled “Top-Level Items”A top-level item is a component definition.
Component Definitions
Section titled “Component Definitions”A component definition has one of the following two forms:
component Name { /* component body */ }component Name inherits Base { /* component body */ }The identifier following the component keyword is the name of the component.
The first form defines a component with no explicit base; the second form defines a component that inherits from the element type named by Base.
The identifier Base shall resolve to a built-in element or to a component previously defined.
The braces { and } delimit the component body.
Component Bodies
Section titled “Component Bodies”A component body is a sequence of zero or more element instantiations, bindings, and property declarations, separated only by whitespace and comments.
A component body that contains no element instantiations is well-formed.
Element Instantiations
Section titled “Element Instantiations”An element instantiation has the form:
TypeName { /* element body */ }The identifier TypeName shall resolve to a built-in or user-defined component.
The braces delimit the element body. An element body is a sequence of zero or more nested element instantiations and bindings, separated only by whitespace and comments.
A nested element instantiation is a child of the element instantiation in whose body it appears. The child relationship forms a tree rooted at the elements that appear directly in a component body.
Example
Section titled “Example”The following is a complete, well-formed .slint source file:
export component Hello inherits Window { Rectangle { } Rectangle { }}It exports one component, Hello, which inherits from Window and whose body contains two top-level Rectangle instantiations.
© 2026 SixtyFPS GmbH