nm-lib

A UI library for Roblox script hubs. One HTTP request, no image assets, and a reload guard so re-executing your script never stacks a second window.

1http request
13 KBgzipped
270instances / 24 controls
81vector icons
0image assets
0idle loops
local Library = loadstring(game:HttpGet("https://nm.nitaimaarek.com/lib"))()

Why this one

Single request

Theming, config saving and every widget live in one file. Libraries split into Library + ThemeManager + SaveManager pay three round trips before a menu appears.

38% fewer instances

The same 24-control menu costs 269 Instances against 431 on the build it replaced. Dropdown rows and colourpicker panels are not built until opened, and only the things that need rounding get a UICorner.

Resizable

Drag any edge or corner. North and west edges move the origin as they shrink, so the opposite corner stays put. Width snaps even so the content columns stay on whole pixels.

Guarded everywhere

Every non-standard global (gethui, cloneref, getgenv, the file API) is probed and falls back. What your executor supports is reported on Library.Compat.

Quick start

Window, tab, section, controls. Values live on Library.Options[flag].Value.

local Library = loadstring(game:HttpGet("https://nm.nitaimaarek.com/lib"))()

local Window = Library:CreateWindow({
    Title     = "my hub",
    Subtitle  = "v1.0",
    ToggleKey = "Ctrl+H",        -- set in code, not in the UI
    Preset    = "onyx",          -- onyx | ice | midnight | carbon | comic | bubblegum | chalkboard
})

local Tab     = Window:Tab("Main")
local Section = Tab:Section({ Name = "Combat", Side = "Left" })

Section:Toggle({
    Flag = "aimbot",
    Text = "Aimbot",
    Default = false,
    Callback = function(value)
        print("aimbot:", value)
    end,
})

Section:Slider({ Flag = "fov", Text = "FOV", Min = 10, Max = 500, Default = 120 })

-- read a value anywhere
if Library.Options.aimbot.Value then --[[ ... ]] end

Reloading

The part most libraries get wrong. Executing your script a second time should replace the menu, not stack another one on top of it.

The guard runs before a single Instance is created, in three layers:

LayerWhat it doesCovers
HandoffCalls Unload() on the previous instance held in getgenv().NMLibThe normal case. Disconnects everything and runs your cleanups.
SweepScans gethui(), CoreGui and PlayerGui for a marker attribute and destroys any matchExecutor wiped globals between runs but left the GUI alive.
RegistryLibrary:Connect / :Clean / :OnUnload track what your script madeYour loops and Instances, which the library cannot see otherwise.

So the only rule: create connections through the library and it cleans up after you.

-- dies on reload, automatically
Library:Connect(RunService.Heartbeat, function() --[[ ... ]] end)

-- anything else you made
Library:Clean(myHighlight)          -- Instance, connection, or function
Library:OnUnload(function() --[[ teardown ]] end)
PreserveState. Pass PreserveState = true to CreateWindow and the previous run's values are re-applied after the new UI is built. While iterating on a script your toggles and sliders stay where you left them instead of resetting on every execution. Off by default so that changing a Default in your code actually takes effect.

Keys and combos

The hide key and every keybind accept the same forms, including modifier combos.

-- all four are valid, anywhere a key is taken
"Ctrl+H"
"Ctrl+Shift+P"
Enum.KeyCode.RightShift
{ Enum.KeyCode.LeftControl, Enum.KeyCode.H }
Enum.UserInputType.MouseButton2

Matching is exact: a bare H bind does not fire while Ctrl is held, so H and Ctrl+H can coexist without stepping on each other. A modifier bound on its own still works — its own group is excluded from the exactness check.

Keybind controls

Click the pill to rebind, right-click to cycle the mode, Escape to clear. While capturing, modifiers are held rather than committed, so pressing Ctrl then H records the combo. Releasing a modifier alone commits it as a plain bind.

Mode:GetState() returns
"Hold"true only while held; the callback also fires with false on release
"Toggle"flips on each press
"Always"always true
Section:Keybind({ Flag = "aimkey", Text = "Aim", Default = "Ctrl+Shift+P", Mode = "Hold" })

Library:Connect(RunService.RenderStepped, function()
    if Library.Options.aimkey:GetState() then -- aim end
end)

print(Library.Options.aimkey:GetKeyString())   --> "Ctrl+Shift+P"

Rebinding is silent — the callback is reserved for real presses and receives the resulting state, not the key.

