# Text-Heavy Tables


# Long Strings (Default Width)

Cells with very long text are capped at `max_col_width` (250px by default) and show an ellipsis instead of wrapping.


``` python
from great_docs import tbl_preview

data = {
    "id": [1, 2, 3, 4, 5],
    "title": [
        "A short title",
        "A moderately long title that tests mid-range widths",
        "This title is intentionally very long so that it will definitely exceed the maximum column width and trigger text-overflow ellipsis behavior in the rendered table cell",
        "Brief",
        "Another extremely verbose title string that goes on and on to stress-test the truncation and overflow handling in the preview table renderer",
    ],
    "status": ["draft", "published", "review", "archived", "published"],
}

tbl_preview(data, show_all=True)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #F0F0F0; color: #333333; border: 1px solid #F0F0F0; margin-right: 8px;">Table</span>Rows5Columns3
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="id" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"><div>

id

<em>i64</em>

</div></th>
<th id="title" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

title

<em>str</em>

</div></th>
<th id="status" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

status

<em>str</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_right" style="max-width: 78px">1</td>
<td class="gt_row gt_left" style="max-width: 278px">A short title</td>
<td class="gt_row gt_left" style="max-width: 109px">draft</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_right" style="max-width: 78px">2</td>
<td class="gt_row gt_left" style="max-width: 278px">A moderately long title that tests mid-range widths</td>
<td class="gt_row gt_left" style="max-width: 109px">published</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_right" style="max-width: 78px">3</td>
<td class="gt_row gt_left" style="max-width: 278px">This title is intentionally very long so that it will definitely exceed the maximum column width and trigger text-overflow ellipsis behavior in the rendered table cell</td>
<td class="gt_row gt_left" style="max-width: 109px">review</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_right" style="max-width: 78px">4</td>
<td class="gt_row gt_left" style="max-width: 278px">Brief</td>
<td class="gt_row gt_left" style="max-width: 109px">archived</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_right" style="max-width: 78px">5</td>
<td class="gt_row gt_left" style="max-width: 278px">Another extremely verbose title string that goes on and on to stress-test the truncation and overflow handling in the preview table renderer</td>
<td class="gt_row gt_left" style="max-width: 109px">published</td>
</tr>
</tbody>
</table>


# Descriptions and Paragraphs

Real-world data often has paragraph-length text in columns.


``` python
data = {
    "package": ["NumPy", "Pandas", "Polars", "Great Tables", "Pointblank"],
    "description": [
        "Fundamental package for scientific computing with Python. Provides N-dimensional arrays, linear algebra, Fourier transforms, and random number generation.",
        "Powerful data structures for data analysis, time series, and statistics. Built on NumPy with labeled axes, automatic alignment, and rich I/O.",
        "Lightning-fast DataFrame library in Rust with a Python API. Lazy evaluation, multi-threaded queries, and Apache Arrow memory format.",
        "Build beautiful, publication-quality tables in Python. Supports Polars and Pandas DataFrames with fine-grained styling, formatting, and export.",
        "Data validation library for Python. Define expectations, validate data, and generate detailed reports with table-level and column-level checks.",
    ],
    "version": ["1.26.0", "2.2.0", "0.20.0", "0.15.0", "0.14.0"],
}

tbl_preview(data, show_all=True)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #F0F0F0; color: #333333; border: 1px solid #F0F0F0; margin-right: 8px;">Table</span>Rows5Columns3
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="package" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

package

<em>str</em>

</div></th>
<th id="description" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

description

<em>str</em>

</div></th>
<th id="version" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

version

