boolean Field Type
type: 'boolean' casts the field value with Boolean() and displays booleanTrueLabel or booleanFalseLabel. Defaults are 'Yes' and 'No'. Any truthy value renders as true; any falsy value renders as false.
Core Examples
Default Labels
Three boolean fields with no custom labels. True → 'Yes', false → 'No'.
fields: [
{ key: 'active', label: 'Active', type: 'boolean' },
{ key: 'verified', label: 'Verified', type: 'boolean' },
{ key: 'admin', label: 'Admin', type: 'boolean' },
]
Custom Labels
booleanTrueLabel and booleanFalseLabel replace the default Yes/No text. Any string is accepted — including emoji or symbols.
Each boolean field uses domain-specific labels instead of Yes/No.
{
key: 'active',
label: 'Status',
type: 'boolean',
booleanTrueLabel: 'Active',
booleanFalseLabel: 'Inactive',
},
{
key: 'verified',
label: 'Verified',
type: 'boolean',
booleanTrueLabel: '✓ Verified',
booleanFalseLabel: '✗ Unverified',
},
{
key: 'admin',
label: 'Role',
type: 'boolean',
booleanTrueLabel: 'Admin',
booleanFalseLabel: 'Member',
},
Condition
condition receives the full entity and returns true to show the field or false to hide it. Evaluated per row.
Admin column only renders for rows where active is true. Mateo (inactive) gets no Admin cell.
{
key: 'admin',
label: 'Admin (active users only)',
type: 'boolean',
booleanTrueLabel: 'Admin',
booleanFalseLabel: 'Member',
condition: (entity) => entity.active === true,
},
Field Options Reference
| Option | Type | Default | Effect |
|---|---|---|---|
key | string | required | Entity property to read the value from. |
label | string | unset | Column header or card label. |
type | 'boolean' | — | Casts value with Boolean() and displays true/false label. |
booleanTrueLabel | string | 'Yes' | Text shown when the value is truthy. |
booleanFalseLabel | string | 'No' | Text shown when the value is falsy. |
formatter | (value, entity) => unknown | unset | Transform before the boolean cast and label lookup. |
condition | (entity) => boolean | unset | Hides the field for rows where the function returns false. |
align | 'left', 'center', 'right' | 'left' | Text alignment in table mode. |
width | CSS length or number | unset | Column width in table mode. |
showLabel | true, false | true when label is set | Shows or hides the label in card/grid layouts. |
renderAs | string | unset | Replace boolean rendering. Use badge for colour-coded status chips. |
Caveats
- The cast is
Boolean(value)—0,'',null,undefined, andfalseall render as the false label.'false'(the string) renders as true because it is a non-empty string. - There is no built-in icon or colour on the boolean type itself. Use
renderAs: 'badge'with acolorMapfor visual status indicators.
See Also
- badge Renderer
- Item Config — item-level shape and layout contract
- Field Config