Watermark

Optional, draggable, and built out of named segments. Every segment is just a function returning a string, so the built-in counters and your own are the same thing.

local wm = Library:Watermark({ Separator = "  |  " })

wm:AddSegment("title", "nm hub", 1)                 -- a literal string
wm:AddSegment("fps",   Library.Counters.fps, 2)      -- a built-in
wm:AddSegment("ping",  Library.Counters.ping, 3)

local kills = 0
wm:AddSegment("kills", function()                     -- anything you want
    return kills .. " kills"
end, 4)

Renders as nm hub | 60 fps | 38 ms | 7 kills. A segment returning nil or an empty string is skipped, and a segment that errors is contained rather than taking the watermark down.

MethodNotes
:AddSegment(name, fn, order)fn may be a function or a plain string. Lower order renders first.
:RemoveSegment(name)Drops one segment.
:Set(value)Clears everything and sets a single segment.
:Clear()Removes all segments.
:SetSeparator(s) / :SetInterval(n)Default " | " and 0.5 seconds.
:SetVisible(b) / :SetPosition(u)Draggable by default; pass Draggable = false to pin it.
:Refresh()Force an immediate rebuild.

Built-in counters

Library.Counters holds fps, ping, time, players and position. They are ordinary functions — call them yourself if you want the value rather than the label.

One timer drives the whole watermark, not one per segment, and it only writes to the label when the joined text actually changes. Library.FPS is the live frame rate if you want it elsewhere.

Look

Dark monochrome, tight radii, hairline borders. Colour is reserved for state so the chrome stays quiet. Seven presets ship; everything is overridable.

Library:UsePreset("ice")
Library:SetTheme({ Accent = Color3.fromRGB(96, 178, 235) })
Library:SetFont("Ubuntu")                      -- ui, mono, bold families

SetTheme restyles everything already on screen, fonts included. Theme keys:

Accent  AccentDim  Background  Surface   Surface2  Surface3
Border  BorderSoft Text        SubText   Dim
Success Warn       Danger
Radius  RadiusSm   RadiusXs    Stroke    Inset
UI      UIBold     Mono        LegacyUI  LegacyBold  LegacyMono
Radius and Stroke are read at build time. At Radius = 0 no UICorner is created at all, which is where some of the instance saving comes from. Corners that were built get re-rounded on a preset switch, but a build that started flat cannot grow corners that never existed — so if you plan to switch presets live, start from a rounded one.

Typography

Roboto Regular via FontFace with an explicit weight, not the legacy Font enum — the legacy path is what makes most menus look soft at 12–14px. Values and keybind pills are RobotoMono so rows do not reflow as digits change width.

Library

CreateWindow(options)

OptionTypeDefaultNotes
Titlestring"nm hub"Top-left title.
SubtitlestringnilMono text on the right of the title bar.
SizeUDim2620 × 450Width is rounded down to an even number.
PositionUDim2centredScale is collapsed to offset at creation.
ToggleKeycomboRightShiftAny form from Keys. Code only, deliberately not in the UI.
Presetstring"onyx"onyx | ice | midnight | carbon | comic | bubblegum | chalkboard. Applied before Theme and Accent.
ThemetablenilAny theme keys to override at creation.
AccentColor3presetShortcut for Theme.Accent.
Font / MonoFontstringRoboto / RobotoMonoRoblox font family names.
PreserveStatebooleanfalseRe-apply the previous run's values after reload.
WatermarkstringnilShortcut that creates a watermark with that title plus FPS.
Animationsbooleantruefalse replaces every tween with an instant set.
MobileButtonbooleantrueDraggable toggle bubble, touch devices only.
Layoutstring"topbar"topbar | sidebar.
Columnsnumber|string"auto""auto" picks 1–3 by width, or force a fixed count.
SidebarWidthnumber132Tab column width, sidebar layout only.
ResizablebooleantrueDrag any edge or corner. false pins the size.
Scalenumber1Scales the whole menu, text included. Window:SetScale(n) at runtime.
MinWidth / MinHeightnumber420 / 300Resize floor.
AutoShowbooleantruefalse starts hidden.

Notify(options)

Also accepts a plain string. Returns { Dismiss = function }. Works before CreateWindow.

Library:Notify({
    Title    = "Config",
    Text     = "saved",
    Duration = 4,
    Type     = "success",   -- info | success | warn | error
})

Other members

