Цю сторінку ще не перекладено українською, тому нижче англійська версія.

simple_table() html()

A two-column key / value table from an array, with callbacks for the key cell and row or cell attributes.

html()->simple_table($replace = [], $extra = [])

Опції

ОпціяЗначення
$replaceKey => value rows (values are developer HTML).
key['func' => fn ($key) => ..., 'extra' => ['width' => '20%']]: render the key cell.
trCallback fn ($row, $id) returning row attributes (string or array).
tdCallback fn ($row, $name, $row_id) returning cell attributes.

Приклад

Order 1001
Status Paid
Total $174.90

Код

return html()->simple_table([
    'Order' => '1001',
    'Status' => 'Paid',
    'Total' => '$174.90',
], [
    'key' => ['func' => fn ($in) => '<b>' . $in . '</b>', 'extra' => ['width' => '20%']],
    'tr' => fn ($row, $id) => $id === 2 ? ['class' => 'success'] : '',
    'td' => fn ($row, $name, $row_id) => $row_id === 1 && $name === 'key' ? ['class' => 'info'] : '',
]);

Див. також: html/dd_table, table/table