Joint session with Vercel: How to build intelligent storefronts (May 15th)

Display multiple fields in same line for Sanity preview

22 repliesLast updated: Nov 29, 2025

Hi everyone, is it possible to display multiple fields within the same line for
preview
?
The following is giving me an error:
AI Update

Yes, you can definitely display multiple fields on the same line in a preview! The prepare function in your preview configuration lets you combine multiple fields into a single string for either the title or subtitle.

Here's a common pattern for combining fields:

preview: {
  select: {
    firstName: 'firstName',
    lastName: 'lastName',
    email: 'email'
  },
  prepare({firstName, lastName, email}) {
    return {
      title: `${firstName} ${lastName}`,
      subtitle: email
    }
  }
}

If you want to combine even more fields into one line, you can do something like:

preview: {
  select: {
    title: 'title',
    category: 'category.title',
    status: 'status'
  },
  prepare({title, category, status}) {
    return {
      title: title,
      subtitle: `${category}${status}`  // Combines multiple fields with a separator
    }
  }
}

Important note: The preview system in Sanity only supports three properties in the returned object from prepare:

So you can't add additional custom fields to display more lines. However, you can combine as many of your schema fields as you want into these three properties using string concatenation, template literals, or any JavaScript logic.

If you're getting an error, it might be because you're trying to return additional properties beyond these three, or there's a syntax issue in your prepare function. Could you share your specific code? That would help identify the exact issue.

You can read more about this in the official Sanity documentation on previews and list views, and there's also a great guide on creating richer array item previews that shows more advanced examples.

Show original thread
22 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions