How does the Boolean parameter/field type behave in the Uniform API?

Last updated: March 2, 2026

The boolean parameter/field type in Uniform has three possible states, which is important to understand when writing component logic that depends on its value.

The three states

1. Unset (default)

When a boolean parameter/field has never been toggled by a content editor, it does not exist in the composition/entry data at all. Your component will receive undefined for this parameter.

2. Checked (true)

After a content editor explicitly enables the toggle, the parameter appears in the API response as:

{
  "type": "checkbox",
  "value": true
}

Your component receives true after parameter flattening.

3. Unchecked (false)

If a content editor enables the toggle and then disables it again, the parameter appears in the API response as:

{
  "type": "checkbox",
  "value": false
}

Your component receives false after parameter flattening.

Note that this is distinct from the "unset" state — the parameter is present with an explicit false value.

Common pitfall

Because an unset checkbox is undefined rather than false, using negation (!myCheckbox) can produce unexpected results:

// Potentially problematic:

if (!myCheckbox) {

  // This runs when myCheckbox is false AND when it's undefined (never set)

}

If you need to distinguish between "never set" and "explicitly unchecked", use strict comparison:

if (myCheckbox === true) {

  // Only runs when explicitly checked

}

if (myCheckbox === false) {

  // Only runs when explicitly unchecked (was toggled on, then off)

}

if (myCheckbox === undefined) {

  // Only runs when never set

}

Best practice

When writing conditional logic based on a boolean parameter/field, prefer strict equality to avoid ambiguity:

// Instead of:

const isHidden = !myCheckbox;

// Prefer:

const isHidden = myCheckbox === true;

This ensures predictable behavior regardless of whether the checkbox was never touched or was explicitly set.