Skip to content

Boolean

The Boolean field renders a input[type="checkbox"] on Form views and a nice green check icon/red X icon on the Show and Index views.

ruby
field :is_published,
  as: :boolean,
  name: 'Published',
  true_value: 'yes',
  false_value: 'no'
An Avo index table with ID, Name and Published columns — a green check and a red X in the Published column.

Options

true_value

What should count as true. You can use 1, yes, or a different value.

Default value

[true, "true", "1"]

false_value

What should count as false. You can use 0, no, or a different value.

Default value

[false, "false", "0"]

nil_as_indeterminate

When true, nil values render as a gray minus-circle icon on Show and Index views instead of the default dash. This keeps the nil value intact while making it more visible.

Boolean field with nil_as_indeterminate showing a gray minus-circle icon

Default value

false

as_toggle

Render the field as a toggle on the form views.

Default value

false