MemberNotes
Library.Options[flag]Every element by flag. Library.Flags is the same table.
Library.CompatWhat the executor supports: cloneref, getgenv, HiddenGui, CoreGui, protect_gui.
Library.FPSLive frame rate, updated twice a second while a watermark exists.
Library.AnimationsSet false at any time to kill every tween.
Library.Combo.parse(v), .matches(combo, input), .display(combo) if you want your own binds.
Library:Connect(sig, fn)Connect and register for cleanup.
Library:Clean(x)Register an Instance, connection or function for teardown.
Library:OnUnload(fn)Run fn when the script reloads or unloads.
Library:Unload()Tear everything down now.
Library:GetState() / :LoadState(s)Serialise or restore every flag value.
Library:SaveConfig(n) / :LoadConfig(n)JSON under Library.ConfigFolder (default nm-lib). No-ops without a file API.

Window and tabs

local Tab     = Window:Tab("Main")
local Section = Tab:Section({ Name = "Combat", Side = "Right" })   -- Left (default) | Right

Window:SetVisible(false)
Window:Toggle()
Window:SetToggleKey("Ctrl+Shift+M")
Window:SelectTab(Tab)
Window:SetLayout("sidebar")
Window:SetColumns(2)          -- or "auto"

Multiple windows

Call CreateWindow as many times as you like. Each window owns its position, size, layout, column count, scale and hide key; they share the notification stack, the watermark and the icon set.

local main = Library:CreateWindow("nm hub")

local mini = Library:CreateWindow({
    Title     = "quick",
    Size      = UDim2.fromOffset(300, 230),
    Position  = UDim2.fromOffset(30, 90),
    Layout    = "sidebar",
    Columns   = 1,
    ToggleKey = "Ctrl+J",
})

mini:SetScale(0.9)   -- per window, does not touch the others
mini:Destroy()       -- closes just this one
MemberNotes
Library.WindowsEvery live window, in creation order.
Library.WindowThe most recently created one. Single-window scripts can keep using it.
Window:Destroy()Tears down one window, leaves the rest running.

A window created without an explicit Position cascades 28px clear of the ones already open, so a second window never lands exactly on the first.

One input pump, not one per window. The hide-key and keybind handler is created once no matter how many windows exist. Built per window, N windows would connect N handlers — so every keybind callback would fire N times and each window would toggle on every other window's hide key. Each window answers only to its own.

Shorthand

Every control takes either a table or plain positional arguments. Same control, same result — pick whichever reads better where you are.

-- table form: every knob available
Section:Toggle({ Flag = "aim", Text = "Aimbot", Default = false, Callback = fn })

-- short form: text, values, callback
Section:Toggle("Aimbot", false, fn)
ControlPositional form
:Button(text, callback)
:Toggle(text, default, callback)
:Slider(text, min, max, default, callback)
:Dropdown(text, values, default, callback)
:Input(text, placeholder, default, callback)
:Keybind(text, default, mode, callback)
:Colorpicker(text, default, callback)
:Label(text)
Tab:Section(name, side)
Window:Tab(name, icon)
Library:CreateWindow(title, subtitle)

Trailing arguments can be skipped, and the callback is picked out wherever it lands — :Toggle("Aimbot", fn) works as well as :Toggle("Aimbot", false, fn).

Derived flags

Without an explicit Flag, one is derived from the text by lowercasing and stripping everything that is not a letter or digit, so :Toggle("Auto farm") is reachable as Library.Options.autofarm. That is what makes the short form worth using rather than a trap: values stay addressable.

Two controls with the same text would collide, so the second gets a numeric suffix (duplicate, duplicate2) and warns in the console. Set Flag explicitly when you care which is which — and always for anything you save to a config.
local Window = Library:CreateWindow("nm hub", "v1.0")
local farm   = Window:Tab("Farm", "farm")
local auto   = farm:Section("Auto")

auto:Toggle("Auto farm", false, function(on) print(on) end)
auto:Slider("Delay", 0, 5, 0.5)
auto:Dropdown("Mode", { "Closest", "Safest" }, "Closest")
auto:Button("Collect now", collect)

if Library.Options.autofarm.Value then --[[ ... ]] end

Stacking

Nothing in the menu is allowed to end up on top of anything else by accident. Layers are declared, not inherited from creation order.

