Skip to main content

Overview

TextTableRenderable renders tabular data with customizable borders, wrapping modes, and column sizing strategies. It supports text selection across cells, multiple border styles, and handles complex content including styled text and Unicode characters.

Basic Usage

With Styled Content

Full Width Table

Text Wrapping

Border Styles

Unicode and CJK Support

Props

TextTableContent
default:"[]"
Table data as a 2D array of cell content. Each cell contains TextChunk[] or null/undefined.
'none' | 'char' | 'word'
default:"'word'"
Text wrapping behavior within cells:
  • 'none': No wrapping, content may overflow
  • 'word': Wrap at word boundaries
  • 'char': Wrap at any character (better for CJK)
'content' | 'full'
default:"'full'"
Column sizing strategy:
  • 'content': Columns sized to fit content
  • 'full': Columns expand to fill available width
'proportional' | 'balanced'
default:"'proportional'"
Algorithm for shrinking columns when content exceeds available width:
  • 'proportional': Shrink proportionally to intrinsic width
  • 'balanced': More even distribution using sqrt-based weighting
number
default:"0"
Padding around cell content (applied to all sides). Minimum value is 0.
boolean
default:"true"
Whether to draw borders. When false, borders are hidden but layout remains the same.
boolean
default:"true"
Whether to show inner borders between cells.
boolean
default:"true"
Whether to show the outer border around the entire table.
BorderStyle
default:"'single'"
Border drawing style: 'single' | 'rounded' | 'double' | 'heavy'
ColorInput
default:"'#FFFFFF'"
Color of the border lines. Accepts hex colors, RGB objects, or color names.
ColorInput
default:"'transparent'"
Background color behind borders.
ColorInput
default:"'transparent'"
Background color for the entire table.
ColorInput
default:"'#FFFFFF'"
Default text color for cell content.
ColorInput
default:"'transparent'"
Default background color for cell content.
number
default:"0"
Default text attributes (bold, italic, etc.) as a bitmask.
boolean
default:"true"
Whether table content can be selected with mouse drag.
ColorInput
Background color for selected text.
ColorInput
Foreground color for selected text.

Methods

content

Get or set the table content.

wrapMode

Get or set the text wrapping mode.

columnWidthMode

Get or set the column width mode.

columnFitter

Get or set the column fitting algorithm.

cellPadding

Get or set the cell padding.

showBorders

Get or set border visibility.

border

Get or set inner border display.

outerBorder

Get or set outer border display.

borderStyle

Get or set the border style.

borderColor

Get or set the border color.

getSelectedText()

Get the currently selected text from the table. Returns tab-separated columns and newline-separated rows.

Selection Support

TextTableRenderable supports three selection modes:
  • single-cell: Selection within one cell
  • column-locked: Selection across rows in the same column
  • grid: Free selection across any cells

Common Patterns

Dynamic Data Updates

Responsive Width

Status Dashboard

Performance Notes

  • Tables efficiently handle cell content changes by only rebuilding modified cells
  • Layout computation is cached and only recalculated when dimensions or content change
  • Large tables with wrapping enabled may require more computation for layout
  • Use columnWidthMode: 'content' for better performance with fixed-width content
  • Box - Container for tables
  • ScrollBox - Scrollable container for large tables
  • Text - For styled text content in cells