Skip to content
Sanity
    • Platform

      Sanity Studio

      Flexible editing environment

      APIs

      Connect to anything

      Content Lake

      Real-time database

      Try product demo

      Features

      Real-time collaboration

      Fearlessly work with content

      Precise content querying

      Treat content as data with GROQ

      Localization

      Coherent messaging across territories

    • Use cases

      E-commerce

      Richer shopping experiences

      Marketing sites

      Control your story

      Products & services

      Innovate and automate

      Mobile apps

      Content backend for every OS

      View all

      Integrations

      Shopify
      Mux
      Vercel
      Netlify
      Algolia
      Cloudinary
      BigCommerce
      Commerce Layer
      Smartling
      Transifex
      View all
    • Learn

      Documentation
      Studio API Reference
      API reference
      Guides
      GROQ cheat sheet
      Sanity UI
      Get started

      Build and share

      Templates
      Tools and plugins
      Schemas and snippets
      Project showcase
      Share your work
      Browse Exchange

      Frameworks

      React
      Vue
      Next.js
      Nuxt.js
      Svelte
      Remix
      Gatsby
      Astro
      Angular
      Eleventy
      View all
    • Discover

      Blog
      Resource library
      Agency partners
      Become a partner
      Technical support
      Talk to sales

      Case studies

      Puma

      Source of truth for global markets

      Aether

      Unique digital shopping experience

      Morning Brew

      Omnichannel media distribution

      InVision

      Delivering exceptional customer experiences

      View all

      Popular guides

      Headless CMS
      Structured content
      Content modeling
      Headless SEO
      Static websites
      View all
    • Enterprise
    • Pricing
    • Log in
    • Contact sales
    • Get started
Contact salesGet started
Published August 25th 2021

Now you see them, now you don’t. Introducing Conditional Fields.

Sanity Studio adds first-class support for conditional fields. Hide or show parts of forms based on programmable logic. Enhance the editing experience for content creators by reducing cognitive load.

Marcus Sarmento

Former Head of Product Marketing at Sanity

We often hear from our community and customers that they love how flexible the Sanity Studio interface is. The open-source editing environment lets you truly tailor the authoring layer to exactly how your team wants to interact with their content. Want special fields, plugins for 3rd party tools, validation warnings, or custom workflows? You can build and implement those yourself or use one of the hundreds of contributions from the community.

But what if you want to customize the interface based on business logic? What if you want to add or remove fields in certain conditions to surface only relevant info and make your editors more productive? After all, as Jakob Nielsen notes in his famous 10 Usability Heuristics for User Interface Design, “interfaces should not contain information which is irrelevant…every extra unit of information in an interface competes with the relevant units of information and diminishes their relative visibility.” Extra information in an interface adds noise and slows your team down, negatively impacting your go-to-market efforts.

Introducing Conditional Fields

This feature has been a long-standing request and we’re thrilled to finally deliver it! Starting today, you can use our new Conditional Fields support to programmatically change your interface to only surface the most relevant information. This lets you simplify the environment for your team, so you can show them only the information they need to see to get their job done.

Simply put, conditional fields let you show or hide fields in the content editor based on whatever custom logic you want. We’ve upgraded the ‘hidden’ property that has long been a part of Sanity’s schema, to be able to take a function with contextual data. This gives you more flexibility than ever before to create interfaces tuned precisely to your use case and how your team operates.

Use cases

We asked our community about how they plan on using Conditional Fields and got a wide range of responses. Example use cases include:

  • Marketing organizations can show only the relevant localized fields for their translators
  • E-commerce companies that sell both physical and digital goods can hide fields associated with physical goods like ‘weight’, ‘height, and ‘length’ when accessing digital products
  • Real estate companies can add a ‘sales price’ field if the status of a particular listing is ‘sold’
  • Event companies that sell sponsorship packages can display or remove fields based on sponsorship tier
  • Media companies can add fields for video URLs on all pages that are marked ‘public’

Enhance your editor experience

We are always looking for ways to make the editor experience better and to make it easier for developers to address business needs. Other systems with conditional fields are typically restrictive. They only look for the existence of a value or force you to install a plugin or write your own input from the ground up. Adding first-class support for programmable conditional fields sets Sanity apart from other content systems. You decide what the conditions are, and Sanity Studio does the rest.

We know these examples are just scratching the surface and we can’t wait to see all the streamlined interfaces you’ll build with it. Check out the docs for more information or join the community Slack and let us know what you think!

Page content

  • Introducing Conditional Fields
  • Use cases
  • Enhance your editor experience

Product

Sanity StudioAPIsContent LakeSecurity & Compliance
  • Sanity vs Contentful
  • Sanity vs Strapi
  • Sanity vs Wordpress
  • Sanity vs Adobe Experience Manager
  • Sanity vs Hygraph
  • Sanity vs Sitecore
  • Sanity vs Storyblok
  • Sanity vs Contentstack
  • Sanity vs Prismic
  • Sanity vs Drupal
  • Sanity vs ButterCMS

Resources

DocumentationBlogResource libraryCase Studies
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Making a PWA
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
  • Next.js blog
  • Next.js personal website
  • Clean Next.js + Sanity app
  • Clean Remix + Sanity app
  • Clean SvelteKit + Sanity app
  • All Templates
  • Agency partners
  • Technology partners
  • Headless CMS 101
  • Static Sites 101
  • Headless Commerce 101
  • CMS for enterprise
  • Headless SEO
  • Localization
  • Content as a Service
  • What is a DXP?
  • Typescript 101
  • Ecommerce SEO
  • What is a Composable DXP?
  • What is an API?
  • GraphQL vs REST
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • API-first CMS
  • Content platform
  • Multilingual CMS
  • Static Site CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS
  • CMS for apps
  • Remix CMS
  • Nuxt CMS
  • SvelteKit CMS
  • Agile CMS
  • Eleventy CMS

Company

Contact SalesEnterpriseCareersTerms of ServicePrivacy PolicyAccessibility Statement

Stay connected

  • GitHub
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS
  • Newsletter
©Sanity 2023