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

How to add an icon next to text in Sanity array of objects?

16 repliesLast updated: Nov 29, 2025

Hi there! is it posible to add an icon near the Text?I am using and array ob objects, and would like to have an icon near each title.
Thanks!
AI Update

Yes, it's absolutely possible to add an icon near the text in your array of objects! In Sanity Studio, you can add icons to schema fields, including array items.

Adding Icons to Array Items

First, install the icon package you want to use:

npm install @sanity/icons
# or
yarn add @sanity/icons

Then, in your schema definition (make sure the file has a .jsx or .tsx extension), you can add icons to your array items like this:

import { DocumentIcon, ImageIcon, UserIcon } from '@sanity/icons'

export default {
  name: 'myDocument',
  type: 'document',
  fields: [
    {
      name: 'myArray',
      type: 'array',
      of: [
        {
          type: 'object',
          name: 'item1',
          title: 'Item Type 1',
          icon: DocumentIcon, // Icon appears next to the title
          fields: [
            {
              name: 'title',
              type: 'string',
              title: 'Title'
            }
          ]
        },
        {
          type: 'object',
          name: 'item2',
          title: 'Item Type 2',
          icon: ImageIcon, // Different icon for this type
          fields: [
            {
              name: 'title',
              type: 'string',
              title: 'Title'
            }
          ]
        }
      ]
    }
  ]
}

Icon Options

You have several options for icons:

The icons will appear in the Studio UI next to each array item's title, making it easier to identify different types of objects at a glance. As mentioned in the Icons documentation, helpful icons can improve the editorial experience throughout the studio interface.

Important: Remember that any schema file with icons must have a .jsx or .tsx extension, not .js or .ts, since you're importing React components!

Show original thread
16 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