Show navigationHide navigation

Boolean

Yes / No toggle rendered as radio buttons. Use for feature flags, visibility toggles, and on/off switches.

Usage#

typescript
featured: { label: 'Featured', format: 'boolean' },

Options#

OptionTypeDefaultDescription
defaultBooleanbooleanDefault value for new entries
booleanLabels{ true: string; false: string }{ true: 'Yes', false: 'No' }Custom labels for radio buttons
hintstringHelper text below the field

Boolean fields always have a value ("true" or "false") — they are never empty or null.

Schema — mark blog posts as featured to highlight them on the homepage:

typescript
// cms/octocms.config.ts
post: {
  label: 'Post',
  hasMany: true,
  fields: {
    title: { label: 'Title', format: 'string', entryTitle: true, required: true },
    featured: {
      label: 'Featured',
      format: 'boolean',
      defaultBoolean: false,
      booleanLabels: { true: 'Featured', false: 'Not featured' },
      hint: 'Featured posts appear on the homepage hero section.',
    },
    body: { label: 'Body', format: 'markdown' },
  },
},

Query + render:

tsx
// src/app/page.tsx
import { query } from 'cms/__generated__/query';

export default async function HomePage() {
  const featured = await query('post')
    .filter((p) => p.fields.featured === 'true')
    .sort('publishedAt', 'desc')
    .limit(3)
    .toArray();

  return (
    <section>
      <h2>Featured Posts</h2>
      {featured.map((post) => (
        <article key={post.sys.id}>
          <h3>{post.fields.title}</h3>
        </article>
      ))}
    </section>
  );
}

Storage#

Stored as the string "true" or "false" in the entry JSON (not a native boolean):

json
{ "featured": "true" }

Query result#

Returned as a string — "true" or "false". Compare with === 'true' in filters.