Code Input

Official(made by Sanity team)

By Bjørge Næss

Syntax highlighted editor for code.


Code input for Sanity.

Currently only a subset of languages and features are exposed, over time we will implement a richer set of options.


sanity install @sanity/code-input


Use it in your schema types:

// [...]
  fields: [
    // [...]
      name: 'exampleUsage',
      title: 'Example usage',
      type: 'code'

Note that the above only works if you import and use the all:part:@sanity/base/schema-type part in your schema.


  • language - Default language for this code field
  • languageAlternatives - Array of languages that should be available
  • theme - Name of the theme to use. Possible values: ['github', 'monokai', 'terminal', 'tomorrow']
  • withFilename - Boolean option to display input field for filename
// ...fields...
  name: 'exampleUsage',
  title: 'Example usage',
  type: 'code',
  options: {
    language: 'js'

Data model

  _type: 'code',
  language: 'js',
  highlightedLines: [1, 2],
  code: 'const foo = "bar"\nconsole.log(foo.toUpperCase())\n// BAR'


MIT-licensed. See LICENSE.

Other plugins by author

Asset source for Unsplash

Search photos on Unsplash and insert them directly inside of your Sanity Studio.

Go to Asset source for Unsplash

Mux input

Upload videos to Mux directly from the studio.

Go to Mux input

Image URL

Official(made by Sanity team)

Helper library to generate URLs for image transformation

Go to Image URL