# Table

> Renders a plain-text table whose columns are as wide as their longest cell and separated by two spaces.

[API reference](/docs/api/index.md) › [Scaffold](/docs/extensions/scaffold/reference/index.md) › [Console](/docs/extensions/scaffold/reference/console/index.md) › Table

| final class | `PHPForge\Scaffold\Console\Table` |
| --- | --- |
| Source | [`src/Console/Table.php`](https://github.com/php-forge/scaffold/blob/main/src/Console/Table.php#L21) |

Renders a plain-text table whose columns are as wide as their longest cell and separated by two spaces.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`render()`](#method-render) static | Returns the header line, a dash separator as wide as the table, and one line per row. | `Table` |

## Method details

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

```php
public static function render(list<string> $headers, list<list<string>> $rows): list<string>
```

Returns the header line, a dash separator as wide as the table, and one line per row.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$headers` | `list<string>` | Column headers. |
| `$rows` | `list<list<string>>` | Rows with one cell per header. |

**Returns**

`list<string>`: Lines without trailing newlines or trailing spaces.