# Create a UI with Moon!

## Step #1 | Load LIB and Create a TAB!

```lua
local library = loadstring(game:HttpGet('https://raw.githubusercontent.com/jakepscripts/moonlib/main/moonlibv2.lua'))() 
local main = library:CreateWindow("Tutorial", "#19cf83", 9160626035) -- // for the hex i chose green (use google color picker)

main:CreateTab("Home")
```

## Step #2 | Get em buttons.. (+ toggles)

```lua
local library = loadstring(game:HttpGet('https://raw.githubusercontent.com/jakepscripts/moonlib/main/moonlibv2.lua'))() 
local main = library:CreateWindow("Tutorial", "#19cf83", 9160626035)

main:CreateTab("Home")

main:CreateLabel("Home", "Label")

main:CreateButton("Home", "Button", "This is a cool popup for a button!", function()
print('btn')
end)

main:CreateToggle("Home", "Toggle", false, function(togglestate)
    print(togglestate)
end)


```

## Step #3 | Sliders, Dropdowns & Keybinds

```lua
local library = loadstring(game:HttpGet('https://raw.githubusercontent.com/jakepscripts/moonlib/main/moonlibv2.lua'))() 
local main = library:CreateWindow("MoonLIB", "#19cf83", 9160626035)

main:CreateTab("Home")

main:CreateLabel("Home", "Label")

main:CreateButton("Home", "Button", "This is a cool popup for a button!", function()
print('btn')
end)

main:CreateToggle("Home", "Toggle", false, function(togglestate)
    print(togglestate)
end)



main:CreateDropdown("Home", "Dropdown", false, {"Oranges", "Apples", "Grapes", "Cherrys"}, function(arg)
    print(arg)
 
end)


main:CreateSlider("Home", "Slider", false, 0, 100, function(sliderval)
print(sliderval)
end)

main:CreateKeybind("Home", "Keybind", false, function(args)
    print(args)
end)
```

## BONUS: Step #4 | Create More Tabs/Labels

```lua
local library = loadstring(game:HttpGet('https://raw.githubusercontent.com/jakepscripts/moonlib/main/moonlibv2.lua'))() 
local main = library:CreateWindow("MoonLIB", "#19cf83", 9160626035)

main:CreateTab("Home") 
main:CreateTab("Tab")


main:CreateTab("Home")

main:CreateLabel("Home", "Label")

main:CreateButton("Home", "Button", "This is a cool popup for a button!", function()
print('btn')
end)

main:CreateToggle("Home", "Toggle", false, function(togglestate)
    print(togglestate)
end)



main:CreateDropdown("Home", "Dropdown", false, {"Oranges", "Apples", "Grapes", "Cherrys"}, function(arg)
    print(arg)
 
end)


main:CreateSlider("Home", "Slider", false, 0, 100, function(sliderval)
print(sliderval)
end)

main:CreateKeybind("Home", "Keybind", false, function(args)
    print(args)
end)

main:CreateButton("Tab", "Another Button!", false, function()
print('btn')
end)

main:CreateToggle("Tab", "Another Toggle!", "this is a popup!", function(togglestate)
    print(togglestate)
end)

-- // TIP: Dont use all popups, you should only use it in the case that one of your objects are a little more complicated.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jakep.gitbook.io/moonv2/tutorials/create-a-ui-with-moon.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
