Columns
Last updated
Last updated
When the visible columns of an object-table
are empty, the row of columns gets hidden in its entirety. In the example below both columns evaluate to an empty string, which makes the column heading disappear.
Various fit directives are exposed for controlling column content. The default is auto
where the column attempts to divide space evenly or, if possible, expand to its maximum width.
object-table
will always respect escape sequences regardless of the fit mode being applied. In both examples below, the content will always be on at least 3 lines.
With fit="shrink"
the column will shrink to its minimum width, causing column headings and content to wrap.
With fit="no-wrap"
the column will prevent automatic wrapping, which forces the content into a single line.
Tip: Use this in conjunction with escape sequences to ensure how many lines of text there will be, while ensuring that each line does not wrap.
With fit="auto"
(which is also the default) content will automatically wrap at the tables discretion. The table will always try to prevent horizontal scrolling by causing content to wrap when it can. In cases where content can no longer wrap to new lines, the table will start to scroll horizontally.
show-if
and hide-if
can also be applied on individual columns:
Note: When sets of show-if
and hide-if
change at the same time, the table will wait for all of the changes to propagate first and then apply them at the same time.