LayerZWhat sits there
Notify100toasts, always readable over everything
Watermark70above the window, below toasts
MobileButton60the touch toggle bubble
Chrome12header, tab strip, content
ResizeZone11the eight grab strips, under the content
Window10the window frame itself

Two real bugs this fixed. Notifications were built before the window and both sat at the default ZIndex, so sibling ordering drew the menu over the toasts. And the resize zones were pinned above everything at ZIndex 20, spanning a strip inside every edge, which quietly swallowed clicks on any control that reached the window border.

The grab strips are now exactly the width of Theme.Inset and sit below the content, so the zone ends precisely where the content begins — adjacent, never overlapping.

Panels

Dropdowns and colourpickers expand inline, and only one may be open at a time: opening a second closes the first, and switching tabs closes whatever was open rather than leaving it hanging on a hidden page. Opening one scrolls its column far enough to show it instead of leaving it clipped. Query with element.Opened.

Overlays

Z-order alone does not stop a toast from sitting on top of the menu, so the toast stack and the watermark are anchored to corners and kept apart:

Library:SetNotifyCorner("BottomRight")   -- TopLeft | TopRight | BottomLeft | BottomRight
Library:SetWatermarkCorner("TopLeft")
Library.MaxNotifications = 5
Text is the other way UI overlaps UI: a label that outgrows its box renders straight over its neighbour. Every single-line control truncates at the end, and every text object gets explicit vertical centring rather than inheriting a default that varies by client version.

Icons

Pass an icon name as the second argument to Tab. Click any icon below to copy its name.

local farm   = Window:Tab("Farm", "farm")
local combat = Window:Tab("Combat", "combat")
local misc   = Window:Tab("Misc", "gear")
local plain  = Window:Tab("Whatever", nil)      -- no icon

-- the table form still works
Window:Tab({ Name = "Farm", Icon = "farm" })

nil, an omitted argument, or a name that does not exist all render a plain text tab — a typo will never break a menu.

Why these are vectors

A thousand-icon set means uploaded rbxassetid images and a second HTTP fetch on every execution. These are drawn instead from five primitives — line, dot, circle, filled rect, box — in a 0–100 coordinate box, so they cost nothing but the few bytes of their definition, tint with the theme like any other frame, and stay crisp at any size. The trade is fidelity: line art, not detailed glyphs.

The gallery below is generated from Library.Icons at build time and rendered to SVG with the same five primitives the Roblox side draws with. What you see here is what the menu draws.

Custom and image icons

-- an uploaded asset, if you want a real image
Window:Tab("Shop", "rbxassetid://1234567")

-- or add your own vector to the set
Library.Icons.myicon = "L20 20 80 80|O50 50 30"
Window:Tab("Mine", "myicon")

-- render one anywhere
Library:RenderIcon(someFrame, "skull", { Size = 24, ColorKey = "Danger" })
OpArgumentsDraws
Lx1 y1 x2 y2line with rounded caps
Dcx cy rfilled dot
Ocx cy rcircle outline
Fx y w hfilled rect
Bx y w hbox outline

Each primitive is one Instance, so an icon costs between one and ten depending on its complexity.

The set

Layout

Tabs across the top by default, with content columns that respond to the window width. Everything is positioned in whole-pixel offsets rather than scale.

Library:CreateWindow({
    Layout  = "topbar",   -- topbar | sidebar
    Columns = "auto",     -- 1-3 by width, or force a number
})

Window:SetLayout("sidebar")   -- both switch live
Window:SetColumns(2)

Responsive columns

Sections are not pinned to a column. They flow into whichever is shortest, and the column count follows the content width, so a narrow window collapses instead of squeezing three columns into nothing.

Content widthColumns
under 520px1
520 – 840px2
840px and up3

An explicit Side = "Left" or "Right" is honoured when there are exactly two columns, and ignored otherwise — there is no sensible left or right in a one or three column grid.

Whole-pixel geometry

Columns are sized in integer offsets computed from the window width, with the remainder absorbed by the last column so they tile the content area exactly. A scale-based split (0.5, 0.333) lands on fractional pixels the moment the width is not divisible by the column count, and fractional pixels are what makes text look soft. The same applies to the header, tab strip and rules: all offsets, all recomputed on resize.

Window:ApplyLayout() recomputes every piece of chrome from the current window size. It runs at build time, whenever a tab or section is added, and on every resize frame, so adding controls at runtime places them immediately.

Resizing, and why the corners were wrong

