Tina Docs
Introduction
Core Concepts
Querying Content
Editing
Customizing Tina
Going To Production
Media
Drafts
Guides
Further Reference

Toggle Field

Table of Contents

This is an advanced-use feature, and likely not something you'll need to configure. What you probably want is the content types reference!

The toggle field represents a true/false toggle. This field is typically used for boolean content values. You could use this to toggle a certain feature on the page on or off.

tinacms-toggle-field

Options

interface ToggleConfig extends FieldConfig {
component: 'toggle'
name: string
label?: string
description?: string
toggleLabels?: boolean | { true: string; false: string }
}
This interfaces only shows the keys unique to the date field. Visit the Field Config docs for a complete list of options.

Example: Published Flag

Below is an example of how a toggle field could be used to mark a blog post as published.

const BlogPostForm = {
fields: [
{
name: 'published',
component: 'toggle',
label: 'Published',
description: 'Check to mark this to publish the post.',
toggleLabels: {
true: 'On',
false: 'Off',
},
},
// ...
],
}