Skip to main content
Dear ImGui provides a rich set of widgets for building interactive user interfaces. All widgets follow the immediate mode paradigm where you call functions every frame to display and interact with UI elements.

Widget Categories

Dear ImGui widgets are organized into several categories:

Text and Labels

Display formatted text, colored text, and labels

Buttons

Interactive buttons including standard, small, and arrow buttons

Input Widgets

Text input, numeric input, and input validation

Sliders and Drags

Value adjustment widgets with visual feedback

Color Pickers

Color selection and editing widgets

Trees and Selectables

Hierarchical data display and selection widgets

Combos and Lists

Dropdown menus and list boxes

Menus

Menu bars and context menus

Tables

Advanced table layouts with sorting and resizing

Common Widget Patterns

Return Values

Most widgets return true when their value has been changed or when they’ve been activated:

Widget IDs

Dear ImGui uses the widget label to generate a unique ID. When you need multiple widgets with the same label, use PushID() / PopID():
You can also use the ## syntax to hide part of the label:

Querying Widget State

After calling a widget function, you can query its state using IsItem*() functions:

Widget Sizing

Many widgets accept a size parameter. Common conventions:
  • size.x == 0.0f: Use default/natural width
  • size.x > 0.0f: Specify exact width in pixels
  • size.x < 0.0f: Align to right edge with specified margin
  • -FLT_MIN: Use all available width

Widget Flags

Many widget types support flags to customize their behavior:

Best Practices

Widget state variables should persist across frames:
Only check return values when you need to respond to changes:
Labels help with debugging and make code more readable:

Next Steps

Explore specific widget categories to learn about their unique features and usage patterns: