File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
components/console/helpers Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -393,3 +393,36 @@ This will display the following table in the terminal:
393
393
| Love |
394
394
| Symfony |
395
395
+---------+
396
+
397
+ .. versionadded :: 5.2
398
+
399
+ Styling of table cells
400
+ ----------------------
401
+
402
+ You can customize a table cell via :class: `Symfony\\ Component\\ Console\\ Helper\\ TableCellStyle `::
403
+
404
+ use Symfony\Component\Console\Helper\Table;
405
+ use Symfony\Component\Console\Helper\TableCellStyle;
406
+
407
+ $table = new Table($output);
408
+
409
+ $table->setRows([
410
+ [
411
+ '978-0804169127',
412
+ new TableCell(
413
+ 'Divine Comedy',
414
+ [
415
+ 'style' => new TableCellStyle([
416
+ 'align' => 'center',
417
+ 'fg' => 'red',
418
+ 'bg' => 'green',
419
+
420
+ // or
421
+ 'cellFormat' => '<info>%s</info>',
422
+ ])
423
+ ]
424
+ )
425
+ ],
426
+ ]);
427
+
428
+ $table->render();
You can’t perform that action at this time.
0 commit comments