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

How to add static text to Sanity document without user input field?

6 repliesLast updated: Nov 29, 2025

Okay I am certain this has asked before, so sorry for (probably) bringing up an "old question", but how would I add some text into a document without giving the user a field to fill in? I want to add something like:
Hello!

This is
__ page, where you can edit __
AI Update

No worries about asking an "old question" – this comes up fairly often! The solution is to create a custom input component that displays static text without actually rendering an editable field.

The approach from that linked answer page is still valid. Here's the basic idea:

1. Create a custom input component that just displays your text:

// components/IntroTextComponent.js
import React from 'react'
import {Card, Text} from '@sanity/ui'

export default function IntroText(props) {
  const {type} = props
  const {intro} = type.options || {}
  
  return (
    <Card padding={3} radius={2} shadow={1}>
      <Text>{intro}</Text>
    </Card>
  )
}

2. Add it to your schema with the text you want to display:

import IntroTextComponent from './components/IntroTextComponent'

export default {
  name: 'myDocument',
  type: 'document',
  fields: [
    {
      name: 'welcomeText',
      title: 'Welcome',
      type: 'string',
      components: {
        input: IntroTextComponent
      },
      options: {
        intro: 'Hello!\n\nThis is the homepage, where you can edit the main content.'
      },
      hidden: true // Optional: hides it from the field list
    },
    // ... your other fields
  ]
}

Note for Studio v3: The syntax has changed slightly from the old answer. You now use components: { input: YourComponent } instead of inputComponent.

You can make this more sophisticated by:

If you want the text to appear but not take up space in the document data, you can also set hidden: true on the field, or use readOnly: true with an initialValue if you need it stored but not editable.

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