# Basic Preview


# Default Settings

The simplest way to use `tbl_preview()` -- pass a column-oriented dict and let the defaults do the work.


``` python
from great_docs import tbl_preview
from gdtest_tbl_preview import sample_scores

tbl_preview(sample_scores(20))
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="6" 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>Rows20Columns5
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="name" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

name

<em>str</em>

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

subject

<em>str</em>

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

score

<em>f64</em>

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

grade

<em>str</em>

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

passed

<em>bool</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: 85px">Bob</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">90.8</td>
<td class="gt_row gt_left" style="max-width: 88px">B-</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 85px">Alice</td>
<td class="gt_row gt_left" style="max-width: 104px">Art</td>
<td class="gt_row gt_right" style="max-width: 88px">76.2</td>
<td class="gt_row gt_left" style="max-width: 88px">A-</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 85px">Eve</td>
<td class="gt_row gt_left" style="max-width: 104px">History</td>
<td class="gt_row gt_right" style="max-width: 88px">88.4</td>
<td class="gt_row gt_left" style="max-width: 88px">B-</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 85px">Diana</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">83.8</td>
<td class="gt_row gt_left" style="max-width: 88px">B-</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr class="gd-tbl-divider">
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 85px">Diana</td>
<td class="gt_row gt_left" style="max-width: 104px">History</td>
<td class="gt_row gt_right" style="max-width: 88px">72.2</td>
<td class="gt_row gt_left" style="max-width: 88px">B+</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">15</td>
<td class="gt_row gt_left" style="max-width: 85px">Diana</td>
<td class="gt_row gt_left" style="max-width: 104px">Math</td>
<td class="gt_row gt_right" style="max-width: 88px">57.4</td>
<td class="gt_row gt_left" style="max-width: 88px">D</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">16</td>
<td class="gt_row gt_left" style="max-width: 85px">Iris</td>
<td class="gt_row gt_left" style="max-width: 104px">Math</td>
<td class="gt_row gt_right" style="max-width: 88px">44.8</td>
<td class="gt_row gt_left" style="max-width: 88px">B+</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">17</td>
<td class="gt_row gt_left" style="max-width: 85px">Jack</td>
<td class="gt_row gt_left" style="max-width: 104px">History</td>
<td class="gt_row gt_right" style="max-width: 88px">54</td>
<td class="gt_row gt_left" style="max-width: 88px">B-</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">18</td>
<td class="gt_row gt_left" style="max-width: 85px">Alice</td>
<td class="gt_row gt_left" style="max-width: 104px">Math</td>
<td class="gt_row gt_right" style="max-width: 88px">46.1</td>
<td class="gt_row gt_left" style="max-width: 88px">A+</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">19</td>
<td class="gt_row gt_left" style="max-width: 85px">Iris</td>
<td class="gt_row gt_left" style="max-width: 104px">English</td>
<td class="gt_row gt_right" style="max-width: 88px">56.7</td>
<td class="gt_row gt_left" style="max-width: 88px">B+</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
</tbody>
</table>


# From a List of Dicts

You can also pass a list of row dicts:


``` python
rows = [
    {"city": "Tokyo", "pop_m": 37.4, "country": "Japan"},
    {"city": "Delhi", "pop_m": 32.9, "country": "India"},
    {"city": "Shanghai", "pop_m": 29.2, "country": "China"},
    {"city": "São Paulo", "pop_m": 22.4, "country": "Brazil"},
    {"city": "Mexico City", "pop_m": 21.8, "country": "Mexico"},
]
tbl_preview(rows)
```


<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="city" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

city

<em>str</em>

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

pop_m

<em>f64</em>

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

country

<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: 176px">Tokyo</td>
<td class="gt_row gt_right" style="max-width: 136px">37.4</td>
<td class="gt_row gt_left" style="max-width: 152px">Japan</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 176px">Delhi</td>
<td class="gt_row gt_right" style="max-width: 136px">32.9</td>
<td class="gt_row gt_left" style="max-width: 152px">India</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 176px">Shanghai</td>
<td class="gt_row gt_right" style="max-width: 136px">29.2</td>
<td class="gt_row gt_left" style="max-width: 152px">China</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 176px">São Paulo</td>
<td class="gt_row gt_right" style="max-width: 136px">22.4</td>
<td class="gt_row gt_left" style="max-width: 152px">Brazil</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 176px">Mexico City</td>
<td class="gt_row gt_right" style="max-width: 136px">21.8</td>
<td class="gt_row gt_left" style="max-width: 152px">Mexico</td>
</tr>
</tbody>
</table>


# With a Caption


``` python
tbl_preview(
    sample_scores(12),
    caption="Student Performance -- Fall 2025",
)
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="6" 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>Rows12Columns5
</div></th>
</tr>
<tr class="gt_heading">
<th colspan="6" class="gt_heading gt_subtitle gt_font_normal">Student Performance -- Fall 2025</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="name" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

