Skip to main content
Dear ImGui’s table API provides powerful features for creating data grids with sorting, resizing, freezing, and more. Tables replaced the old Columns API starting from version 1.80.

Basic Tables

BeginTable() / EndTable()

Create a table:
const char*
required
Unique identifier for the table
int
required
Number of columns
ImGuiTableFlags
Table behavior flags (see below)
ImVec2
Outer size of the table container
Only call EndTable() if BeginTable() returns true!

Three Ways to Populate Tables

Most flexible - use in loops:

Table Rows

TableNextRow()

Advance to the next row:
ImGuiTableRowFlags
Optional row flags (e.g., ImGuiTableRowFlags_Headers)
float
Minimum row height (includes CellPadding.y * 2)

Table Columns

TableSetupColumn()

Define column properties:
const char*
required
Column label (used for headers)
ImGuiTableColumnFlags
Column behavior flags
float
Initial width (pixels) or weight (ratio)

TableHeadersRow()

Submit a row with header cells:

Table Flags

Sizing Flags

Border Flags

Scrolling Flags

Row Flags

Sorting Flags

Scrolling Tables

Create tables with frozen headers and scrolling:

TableSetupScrollFreeze()

Freeze columns and rows:

Sorting

TableGetSortSpecs()

Get sorting specifications:

Column Flags

Width

Resizing

Sorting

Visibility

Advanced Features

Context Menu

Enable right-click column menu:

Hideable Columns

Reorderable Columns

Complete Example

Performance Tips

For very large tables, use ImGuiListClipper:

Best Practices

Always call EndTable() only if BeginTable() returns true.
Use ImGuiTableFlags_SizingStretchProp for responsive tables that adapt to window size.
Call TableSetupColumn() before TableHeadersRow() to define column properties and labels.
Combine ImGuiTableFlags_ScrollY with TableSetupScrollFreeze(0, 1) to keep headers visible while scrolling.