> For the complete documentation index, see [llms.txt](https://solaartw.gitbook.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://solaartw.gitbook.io/developer/documentation/utilities/cyberpunk-engine-tweaks/reference-sheets/ui-examples.md).

# UI Examples

This page contains examples for creating UI for your mod using the built-in ImGui library.Everything you need to know about Dear ImGui can be found [here ](https://github.com/yamashi/CyberEngineTweaks/blob/master/src/sol_imgui/README.md)and [here](https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp).

### Basic Window <a href="#basic-window" id="basic-window"></a>

ImGui.SetNextWindowPos(100, 500, ImGuiCond.FirstUseEver) -- set window position x, yImGui.SetNextWindowSize(300, 600, ImGuiCond.Appearing) -- set window size w, h​if ImGui.Begin("Unique Window Name") thenImGui.Text("Hello World")-- more window contents hereendImGui.End()

### Modal/Popup Window <a href="#modal-popup-window" id="modal-popup-window"></a>

if ImGui.Button("Pop Button", 120, 0) thenImGui.OpenPopup("Delete?")end​if ImGui.BeginPopupModal("Delete?", true, ImGuiWindowFlags.AlwaysAutoResize) thenImGui.Text("This is a popup")if ImGui.Button("Close") then ImGui.CloseCurrentPopup() endImGui.EndPopup()end

### Combo Box with Selectables <a href="#combo-box-with-selectables" id="combo-box-with-selectables"></a>

local DropdownOptions = {"1", "2", "3", "4", "5"}local DropdownSelected = "1"​if ImGui.BeginCombo("##My Combo Box", DropdownSelected) then -- Remove the ## if you'd like for the title to display above combo box​for i, option in ipairs(DropdownSelected) do​if ImGui.Selectable(option, (option == DropdownSelected)) thenDropdownSelected = optionImGui.SetItemDefaultFocus()end​end​ImGui.EndCombo()end

### Button <a href="#button" id="button"></a>

if ImGui.Button("Click Me!", 100, 20) then -- Label, width, height - Use -1 as width for button to span available horizontal space-- do stuff here when button is clickedendregisterForEvent("onUpdate", function()if btn thenprint("You pressed me!")emdend)​registerForEvent("onDraw", function()btn = ImGui.Button("Click me I'm a Sexy Button", 250, 25)end)
