text_padded() table()

A text column indented by the level of the row, for trees such as categories or menus.

table()->text_padded($name, $extra = [])

Options

OptionMeaning
(text options)Every option of text(); padding is set.

Example

Name
Furniture
└Chairs
└Office chairs
Lighting

Code

$rows = [
    1 => ['id' => 1, 'name' => 'Furniture', 'level' => 0],
    2 => ['id' => 2, 'name' => 'Chairs', 'level' => 1],
    3 => ['id' => 3, 'name' => 'Office chairs', 'level' => 2],
    4 => ['id' => 4, 'name' => 'Lighting', 'level' => 0],
];
return table($rows, ['no_pages' => 1])->text_padded('name');

Notes

  • The rows need a level field (0 for the top); each level indents 20px with a corner mark.

See also: table/text, table/input