Repository navigation
sliders
Float and integer sliders with icon prefixes, grid-column widths, right-click reset, and time-of-day formatting.
local wu = GetMod("WindowUtils")
local c = wu.Controls
-- Float slider with icon, right-click reset, tooltip
local brightness, changed = c.SliderFloat(
IconGlyphs.Brightness6, "brightness", settings.brightness,
0.1, 10.0, { format = "%.1f", default = 1.0, tooltip = "Brightness" }
)
-- Time-of-day slider (seconds since midnight)
local tod, changed = c.TimeSlider(
IconGlyphs.ClockOutline, "gameTime", settings.timeOfDay,
{ default = 43200, tooltip = "Game time" }
)Float slider with optional icon prefix, column width, right-click reset, and tooltip.
| Parameter | Type | Default | Description |
|---|---|---|---|
| icon | string|nil | - | IconGlyph (nil = no icon) |
| id | string | - | Unique slider ID |
| value | number | - | Current value |
| min | number | - | Minimum |
| max | number | - | Maximum |
| opts.format | string | "%.2f" | Display format |
| opts.cols | number|nil | nil | Grid columns (nil = fill remaining) |
| opts.default | number|nil | nil | Right-click reset value |
| opts.tooltip | string|nil | nil | Icon tooltip |
| opts.alwaysShowTooltip | boolean | true | Show the icon tooltip even when tooltips are disabled globally. Set false to respect the global setting |
| opts.elementId | string|nil | nil | Tutorial/bounds target ID |
The tooltip attaches to the icon, so opts.tooltip does nothing when icon is nil.
Returns: number, boolean - new value, whether changed
local brightness, changed = c.SliderFloat(
IconGlyphs.Reload, "brightness", settings.brightness,
0.1, 10.0, { format = "%.1f", default = 1.0, tooltip = "Brightness" }
)Same as SliderFloat but for integers. Default format: "%d".
Greyed-out non-interactive slider placeholder. Returns nothing.
label is passed to ImGui as the widget label, so it renders as visible text to the right of the track. Prefix it with ## to hide it. The value, min, and max are hard-coded to 0, so this is purely a visual placeholder and cannot show a value.
Time-of-day slider. Value is seconds since midnight (0-86399). Displays as "h:MM AM/PM". Drag adjusts in minute increments. Double-click to type a time string.
| Parameter | Type | Default | Description |
|---|---|---|---|
| icon | string|nil | - | IconGlyph (nil = no icon) |
| id | string | - | Unique slider ID |
| value | number | - | Seconds since midnight (0-86399) |
| opts.cols | number|nil | nil | Grid columns (nil = fill remaining) |
| opts.default | number|nil | nil | Right-click reset value (seconds) |
| opts.tooltip | string|nil | nil | Icon tooltip |
| opts.alwaysShowTooltip | boolean | true | Show the icon tooltip even when tooltips are disabled globally |
| opts.elementId | string|nil | nil | Tutorial/bounds target ID |
Returns: number, boolean - new value in seconds, whether changed
Text input accepts: "1:45 PM", "1:45pm", "13:45", "1345", "945", "9:45". Raw seconds are not accepted: bare digit strings of three or more characters are read as HHMM, so "43200" parses as hour 432 and is rejected. Unparseable input leaves the value unchanged.
A single-letter suffix ("1:45p") parses but the AM/PM shift is not applied, so it lands on 1:45 AM. Type the full "pm".
Escape or clicking away cancels text entry. Enter commits.
local tod, changed = c.TimeSlider(
IconGlyphs.ClockOutline, "gameTime", settings.timeOfDay,
{ default = 43200, tooltip = "Game time" }
)Also available as type = "time" in DragFloatRow/DragIntRow entries (see drags).