Skip to content

Project File

Use a slint-project.json file to configure your project’s main file and compiler settings, such as include paths. To apply these settings, pass the project file or its directory to the compiler.

Name the file slint-project.json and place it in your project directory. Passing either /projects/app or /projects/app/slint-project.json loads /projects/app/slint-project.json. Importing a .slint file in Node.js or generating TypeScript declarations for it loads slint-project.json from the source file’s directory. For example, importing /projects/app/ui/main.slint looks for /projects/app/ui/slint-project.json.

{
"edition": "1.19",
"main": "ui/main.slint",
"include-paths": ["ui/shared"],
"library-paths": {
"widgets": "ui/widgets"
}
}
json

The file uses JSON syntax and accepts // and /* */ comments. edition is required. When you pass the project file or its directory to the compiler, main is required, too. All other settings are optional.

SettingTypeDescription
editionstringRequired. The Slint release whose language behavior your project uses, such as "1.19". See Editions.
mainstringThe .slint file to compile when you pass the project file or its directory. See Compiling a Project.
include-pathsarray of stringsDirectories to search for imported .slint files.
library-pathsobjectMaps a library name to a file, a directory, or the library’s project file, for @library imports. See Libraries.
experimental-featuresarray of stringsThe experimental features ↗ to turn on, such as ["interfaces", "match"].
metadataobjectThis value is ignored by the compiler. It may be used by other tooling to store per-project configuration.

Slint resolves relative paths against the directory that contains the project file.

A setting can come from three places, listed from highest to lowest priority:

  1. An option passed to the API or the command line, such as a style.
  2. The project file.
  3. A compiler default.

Include paths and library paths combine instead: Slint searches the include paths passed to the API or the command line first, then those of the project file. A library path passed to the API or the command line replaces the project file’s library of the same name, and the project file’s other libraries stay available.

A library can have a project file of its own. To use its settings, map the library name to that project file:

{
"edition": "1.19",
"main": "ui/main.slint",
"library-paths": {
"widgets": "../widgets/slint-project.json"
}
}
json

@widgets imports the main file of the library. Only what that file exports is available through @widgets: a path such as @widgets/button.slint is an error. The files in the library’s directory use the edition, include paths, and library paths of the library’s project file. So a library keeps its edition in an application that uses another one. Give an application inside a library’s directory, such as an example, a project file of its own, so that its files use its own settings in your build and your editor. Experimental features apply to the whole application, so enable them in the application’s project file.

To compile your project, first set main to the main .slint file of your application:

{
"edition": "1.19",
"main": "ui/main.slint"
}
json

Then, pass the project file or its directory to your build or loading API:

// build.rs
fn main() {
slint_build::compile(".").unwrap();
}
rust

Settings on CompilerConfiguration win over the project file. Cargo rebuilds your crate when the project file changes. The slint! macro doesn’t load a project file.

The slint-compiler and slint-tr-extractor command line tools accept the project file or its directory, too:

Terminal window
slint-compiler slint-project.json -o main.h
slint-tr-extractor slint-project.json -o messages.pot
bash

The Slint language server discovers the project files for your open documents. When you edit multiple projects, it combines their settings. The live preview uses the project root that the language server selects for the previewed file.

When you open a .slint file in the Visual Editor without --project-root, the file’s parent directory becomes the project root. To select another root, pass --project-root <path> to the Visual Editor or the viewer. The path can be the project file or its directory. The .slint file you specify stays the entry point.


© 2026 SixtyFPS GmbH