Skip to content

Imports

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

An imported source file shall itself conform to this specification.[sls.import.subset]

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

Every import statement is a named import.[sls.import.named-only]

A named import has the form:[sls.import.forms]

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

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

An import item is either:[sls.import.item]

  • 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.[sls.import.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.[sls.import.rename]

The name on the left of as must be exported by the imported file.[sls.import.left-must-exist]

Two import items in the same source file can’t introduce the same name.[sls.import.no-clash]

An imported name refers to a component.[sls.import.kinds]

An import path is a double-quoted string literal.[sls.import.path-literal]

The path is resolved relative to the directory of the importing source file.[sls.import.path-relative]

The referenced file must exist.[sls.import.path-must-exist]


© 2026 SixtyFPS GmbH