Schema Types

The schema describes the types of documents editors may author in Sanity Studio.

The schema describes the different field types a document consists of. This is the reference documentation for all the schema types, but there is also an introductory tutorial covering the basics of content modeling.

A list of all schema types is available below or in the documentation menu.


  • REQUIREDtypestring

    Name of any valid schema type. This will be the type of the value in the data record.

  • titlestring

    Human readable label for the field.

  • REQUIREDnamestring

    Required. The field name. This will be the key in the data record.

  • hiddenboolean | function

    Takes a static or a callback function that resolves to a boolean value (truthy or falsy) and hides the given field based on it. You can use this property for conditional fields.

  • readOnlyboolean | function

    If set to true, this field will not be editable in the content studio. You can also return a callback function to use it as a conditional field.

  • descriptionstring

    Short description to editors how the field is to be used.

Note: The above properties are those which are common for all data types. For a more thorough description on how to use them, have a look at the Object Type.

By default the studio loads the schema from the file schemas/schema.js in your studio project. Sanity expects this file to provide a ready to use compiled schema. This is an example of a minimal schema.js file:

import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'

export default createSchema({
  name: 'default',
  types: schemaTypes.concat([
    // Add your own types here
      title: "My Example Document Type",
      name: "exampleDocumentType",
      type: "document",
      fields: [
          title: "Greeting",
          name: "greeting",
          type: "string"

The studio loads the schema by importing the part named part:@sanity/base/schema. You can relocate the schema according to your needs by changing the part definition in your Sanity Studio sanity.json file:

  // ... other config ...
  "parts": [
      "name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
} ] }

A plug-in may also provide types in the schema by providing its uncompiled types as part:@sanity/base/schema-type.

// In deweyClassification.js
  title: "Dewey Classification",
  name: "deweyClassification",
  type: "string"

// In the sanity.json-file of the plug-in
  parts: [
"implements": "part:@sanity/base/schema-type",
"path": "./deweyClassification.js"
// Implement the part again if you need to provide more types: // { // "implements": "part:@sanity/base/schema-type", // "path": "./anotherType.js" // }, ] }

Was this article helpful?