Home
Blog
Showcase
Community
Introduction
Overview
Introduction To TinaCMS
Getting Started
Using the Tina Editor
FAQ
Core Concepts
Content Modeling
Data Fetching
Visual Editing
Querying Content
Overview
Writing custom queries
Editing
Overview
Markdown & MDX
Block-based editing
Single Document Collections
Customizing Tina
Overview
Validation
Custom Field Components
Custom List Rendering
Format and Parse Input
Filename Customization
Before Submit function
Going To Production
Overview
Tina Cloud
Self-Hosted
Drafts
Overview
Draft Fields
Editorial Workflow
Guides
Overview
Framework Guides
Separate Content Repo
Querying Tina Content at Runtime
Internationalization
Migrating From Forestry
Further Reference
Overview
Config
Schema
Overview
Collections
Fields
Templates
Field Types
The "tina" folder
The TinaCMS CLI
Media
Search
Content API
Tina's edit state
The "tinaField" helper
Self-Hosted Components

Fields define the shape of the content and the user input. There are many types of fields each with its own input and type.

Although some fields have more properties here is a list of common ones that are used.

Definition

PropertyDescription
nameThe name of the field
typeThe type of the field to be used
labelA human friendly label that will be displayed to the user (optional, defaults to name)
requiredIf true, the collection cannot be saved without this field present (optional, defaults to false)
isTitleDenote a field as the title of a collection. See below for more details (optional, defaults to false)
isBodyIf true this field will be used as the body of the document. See below for more details (optional, defaults to false)
nameOverrideAn optional property to allow exporting a field with a special character, that wouldn't be supported by the name property. E.g: { name: 'custom_id', nameOverride: 'id' } or { name: 'my_field', nameOverride: 'my-field' }. When a document is written/read to/from GitHub, the nameOverride will be used as the frontmatter field key, instead of the name.
uiUsed to extend the user interface of the field and the field behavior. See extending tina section for more information (optional)
ui.listThis can be used to make any field into a list of that type (optional)
ui.minIf { list: true } can provide a minimum amount of items (optional)
ui.maxIf { list: true } can provide a maximum amount of items (optional)
ui.componentUsed for custom field components
ui.validateUsed for custom field validation

isTitle

isTitle can be used to denote which field represents the title of the document. The field set with isTitle=true is what is displayed in the CMS list view page.

Make sure the following is true when using isTitle

  • It is a top-level field (it is defined in collections.fields or collections.templates.fields)
  • It is only used once per collection
  • required is set to true

Example of isTitle

export default defineConfig({
//...
schema: {
collections: [
{
name: 'posts',
label: 'Blog Posts',
path: 'content/posts',
format: 'mdx',
fields: [
{
type: 'string',
label: 'Title',
name: 'title',
isTitle: true,
required: true,
},
// ... other fields
],
},
],
},
})

isBody

isBody can be used for "mdx", "markdown", and "md" formats. The field used for isBody = true must have type string or rich-text. When isBody is true it will save that field to the body of the document.

Example of isBody

export default defineConfig({
//...
schema: {
collections: [
{
name: 'posts',
label: 'Blog Posts',
path: 'content/posts',
format: 'mdx',
fields: [
{
type: 'rich-text',
label: 'Body of post',
name: 'body',
isBody: true,
},
//... Other fields
],
},
],
},
})

ui.min and ui.max

ui.max only takes effect on object field types with list: true specified. It also isn't compatible with object field types using templates. It disables the add button in the editor once at least the given number of elements have been added.

{
type: "object",
label: "Object List",
name: "objectList",
list: true,
ui: {
max: 3,
},
fields: [
{
//...
},
]
}

ui.min will ensure that once the specified minimum number of items is added (ex: 3 in the example), users will not be able to remove items if there are only the minimum number of items.

It can apply to all field types with list list: true specified, provided they appear as a list in the editor. Specifically, this is the:

{
type: "string",
label: "Llamas",
name: "llamas",
list: true,
ui: {
min: 3,
}
}

Last Edited: September 12, 2024

Previous
Collections
Next
Templates

Product

Showcase
TinaCloud
Introduction
How Tina Works
Roadmap

Resources

Blog
Examples
Support
Media

Whats New
TinaCMS
TinaCloud
Use Cases
Agencies
Documentation
Teams
Jamstack CMS
Benefits
MDX
Markdown
Git
Editorial Workflow
Customization
SEO
Comparisons
TinaCMS vs Storyblok
TinaCMS vs Sanity
TinaCMS vs DecapCMS
TinaCMS vs Contentful
TinaCMS vs Builder.io
TinaCMS vs Strapi
Integrations
Astro
Hugo
NextJS
Jekyll