Fields
Boolean Field
Switch/checkbox input for true/false values
The Boolean Field component provides a switch or checkbox input for collecting true/false boolean values.
Basic Usage
Basic Switch
With Description
With Description
Default Value
Pre Checked
Field Schema
A boolean field is authored as BooleanFieldMetadata (@object-ui/types), which is
the source of truth for the key set. It adds nothing of its own to
BaseFieldMetadata beyond the discriminant — a checkbox needs no extra configuration.
import type { BooleanFieldMetadata } from '@object-ui/types';
const isActive: BooleanFieldMetadata = {
type: 'boolean',
name: 'is_active',
label: 'Active',
description: 'Inactive records stay searchable but are excluded from lists.',
required: false,
defaultValue: true,
};The value being edited, and the className / disabled a host supplies, are not
metadata keys — they are runtime widget props. See Field Widget Props.
Use Cases
- Feature Toggles: Enable/disable features
- Preferences: User settings and preferences
- Permissions: Access control flags
- Status: Active/inactive, published/draft states
- Agreements: Terms acceptance, consent flags
Cell Renderer
In tables/grids, boolean values are displayed as badges:
import { BooleanCellRenderer } from '@object-ui/fields';
// Renders:
// ✓ True (green badge)
// ✗ False (gray badge)Styling
The boolean field uses the Switch component from Shadcn UI, providing:
- Smooth animations
- Accessible keyboard navigation
- Focus states
- Disabled states