<em>str</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_left" style="max-width: 116px">NumPy</td>
<td class="gt_row gt_left" style="max-width: 264px">Fundamental package for scientific computing with Python. Provides N-dimensional arrays, linear algebra, Fourier transforms, and random number generation.</td>
<td class="gt_row gt_left" style="max-width: 85px">1.26.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 116px">Pandas</td>
<td class="gt_row gt_left" style="max-width: 264px">Powerful data structures for data analysis, time series, and statistics. Built on NumPy with labeled axes, automatic alignment, and rich I/O.</td>
<td class="gt_row gt_left" style="max-width: 85px">2.2.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 116px">Polars</td>
<td class="gt_row gt_left" style="max-width: 264px">Lightning-fast DataFrame library in Rust with a Python API. Lazy evaluation, multi-threaded queries, and Apache Arrow memory format.</td>
<td class="gt_row gt_left" style="max-width: 85px">0.20.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 116px">Great Tables</td>
<td class="gt_row gt_left" style="max-width: 264px">Build beautiful, publication-quality tables in Python. Supports Polars and Pandas DataFrames with fine-grained styling, formatting, and export.</td>
<td class="gt_row gt_left" style="max-width: 85px">0.15.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 116px">Pointblank</td>
<td class="gt_row gt_left" style="max-width: 264px">Data validation library for Python. Define expectations, validate data, and generate detailed reports with table-level and column-level checks.</td>
<td class="gt_row gt_left" style="max-width: 85px">0.14.0</td>
</tr>
</tbody>
</table>


# Narrow Max Width (120px)

Force aggressive truncation with a tight `max_col_width`:


``` python
tbl_preview(data, show_all=True, max_col_width=120)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #F0F0F0; color: #333333; border: 1px solid #F0F0F0; margin-right: 8px;">Table</span>Rows5Columns3
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="package" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

package

<em>str</em>

</div></th>
<th id="description" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

description

<em>str</em>

</div></th>
<th id="version" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

version

<em>str</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_left" style="max-width: 159px">NumPy</td>
<td class="gt_row gt_left" style="max-width: 177px">Fundamental package for scientific computing with Python. Provides N-dimensional arrays, linear algebra, Fourier transforms, and random number generation.</td>
<td class="gt_row gt_left" style="max-width: 128px">1.26.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 159px">Pandas</td>
<td class="gt_row gt_left" style="max-width: 177px">Powerful data structures for data analysis, time series, and statistics. Built on NumPy with labeled axes, automatic alignment, and rich I/O.</td>
<td class="gt_row gt_left" style="max-width: 128px">2.2.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 159px">Polars</td>
<td class="gt_row gt_left" style="max-width: 177px">Lightning-fast DataFrame library in Rust with a Python API. Lazy evaluation, multi-threaded queries, and Apache Arrow memory format.</td>
<td class="gt_row gt_left" style="max-width: 128px">0.20.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 159px">Great Tables</td>
<td class="gt_row gt_left" style="max-width: 177px">Build beautiful, publication-quality tables in Python. Supports Polars and Pandas DataFrames with fine-grained styling, formatting, and export.</td>
<td class="gt_row gt_left" style="max-width: 128px">0.15.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 159px">Pointblank</td>
<td class="gt_row gt_left" style="max-width: 177px">Data validation library for Python. Define expectations, validate data, and generate detailed reports with table-level and column-level checks.</td>
<td class="gt_row gt_left" style="max-width: 128px">0.14.0</td>
</tr>
</tbody>
</table>


# Wide Max Width (500px)

Allow generous room -- long text is still capped, but more is visible:


``` python
tbl_preview(data, show_all=True, max_col_width=500)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #F0F0F0; color: #333333; border: 1px solid #F0F0F0; margin-right: 8px;">Table</span>Rows5Columns3
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="package" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

package

<em>str</em>

</div></th>
<th id="description" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

description

<em>str</em>

</div></th>
<th id="version" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

version

<em>str</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_left" style="max-width: 102px">NumPy</td>
<td class="gt_row gt_left" style="max-width: 500px">Fundamental package for scientific computing with Python. Provides N-dimensional arrays, linear algebra, Fourier transforms, and random number generation.</td>
<td class="gt_row gt_left" style="max-width: 71px">1.26.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 102px">Pandas</td>
<td class="gt_row gt_left" style="max-width: 500px">Powerful data structures for data analysis, time series, and statistics. Built on NumPy with labeled axes, automatic alignment, and rich I/O.</td>
<td class="gt_row gt_left" style="max-width: 71px">2.2.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 102px">Polars</td>
<td class="gt_row gt_left" style="max-width: 500px">Lightning-fast DataFrame library in Rust with a Python API. Lazy evaluation, multi-threaded queries, and Apache Arrow memory format.</td>
<td class="gt_row gt_left" style="max-width: 71px">0.20.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 102px">Great Tables</td>
<td class="gt_row gt_left" style="max-width: 500px">Build beautiful, publication-quality tables in Python. Supports Polars and Pandas DataFrames with fine-grained styling, formatting, and export.</td>
<td class="gt_row gt_left" style="max-width: 71px">0.15.0</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 102px">Pointblank</td>
<td class="gt_row gt_left" style="max-width: 500px">Data validation library for Python. Define expectations, validate data, and generate detailed reports with table-level and column-level checks.</td>
<td class="gt_row gt_left" style="max-width: 71px">0.14.0</td>
</tr>
</tbody>
</table>


