Skip to content

Primitive & Numeric Types

booldefault: false

boolean whose value can be either true or false.

angledefault: 0deg

Angle measurement, corresponds to a literal like 90deg, 1.2rad, 0 25turn

durationdefault: 0ms

Type for the duration of animations. A suffix like ms (millisecond) or s (second) is used to indicate the precision.

floatdefault: 0

Signed, 32-bit floating point number. Numbers with a % suffix are automatically divided by 100, so for example 30% is the same as 0.30.

float and int values have the following member functions:

Returns a string representation of the number with digits digits after the decimal point. It behaves like JavaScript’s toFixed().

Returns a string representation of the number with digits significant digits. It behaves like JavaScript’s toPrecision().

Both functions format the number using the decimal separator of the current locale. See Converting Between Numbers and Strings.

export component FloatToString {
property<float> pi: 3.14159;
property<string> fixed: pi.to-fixed(2); // "3.14"
property<string> precision: pi.to-precision(4); // "3.142"
}
slint

In addition, call the math functions in postfix style on any numeric value, for example (-10).abs() or x.round().

Returns a string representation of the number but not localized. This means the decimal separator will always be a dot.

intdefault: 0

Signed integral number.

lengthdefault: 0px

The type used for x, y, width and height coordinates. Corresponds to a literal like 1px, 1pt, 1in, 1mm, or 1cm. It can be converted to and from length provided the binding is run in a context where there is an access to the device pixel ratio.

A length is a distance. The default length is zero.

percentdefault: 0%

Signed, 32-bit floating point number that is interpreted as percentage. Literal number assigned to properties of this type must have a % suffix.

physical-lengthdefault: 0phx

This is an amount of physical pixels. To convert from an integer to a length unit, one can simply multiply by 1px. Or to convert from a length to a float, one can divide by 1phx.

relative-font-sizedefault: 0rem

Relative font size factor that is multiplied with the Window.default-font-size and can be converted to a length.

Please see the language specific API references how these types are mapped to the APIs of the different programming languages.


© 2026 SixtyFPS GmbH