Skip to content

Column

The Column class is used to create columns inside a field of type table. It allows setting headers, identifiers, width, sorting, and rendering type.

Example usage:

php
Field::make('products')->type('table')->columns([
    Column::make('name')->label('Name')->sortable()->width(200),
    Column::make('price')->label('Price')->sortable()->width(100),
    Column::make('createdon')->label('Created On')->render('date')->sortable(),
    Column::make('published')->label('Published')->render('boolean'),
    Column::make('image')->label('Image')->render('image')->width(150),
]);

Available methods:

  • label(string $label) – Sets the column header.
  • id(string $id) – Sets a unique column identifier.
  • render(string $render) – Defines how the data is displayed. Available values:
  • sortable(bool $sortable = true) – Enables or disables sorting for this column.
  • width(int $width) – Sets the column width in pixels. If not specified, the width is determined automatically.

© PageBlocks 2019-present