Skip to main content

List View

Configure the list view with field, filter, and action declarations:

Habarico::ListView.new(
boxes: [
Habarico::FieldReference.new(
name: :product,
label: 'Unit',
sortable: true,
sort_by: 'products.name',
),
:customer,
:status,
Habarico::FieldReference.new(name: :outstanding_amount, label: 'Debt', text_align: 'right'),
:placed_at,
:delivered_at,
],
filters: [], # drawer filters (empty — all in toolbar)
toolbar_filters: [:status, :category, :product], # always-visible toolbar filters
row_actions: [:show, :edit, :delete],
toolbar_actions: [:create],
default_sorting: 'placed_at:desc',
)

Habarico::FieldReference options:

OptionDescription
nameField name (symbol)
labelDisplay label
short_labelCompact label for narrow columns
help_textTooltip text
sortableWhether this column is sortable
sort_byOverride the DB column used for sorting
read_onlyMark as read-only
write_onlyMark as write-only
default_valueDefault value for the field
show_queryCondition expression to conditionally show the field
required_queryCondition expression to conditionally require the field
text_alignText alignment ('left', 'right', 'center')
targetTarget resource name for nested/related fields
actionAction object attached to the field (makes the field clickable)
wrapperWrapper type for the field display
phonePhone number formatting options
icons_keyKey used to map enum values to icons
resize_widthTarget width for image resizing (image fields)
crop_aspect_ratioAspect ratio constraint for image cropping (image fields)
parentParent field name for nested field hierarchies
ai_source_fieldsArray of field names used as AI generation source
relationOverride relation metadata for relation fields (hash, see below)

relation hash options (relation fields only):

OptionDescription
show_linkShow a link to the related resource detail
link_modeHow to open the linked resource detail ('redirect' or 'dialog')
dialog_widthWidth of the dialog when link_mode is 'dialog' (MUI breakpoint like 'sm'/'md' or a CSS width value like '800px')
keep_linked_parentKeep the linked parent in the URL when navigating to the linked resource
show_edit_buttonShow edit button for inline editing of the related resource
show_create_buttonShow create button for inline creation of a new related resource
preserve_orderPreserve the order of the values according to the order in the source field
filtersStatic key-value filters applied to the relation resource query
sortDefault sorting applied to the relation resource query (hash { field_name:, direction: } or string like 'name:asc')
parentName of the parent field this field depends on (used for tree/hierarchical relations)
Habarico::FieldReference.new(
name: :author,
relation: { link_mode: 'dialog', dialog_width: 'sm' },
)

Habarico::FilterReference options:

OptionDescription
nameFilter name (symbol)
labelDisplay label
help_textTooltip text
is_always_onKeep filter visible even when inactive (renders in the toolbar)
default_valuePre-filled default value