---
title: "content.addFieldType()"
description: "Declare that a plugin implements an x-content field type."
canonical_url: "https://content.comark.dev/reference/content/add-field-type"
---
# content.addFieldType()

> Declare that a plugin implements an x-content field type.

## `content.addFieldType(type)`

Declares that a plugin implements an `x-content` field type, and adds the name to [`content.fieldTypes`](https://content.comark.dev/reference/content/field-types). Call it from a plugin's `setup`. The [`markdown-fields`](https://content.comark.dev/plugins/built-in/markdown-fields) and [`references`](https://content.comark.dev/plugins/built-in/references) plugins use it for `markdown` and `reference`.

The call records the name only. The behavior of the field type lives in the plugin's [hooks](https://content.comark.dev/reference/content/hooks). Registering the same name twice has no further effect.

**Parameters:**

- `type`: the field type name, as written in `'x-content': { type }`. It must be a key of `ComarkFieldMetaRegistry`, so a plugin with its own field type [declares it there first](https://content.comark.dev/plugins/custom/plugin-api#custom-field-types).

**Returns:** `void`

## Usage

```ts [localized-fields.ts]
import { defineContentPlugin } from 'comark-content'

declare module 'comark-content' {
  interface ComarkFieldMetaRegistry {
    localized: { locales: string[] }
  }
}

export default defineContentPlugin(() => ({
  name: 'localized-fields',
  setup(content) {
    content.addFieldType('localized')
  },
}))
```


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
