Primitive & Numeric Types
Primitive Types
Section titled “Primitive Types”booldefault: false
boolean whose value can be either true or false.
Numeric Types
Section titled “Numeric Types”angledefault: 0deg
Angle measurement, corresponds to a literal like 90deg, 1.2rad, 0 25turn
duration
Section titled “duration”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:
to-fixed(digits: int) -> string
Section titled “to-fixed(digits: int) -> string”Returns a string representation of the number with digits digits after the decimal point.
It behaves like JavaScript’s toFixed() ↗.
to-precision(digits: int) -> string
Section titled “to-precision(digits: int) -> string”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"}In addition, call the math functions in postfix style on any numeric value,
for example (-10).abs() or x.round().
to-string-unlocalized() -> string
Section titled “to-string-unlocalized() -> string”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.
length
Section titled “length”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.
percent
Section titled “percent”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-length
Section titled “physical-length”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-size
Section titled “relative-font-size”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