Skip to content
How-to guides and worked examplesSee the guides →

Heading API ​

Per-option reference for the Heading field. For tasks and worked examples, see the Heading guide.

Options are passed to the field declaration in a resource's fields method, for example in app/avo/resources/user.rb:

ruby
field :user_information, as: :heading, label: "User information", as_html: false

Heading content ​

label

The heading text when no computed block is supplied. A block's return value takes precedence over label; headings declared with a block are hidden on new and edit views, even when a label is also supplied.

ruby
field :user_information, as: :heading, label: "Contact details"
  • Type: String
  • Default: id.to_s.humanize (for example, "User information" for :user_information)
  • Fallback: nil and false use the humanized field ID; an empty string remains empty.

as_html

Renders the heading value as sanitized HTML when enabled. Otherwise, the value is rendered as escaped text with uppercase styling. This applies to both labels and computed values.

ruby
field :user_information, as: :heading,
  label: "<strong>User information</strong>",
  as_html: true
  • Type: Boolean
  • Default: false

Sanitized HTML

HTML is passed through Rails' sanitize helper, not rendered unchanged. The option is not type-validated: blank values become false, while nonblank values such as the string "false" enable HTML rendering. Pass true or false.

Common field options ​

For shared visibility, styling, and other field settings, see Common field options.