Drag any edge or any corner. There are eight grab zones sitting on the border, half in and half out, plus a grip at the bottom right that is itself a handle, not a picture of one. Width always lands on an even number so the content columns stay on whole pixels.

Library:CreateWindow({
    Resizable = true,     -- default
    MinWidth  = 460,
    MinHeight = 320,
})

Dragging a north or west edge moves the window origin as it shrinks, so the opposite corner stays put instead of walking across the screen.

The corner problem

The old build had rounded corners that looked broken, and it was structural rather than cosmetic:

So the layout was rebuilt rather than re-tuned:

Tab buttons are filled pills rather than an edge rail for the same reason — a rail pinned at x=0 inside the rounded sidebar panel would run into that panel's own corner on the first and last tab.

Elements

Every element is created on a Section, takes a Flag to register itself under Library.Options, and returns an object with .Value, :SetValue(v, silent), :GetValue() and :OnChanged(fn).

ElementValue typeOptions
:Button—Text, Callback
:TogglebooleanFlag, Text, Default, Callback
:SlidernumberMin, Max, Default, Decimals, Suffix
:Dropdownany / setValues, Default, Multi. Also :SetValues(list, keep)
:InputstringPlaceholder, Default, Numeric, Finished
:KeybindcomboDefault, Mode. Also :GetState(), :GetKeyString()
:ColorpickerColor3Default
:Label—Text, Muted, Mono, Wrap. Also :SetText(s)
:Divider——

Dropdowns

With Multi = true the value is a set, not a list, so membership is a direct lookup:

Section:Dropdown({
    Flag = "parts", Text = "ESP parts",
    Values = { "Box", "Name", "Tracer" },
    Default = { "Box", "Name" },
    Multi = true,
})

if Library.Options.parts.Value.Box then -- draw the box end

Lists expand inline and the section grows around them, so there is nothing to clip and no overlay to mis-position. Rows are built the first time a list is opened, not at load.

Performance

No idle work

Nothing runs per frame unless a watermark exists, and that is one Heartbeat accumulator writing text twice a second. Dragging and sliders only do work while an input is held.

One input connection

The hide key and every keybind share a single InputBegan handler rather than one connection per element.

Layout, not maths

Sizing is UIListLayout and AutomaticSize, so the engine reflows in C++ instead of Luau recomputing positions.

Hidden by default

Parents to gethui() where available so the game cannot enumerate the GUI, falling back to CoreGui, then PlayerGui. Services are cloneref'd when the executor provides it.

Vendor it for anything you ship. Loading a library straight from someone else's host means they can change what your users execute, at any time, without you knowing. That applies to this URL exactly as much as anyone else's. The readable source is at /nm-lib.lua — read it, paste it into your script, load your own copy.

Full example

Every element, combos, custom watermark segments, live theming, config saving and the reload guard. Run it twice to watch the window get replaced rather than duplicated.

loadstring(game:HttpGet("https://nm.nitaimaarek.com/example.lua"))()
--[[=========================================================================
    nm-lib -- full feature demo
    docs: https://nm.nitaimaarek.com

    Execute this twice. The second run replaces the first: no duplicate
    window, no leftover connections, and with PreserveState your toggles
    stay where you left them.
=========================================================================]]

local Library = loadstring(game:HttpGet("https://nm.nitaimaarek.com/lib"))()

local Window = Library:CreateWindow({
    Title = "nm hub",
    Subtitle = "demo build",
    Size = UDim2.fromOffset(620, 450),
    ToggleKey = "Ctrl+H", -- combos work here; set in code, never in the UI
    Preset = "onyx", -- onyx | ice | midnight | carbon | comic | bubblegum | chalkboard
    PreserveState = true, -- keep values across re-executions

    Layout = "topbar", -- topbar | sidebar
    Columns = "auto", -- "auto" (1/2/3 by width) or a fixed 1-3

    -- drag any edge or corner; the grip sits bottom-right
    Resizable = true,
    MinWidth = 420,
    MinHeight = 300,
})

--=========================================================================
-- Watermark: every segment is yours to define
--=========================================================================

local watermark = Library:Watermark({ Separator = "  |  " })

watermark:AddSegment("title", "nm hub", 1)
watermark:AddSegment("fps", Library.Counters.fps, 2)
watermark:AddSegment("ping", Library.Counters.ping, 3)

-- ...and anything you want to count yourself
local kills = 0
watermark:AddSegment("kills", function()
    return kills .. " kills"
end, 4)

