Watch a live product demo 👀 See how Sanity powers richer commerce experiences

Initial Value Templates API

Reference documentation for the Initial Value Templates API.


Returns an array of all the default templates - one for each document type defined in the schema. Use this to combine your own templates with the default ones.


Creates a new initial value template with the given configuration. Returns a template builder function which can be used to customize the template.


  • REQUIREDidstring

    An id used to identify the template. You will often refer to this ID when configuring which initial value templates are available in a given context. Must be unique.

  • REQUIREDtitlestring

    The title of the template, used for display purposes.

  • descriptionstring

    An optional description, used to clarify the purpose of the template.

  • REQUIREDschemaTypestring

    The name of the schema type the template applies to.

  • REQUIREDvalueobject | function

    The actual initial value to use, or a function that resolves to one.

    The function receives an object of any defined parameters as the first argument and should return either a plain object value or a promise which resolves to one.

  • parametersarray

    An array of parameters the template expects to receive. Follows the same format as fields within a schema type.

    Note that only the property name is currently used - validation is not performed, nor is type checking. Parameters should still define the type for future compatiblity.

  • iconfunction

    An optional react component to use as the icon for this template

Was this article helpful?