Number

This article explains what the number field is and how to configure it.

The number field allows content writers to provide a number. The number can be an integer (e.g. 3) or a float (e.g. 3.14).

Add a number field to a content model

  • Open Slice Machine

    In your Prismic project, start Slice Machine to begin editing content models.

    npx start-slicemachine --open
  • Add a number field

    In Slice Machine, navigate to the slice, page type, or custom type you want to modify. Add a number field.

    The label determines the label shown to content writers in the Page Builder. Use an easily understood name.

    The API ID determines the property name in the Document API. Use a short, snake-cased name.

Use number fields

Number fields can be used like a number in JavaScript.

<span>My age: {slice.primary.age}</span>

Tips

API response

Here is what a number field looks like from the Document API:

{
  "example_number": 3.14
}