Provides reusable button UI components for monitor-based interfaces. Used by server NFC monitor, ShopK access, and other monitor-based UIs.
View on GitHub →monitor_buttons.create(monitor)Create a new button manager for a monitor
monitor (table): - the monitor peripheralmanager.clear(bgColor)Clear the monitor
bgColor (number): - optional background colormanager.centerText(y, text, color)Center text on the monitor
y (number): - line numbertext (string): - text to displaycolor (number): - optional text colormanager.drawText(x, y, text, color)Draw text at position
x (number): - X positiony (number): - Y positiontext (string): - text to displaycolor (number): - optional text colormanager.drawLine(y, char, color)Draw a horizontal line
y (number): - line numberchar (string): - optional character to use (default "-")color (number): - optional colormanager.drawHeader(y, text, bgColor, textColor)Draw a header bar
y (number): - line numbertext (string): - header textbgColor (number): - optional background colortextColor (number): - optional text colormanager.drawButton(x, y, width, height, text, action, bgColor, textColor)Draw a button and register it
x (number): - X positiony (number): - Y positionwidth (number): - button widthheight (number): - button height (default 3)text (string): - button textaction (string): - action identifier returned when pressedbgColor (number): - optional background colortextColor (number): - optional text colormanager.addButton(x, y, width, text, action, bgColor, textColor)Draw a simple 3-row button (convenience method)
x (number): - X positiony (number): - Y positionwidth (number): - button widthtext (string): - button textaction (string): - action identifierbgColor (number): - optional background colortextColor (number): - optional text colormanager.isTouchInButton(x, y, button)Check if a touch is within button bounds
x (number): - touch Xy (number): - touch Ybutton (table): - button with boundsmanager.setCallback(callback)Set callback for button presses
callback (function): - called with (action) when button pressedmanager.setTimeout(seconds, callback)Set a timeout for the current screen
seconds (number): - timeout in secondscallback (function): - called when timeout occurs (optional, uses activeCallback with nil)manager.handleTouch(x, y)Handle a touch event
x (number): - touch Xy (number): - touch Ymanager.handleTimer(timerID)Handle a timer event
timerID (number): - the timer that firedmanager.showCountdown(y, prefix, seconds)Show a countdown timer on the monitor
y (number): - line to show countdown onprefix (string): - text before countdownseconds (number): - starting secondsmanager.showSuccess(title, message, details)Show a success screen
title (string): - success titlemessage (string): - success messagedetails (table): - optional key-value pairs to displaymanager.showError(title, message)Show an error screen
title (string): - error titlemessage (string): - error message