Skip to content

Imports

An import statement brings exported declarations from another file into the importing file’s namespace.

Import statements appear at the top level of a .slint source file, interleaved with component definitions and exports.

A named import has the form:

import { Item, ... } from "path";
slint

The brace-delimited list contains one or more import items separated by commas. A trailing comma is permitted.

An import item is either:

  • a single identifier Name, or
  • a renaming of the form Name as Other.

A bare identifier Name brings the corresponding exported name from the imported file into the current file’s namespace under the same name.

A renaming Name as Other brings the corresponding exported name into the current file’s namespace under the name Other only. The original name Name is not introduced.

The name on the left of as must be exported by the imported file.

An imported name refers to a component, struct, enum, or global.

Two import items in the same source file can’t introduce the same name.

An import path is a double-quoted string literal. Backslash escape sequences are recognized as in any other string literal.

If the path begins with the character @, it is a library import: the remainder of the path is resolved against the component libraries configured in the build system.

Otherwise, the path is resolved first relative to the directory of the importing source file, then against the compiler’s configured include paths. The first match in this search order is used.

The referenced file must exist.

An import statement without an import list makes the referenced file available to the compiler:

import "./NotoSans-Regular.ttf";
slint

Importing a font file (.ttf or .otf) registers the font for use in the application; see Fonts.

An export statement with a from clause imports declarations and exports them again in one step:

export { Item, ... } from "path";
export * from "path";
slint

The * form exports every declaration the referenced file exports. It can appear at most once per file. The path resolves like any other import path.


© 2026 SixtyFPS GmbH