--=========================================================================
-- Main
--=========================================================================

local Main = Window:Tab("Main", "home")

-- Both forms work everywhere. Use the table when you want every knob, the
-- short form when you do not.
local Combat = Main:Section("Combat", "Left")

Combat:Toggle({
    Flag = "aimbot",
    Text = "Aimbot",
    Default = false,
    Callback = function(value)
        Library:Notify({
            Title = "Aimbot",
            Text = value and "enabled" or "disabled",
            Type = value and "success" or "info",
            Duration = 2,
        })
    end,
})

Combat:Keybind({
    Flag = "aimkey",
    Text = "Aim key",
    Default = Enum.UserInputType.MouseButton2,
    Mode = "Hold", -- Hold / Toggle / Always, right-click the pill to cycle
})

Combat:Keybind({
    Flag = "panic",
    Text = "Panic",
    Default = "Ctrl+Shift+P", -- modifier combos
    Mode = "Toggle",
    Callback = function(state)
        if state then
            Library:Notify({ Title = "Panic", Text = "everything off", Type = "error" })
        end
    end,
})

Combat:Slider({
    Flag = "fov",
    Text = "FOV",
    Min = 10,
    Max = 500,
    Default = 120,
    Decimals = 0,
    Suffix = "px",
})

Combat:Dropdown({
    Flag = "hitpart",
    Text = "Hit part",
    Values = { "Head", "HumanoidRootPart", "UpperTorso" },
    Default = "Head",
})

Combat:Divider()

Combat:Button({
    Text = "Notify me",
    Callback = function()
        kills = kills + 1
        Library:Notify({
            Title = "nm-lib",
            Text = "Buttons fire callbacks. Click a toast to dismiss it early.",
            Duration = 4,
        })
    end,
})

local Player = Main:Section({ Name = "Player", Side = "Right" })

Player:Slider({
    Flag = "walkspeed",
    Text = "WalkSpeed",
    Min = 16,
    Max = 250,
    Default = 16,
    Callback = function(value)
        local character = game.Players.LocalPlayer.Character
        local humanoid = character and character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.WalkSpeed = value
        end
    end,
})

Player:Toggle({ Flag = "infjump", Text = "Infinite jump", Default = false })

-- Library:Connect registers the connection, so reloading kills it for you.
Library:Connect(game:GetService("UserInputService").JumpRequest, function()
    if Library.Options.infjump.Value then
        local character = game.Players.LocalPlayer.Character
        local humanoid = character and character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
        end
    end
end)

Player:Input({
    Flag = "target",
    Text = "Target player",
    Placeholder = "username",
    Finished = true, -- only fire on Enter
})

--=========================================================================
-- Visuals
--=========================================================================

local Visuals = Window:Tab("Visuals", "eye")

local Esp = Visuals:Section({ Name = "ESP", Side = "Left" })

Esp:Toggle({ Flag = "esp", Text = "Enabled", Default = false })

Esp:Dropdown({
    Flag = "espparts",
    Text = "Parts",
    Values = { "Box", "Name", "Health", "Distance", "Tracer" },
    Default = { "Box", "Name" },
    Multi = true, -- Value is a set: { Box = true, Name = true }
})

Esp:Colorpicker({
    Flag = "espcolor",
    Text = "Colour",
    Default = Color3.fromRGB(96, 178, 235),
})

Esp:Slider({
    Flag = "esprange",
    Text = "Max distance",
    Min = 50,
    Max = 2000,
    Default = 500,
    Suffix = "m",
})

local Look = Visuals:Section({ Name = "Appearance", Side = "Right" })

Look:Dropdown({
    Flag = "preset",
    Text = "Preset",
    Values = { "onyx", "ice", "midnight", "carbon", "comic", "bubblegum", "chalkboard" },
    Default = "onyx",
    Callback = function(name)
        Library:UsePreset(name)
    end,
})

Look:Dropdown({
    Flag = "font",
    Text = "Font",
    Values = { "Roboto", "Ubuntu", "Nunito", "RobotoCondensed", "ComicNeueAngular" },
    Default = "Roboto",
    Callback = function(family)
        Library:SetFont(family)
    end,
})

Look:Colorpicker({
    Flag = "accent",
    Text = "Accent",
    Default = Color3.fromRGB(235, 236, 240),
    Callback = function(color)
        Library:SetTheme({ Accent = color })
    end,
})

