# Table

> Builds the shared debugger table shell: an optional column-header row above the body rows, inside a scroll wrapper.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Helper](/docs/extensions/debug-core/reference/helper/index.md) › Table

| final class | `PHPForge\Debug\Helper\Table` |
| --- | --- |
| Source | [`src/Helper/Table.php`](https://github.com/php-forge/debug-core/blob/main/src/Helper/Table.php#L14) |

Builds the shared debugger table shell: an optional column-header row above the body rows, inside a scroll wrapper.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`build()`](#method-build) static | Builds the `<table>` element, prepending a `<thead>` row of `<th scope="col">` cells when labels are supplied. | `Table` |
| [`render()`](#method-render) static | Renders the table shell inside its scroll wrapper. | `Table` |

## Method details

### build() <span id="method-build"></span>

```php
public static function build(list<string> $headers, list<UIAwesome\Html\Table\Tr> $rows, string $class = \PHPForge\Debug\Theme\Css::TABLE): UIAwesome\Html\Table\Table
```

Builds the `<table>` element, prepending a `<thead>` row of `<th scope="col">` cells when labels are supplied.

Exposed on its own so sections that decorate the shell (extra attributes, a fixed layout) still share one
header and body contract.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$headers` | `list<string>` | Column labels, or `[]` for a table without a header row. |
| `$rows` | `list<`[`UIAwesome\Html\Table\Tr`](/docs/extensions/html/reference/table/tr/index.md)`>` | Body rows in display order. |
| `$class` | `string` | Table CSS classes. |

**Returns**

[`UIAwesome\Html\Table\Table`](/docs/extensions/html/reference/table/table/index.md): Table element.

### render() <span id="method-render"></span>

```php
public static function render(list<string> $headers, list<UIAwesome\Html\Table\Tr> $rows, string $tableClass = \PHPForge\Debug\Theme\Css::TABLE, string $wrapClass = \PHPForge\Debug\Theme\Css::TABLE_WRAP): string
```

Renders the table shell inside its scroll wrapper.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$headers` | `list<string>` | Column labels, or `[]` for a table without a header row. |
| `$rows` | `list<`[`UIAwesome\Html\Table\Tr`](/docs/extensions/html/reference/table/tr/index.md)`>` | Body rows in display order. |
| `$tableClass` | `string` | Table CSS classes. |
| `$wrapClass` | `string` | Scroll-wrapper CSS classes. |

**Returns**

`string`: Wrapped table markup.