name

<em>str</em>

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

subject

<em>str</em>

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

score

<em>f64</em>

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

grade

<em>str</em>

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

passed

<em>bool</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: 85px">Bob</td>
<td class="gt_row gt_left" style="max-width: 104px">Math</td>
<td class="gt_row gt_right" style="max-width: 88px">67</td>
<td class="gt_row gt_left" style="max-width: 88px">B-</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 85px">Alice</td>
<td class="gt_row gt_left" style="max-width: 104px">Math</td>
<td class="gt_row gt_right" style="max-width: 88px">56.7</td>
<td class="gt_row gt_left" style="max-width: 88px">F</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 85px">Eve</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">92.2</td>
<td class="gt_row gt_left" style="max-width: 88px">B</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">3</td>
<td class="gt_row gt_left" style="max-width: 85px">Diana</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">85.5</td>
<td class="gt_row gt_left" style="max-width: 88px">A+</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr class="gd-tbl-divider">
<td class="gt_row gt_right gd-tbl-rownum">4</td>
<td class="gt_row gt_left" style="max-width: 85px">Diana</td>
<td class="gt_row gt_left" style="max-width: 104px">Art</td>
<td class="gt_row gt_right" style="max-width: 88px">49.6</td>
<td class="gt_row gt_left" style="max-width: 88px">C</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">7</td>
<td class="gt_row gt_left" style="max-width: 85px">Iris</td>
<td class="gt_row gt_left" style="max-width: 104px">Art</td>
<td class="gt_row gt_right" style="max-width: 88px">52.9</td>
<td class="gt_row gt_left" style="max-width: 88px">C+</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">8</td>
<td class="gt_row gt_left" style="max-width: 85px">Bob</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">85.8</td>
<td class="gt_row gt_left" style="max-width: 88px">A</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">9</td>
<td class="gt_row gt_left" style="max-width: 85px">Jack</td>
<td class="gt_row gt_left" style="max-width: 104px">Art</td>
<td class="gt_row gt_right" style="max-width: 88px">46.1</td>
<td class="gt_row gt_left" style="max-width: 88px">D</td>
<td class="gt_row gt_left" style="max-width: 96px">False</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">10</td>
<td class="gt_row gt_left" style="max-width: 85px">Grace</td>
<td class="gt_row gt_left" style="max-width: 104px">History</td>
<td class="gt_row gt_right" style="max-width: 88px">62.8</td>
<td class="gt_row gt_left" style="max-width: 88px">B</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">11</td>
<td class="gt_row gt_left" style="max-width: 85px">Alice</td>
<td class="gt_row gt_left" style="max-width: 104px">Science</td>
<td class="gt_row gt_right" style="max-width: 88px">61.5</td>
<td class="gt_row gt_left" style="max-width: 88px">F</td>
<td class="gt_row gt_left" style="max-width: 96px">True</td>
</tr>
</tbody>
</table>