Look:Toggle({
    Flag = "animations",
    Text = "Animations",
    Default = true,
    Callback = function(value)
        Library.Animations = value
    end,
})

Look:Dropdown({
    Flag = "layout",
    Text = "Layout",
    Values = { "topbar", "sidebar" },
    Default = "topbar",
    Callback = function(mode)
        Window:SetLayout(mode)
    end,
})

Look:Dropdown({
    Flag = "columns",
    Text = "Columns",
    Values = { "auto", "1", "2", "3" },
    Default = "auto",
    Callback = function(value)
        Window:SetColumns(tonumber(value) or "auto")
    end,
})

Look:Toggle({
    Flag = "watermark",
    Text = "Watermark",
    Default = true,
    Callback = function(value)
        watermark:SetVisible(value)
    end,
})

--=========================================================================
-- Farm  --  the second argument is the icon; nil or omitted means none
--=========================================================================

local Farm = Window:Tab("Farm", "farm")
local Auto = Farm:Section("Auto")

-- Short form: text, then values, then an optional callback. The flag is
-- derived from the text, so this is still Library.Options.autofarm.
Auto:Toggle("Auto farm", false, function(on)
    print("farming:", on)
end)
Auto:Dropdown("Mode", { "Closest", "Highest value", "Safest" }, "Closest")
Auto:Slider("Delay", 0, 5, 0.5)
Auto:Button("Collect now", function()
    Library:Notify("collecting")
end)

local Combat = Window:Tab("Combat", "combat")
Combat:Section("Targeting"):Toggle("Auto attack")

local Whatever = Window:Tab("Whatever", nil) -- no icon
Whatever:Section("Notes"):Label("Tabs work fine without an icon.")

--=========================================================================
-- Settings
--=========================================================================

local Settings = Window:Tab("Settings", "gear")
local Config = Settings:Section({ Name = "Config", Side = "Left" })

Config:Input({ Flag = "configname", Text = "Config name", Default = "default" })

Config:Button({
    Text = "Save",
    Callback = function()
        local ok, err = Library:SaveConfig(Library.Options.configname.Value)
        Library:Notify({
            Title = "Config",
            Text = ok and "saved" or ("failed: " .. tostring(err)),
            Type = ok and "success" or "error",
        })
    end,
})

Config:Button({
    Text = "Load",
    Callback = function()
        local ok, err = Library:LoadConfig(Library.Options.configname.Value)
        Library:Notify({
            Title = "Config",
            Text = ok and "loaded" or ("failed: " .. tostring(err)),
            Type = ok and "success" or "error",
        })
    end,
})

local About = Settings:Section({ Name = "About", Side = "Right" })

About:Label({ Text = "Hide the menu with Ctrl+H (set in code)." })
About:Label({ Text = "executor support:", Muted = true, Mono = true })

for feature, supported in pairs(Library.Compat) do
    About:Label({ Text = (supported and "+ " or "- ") .. feature, Muted = not supported, Mono = true })
end

About:Divider()

About:Button({
    Text = "Unload",
    Callback = function()
        Library:Unload()
    end,
})

-- Anything the library did not create is your responsibility. Register it and
-- reloading cleans it up automatically.
Library:OnUnload(function()
    print("[nm-lib] demo unloaded")
end)

--=========================================================================
-- A second, smaller window. Independent position, size, layout, scale and
-- hide key; it shares the notification stack and the watermark.
--=========================================================================

local Mini = Library:CreateWindow({
    Title = "quick",
    Size = UDim2.fromOffset(300, 230),
    Position = UDim2.fromOffset(30, 90),
    Layout = "sidebar",
    Columns = 1,
    MinWidth = 260,
    MinHeight = 180,
    ToggleKey = "Ctrl+J",
})

local Quick = Mini:Tab("Quick", "lightning")
local Actions = Quick:Section("Actions")

Actions:Button("Rejoin", function()
    Library:Notify({ Title = "quick", Text = "rejoining", Type = "warn" })
end)
Actions:Toggle("Noclip", false)
Actions:Slider("FOV", 70, 120, 90)

-- overlays can be moved out of the way of either window
Library:SetNotifyCorner("BottomRight")
Library:SetWatermarkCorner("TopLeft")

Library:Notify({
    Title = "nm hub",
    Text = "Loaded. Ctrl+H for the main menu, Ctrl+J for quick.",
    Type = "success",
})