Skip to main content

Groups

Groups allow you to lock horizontal starting position and capture the whole group bounding box into one “item”. This lets you use IsItemHovered() or layout primitives such as SameLine() on the whole group.

BeginGroup

Lock horizontal starting position. All widgets added after this call will be treated as part of a group. Example:

EndGroup

Unlock horizontal starting position and capture the whole group bounding box into one “item”.
Always call EndGroup() for each BeginGroup(), even if the group is empty.

Group Usage Patterns

Horizontal Grouping with SameLine

Creating Compound Widgets

Capturing Group Dimensions

Legacy Columns API

The columns API is legacy. Use the Tables API instead for better features and performance.

Columns

Setup number of columns. Use Columns(1) or Columns() to disable columns.
int
Number of columns (1 to disable)
const char*
Optional identifier
bool
default:"true"
Draw border between columns

NextColumn

Move to next column. If currently in the last column, move to the first column of the next row.

GetColumnIndex

Get current column index (0-based).
int
Current column index

GetColumnWidth

Get column width in pixels. Use -1 for current column.
int
default:"-1"
Column index (-1 for current column)
float
Column width in pixels

SetColumnWidth

Set column width in pixels.
int
Column index
float
New width in pixels

GetColumnOffset

Get position of column line in pixels from the left side of the contents region. Use -1 for current column.
int
default:"-1"
Column index (-1 for current column)
float
Column offset in pixels

SetColumnOffset

Set position of column line in pixels from the left side of the contents region.
int
Column index
float
New offset in pixels

GetColumnsCount

Get number of columns (1 when columns are disabled).
int
Number of active columns

Migration to Tables

Instead of using columns, prefer the Tables API: