> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# imgui.create

> Creates a tracked ImGui window record and returns an ImGuiWindow object. The title argument defaults to "REAL_IM_UI" when omitted or nil. The title must be unique among currently tracked ImGui windows; creating another tracked window with the same title raises a Lua error.

<div className="real-function-page">
  ```lua theme={null}
  imgui.create(title?: string): ImGuiWindow
  ```

  ## Arguments

  <ParamField path={"title"} type={"string"}>
    Optional window title. When omitted or nil, "REAL\_IM\_UI" is used. A duplicate title among currently tracked ImGui windows raises a Lua error.
  </ParamField>

  ## Returns

  <ResponseField name={"window"} type={"ImGuiWindow"}>
    ImGuiWindow object with the window methods registered on its methods.
  </ResponseField>

  ## Types

  ### ImGuiWindow

  Handle returned by imgui.create. Control-building methods return the same handle so calls can be chained.

  | Name               | Type                                                                                                                                            | Required | Description                                                                                         |
  | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
  | `Button`           | `(label: string, onClick: () -> ()) -> ImGuiWindow`                                                                                             | Yes      | Appends a button and queues the callback with no arguments after a click.                           |
  | `Checkbox`         | `(label: string, checked: any, onChange: (boolean) -> ()) -> ImGuiWindow`                                                                       | Yes      | Appends a checkbox initialized from the checked value.                                              |
  | `CollapsingHeader` | `(label: string, content: (ImGuiWindow) -> ()) -> ImGuiWindow`                                                                                  | Yes      | Immediately runs content to append elements that render under a collapsible header.                 |
  | `ColorPicker`      | `(label: string, red: number?, green: number?, blue: number?, alpha: number?, onChange: (number, number, number, number) -> ()) -> ImGuiWindow` | Yes      | Appends a ColorEdit4-backed RGBA editor; onChange is read from argument 7.                          |
  | `InputText`        | `(label: string, text: string?, onChange: (string) -> ()) -> ImGuiWindow`                                                                       | Yes      | Appends a single-line InputText using a fixed 256-byte buffer; onChange is argument 4.              |
  | `SameLine`         | `() -> ImGuiWindow`                                                                                                                             | Yes      | Appends a SameLine layout marker that calls same-line layout during rendering.                      |
  | `Separator`        | `() -> ImGuiWindow`                                                                                                                             | Yes      | Appends a Separator marker that calls a separator during rendering.                                 |
  | `SliderFloat`      | `(label: string, value: number, minimum: number, maximum: number, onChange: (number) -> ()) -> ImGuiWindow`                                     | Yes      | Appends a SliderFloat element and queues onChange with one Lua number when the value changes.       |
  | `SliderInt`        | `(label: string, value: integer, minimum: integer, maximum: integer, onChange: (number) -> ()) -> ImGuiWindow`                                  | Yes      | Appends a SliderInt element and queues onChange with one Lua number when the integer value changes. |
  | `Text`             | `(text: string) -> ImGuiWindow`                                                                                                                 | Yes      | Appends a non-interactive text element.                                                             |
  | `destroy`          | `() -> ()`                                                                                                                                      | Yes      | Removes the window and releases its registered callbacks.                                           |

  ## Example

  Create one tracked ImGui window and append controls to the returned ImGuiWindow userdata.

  ```lua theme={null}
  local window = imgui.create("Runtime settings")

  window:Text("Controls")
  window:Separator()

  window:Checkbox("Enabled", true, function(enabled)
      print("Enabled:", enabled)
  end)

  window:SliderFloat("Opacity", 0.8, 0, 1, function(value)
      print("Opacity:", value)
  end)

  window:InputText("Label", "Real", function(text)
      print("Label:", text)
  end)

  window:ColorPicker("Accent", 0.3, 0.6, 1, 1, function(red, green, blue, alpha)
      print(red, green, blue, alpha)
  end)

  window:CollapsingHeader("Advanced", function(section)
      section:Text("Advanced controls go here")
  end)
  ```
</div>