# Mixed Short and Long Columns

Short numeric/code columns alongside verbose text -- each column gets its own computed width.


``` python
data = {
    "code": ["E001", "E002", "E003", "W001", "W002", "I001", "I002", "E004"],
    "severity": ["error", "error", "error", "warning", "warning", "info", "info", "error"],
    "message": [
        "Undefined variable: foobar",
        "Type mismatch: expected int, got str in argument `count` of function process_batch()",
        "Division by zero in expression total / n_items where n_items evaluates to 0",
        "Unused import: os (imported but never referenced in module)",
        "Variable `tmp` assigned on line 42 but never used anywhere in the function body",
        "Module docstring missing: consider adding a module-level docstring",
        "Line too long: 127 characters (max 120). Consider breaking this into multiple lines for readability",
        "Syntax error: unexpected token ) at position 34 in expression parse(input))",
    ],
    "line": [12, 45, 78, 3, 42, 1, 99, 34],
}

tbl_preview(data, show_all=True)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="5" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #F0F0F0; color: #333333; border: 1px solid #F0F0F0; margin-right: 8px;">Table</span>Rows8Columns4
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="code" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

code

<em>str</em>

</div></th>
<th id="severity" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

severity

<em>str</em>

</div></th>
<th id="message" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

message

<em>str</em>

</div></th>
<th id="line" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"><div>

line

<em>i64</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_left" style="max-width: 59px">E001</td>
<td class="gt_row gt_left" style="max-width: 87px">error</td>
<td class="gt_row gt_left" style="max-width: 259px">Undefined variable: foobar</td>
<td class="gt_row gt_right" style="max-width: 59px">12</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 59px">E002</td>
<td class="gt_row gt_left" style="max-width: 87px">error</td>
<td class="gt_row gt_left" style="max-width: 259px">Type mismatch: expected int, got str in argument `count` of function process_batch()</td>
<td class="gt_row gt_right" style="max-width: 59px">45</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 59px">E003</td>
<td class="gt_row gt_left" style="max-width: 87px">error</td>
<td class="gt_row gt_left" style="max-width: 259px">Division by zero in expression total / n_items where n_items evaluates to 0</td>
<td class="gt_row gt_right" style="max-width: 59px">78</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 59px">W001</td>
<td class="gt_row gt_left" style="max-width: 87px">warning</td>
<td class="gt_row gt_left" style="max-width: 259px">Unused import: os (imported but never referenced in module)</td>
<td class="gt_row gt_right" style="max-width: 59px">3</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 59px">W002</td>
<td class="gt_row gt_left" style="max-width: 87px">warning</td>
<td class="gt_row gt_left" style="max-width: 259px">Variable `tmp` assigned on line 42 but never used anywhere in the function body</td>
<td class="gt_row gt_right" style="max-width: 59px">42</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">5</td>
<td class="gt_row gt_left" style="max-width: 59px">I001</td>
<td class="gt_row gt_left" style="max-width: 87px">info</td>
<td class="gt_row gt_left" style="max-width: 259px">Module docstring missing: consider adding a module-level docstring</td>
<td class="gt_row gt_right" style="max-width: 59px">1</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">6</td>
<td class="gt_row gt_left" style="max-width: 59px">I002</td>
<td class="gt_row gt_left" style="max-width: 87px">info</td>
<td class="gt_row gt_left" style="max-width: 259px">Line too long: 127 characters (max 120). Consider breaking this into multiple lines for readability</td>
<td class="gt_row gt_right" style="max-width: 59px">99</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">7</td>
<td class="gt_row gt_left" style="max-width: 59px">E004</td>
<td class="gt_row gt_left" style="max-width: 87px">error</td>
<td class="gt_row gt_left" style="max-width: 259px">Syntax error: unexpected token ) at position 34 in expression parse(input))</td>
<td class="gt_row gt_right" style="max-width: 59px">34</td>
</tr>
</tbody>
</table>
