Configuration options
When true, requires the field value to always be
true. This is useful for acceptance checkboxes or required confirmations.Validation rules
The bool field validates:- Type: Value must be a boolean (true or false)
- Required: If enabled, value must be
true
When
required is true, the field will only accept true as a valid value. This is particularly useful for terms of service acceptance or similar use cases.Go examples
- Basic usage
- Required acceptance
- Feature flags
Database column type
API usage
When working with the PocketBase API, boolean fields accept various truthy/falsy values:Best practices
- Use descriptive names that clearly indicate the boolean nature (e.g.,
isActive,hasAccess,enabled) - Consider using
required: truefor critical acknowledgments like terms of service - Default value is always
false, so plan your logic accordingly - For tri-state logic (yes/no/unknown), consider using a select field instead
Zero value
The zero value for bool fields isfalse.