Skip to content

[Console] Table vertical rendering usage #16817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions components/console/helpers/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ The output of this command will be:
| (the rest of the rows...) |
+-------+------------+--------------------------------+

Console tables content is displayed horizontally by default.
You can change this behavior via the :method:`Symfony\\Component\\Console\\Helper\\Table::setVertical` method::

// ...
$table->setVertical();
$table->render();

The output of this command will be:

.. code-block:: terminal

+------------------------------+
| ISBN: 99921-58-10-7 |
| Title: Divine Comedy |
| Author: Dante Alighieri |
|------------------------------|
| ISBN: 9971-5-0210-0 |
| Title: A Tale of Two Cities |
| Author: Charles Dickens |
+------------------------------+

.. versionadded:: 6.1

Support for vertical rendering was introduced in Symfony 6.1.

The table style can be changed to any built-in styles via
:method:`Symfony\\Component\\Console\\Helper\\Table::setStyle`::

Expand Down