UI library
Build reusable frames, textboxes, buttons and interactive controls.
Layout and appearance
| Property | Type | Description |
|---|---|---|
| Parent | DrawingControl? | Parent control; positions are relative to its top-left corner. Cycles are rejected. |
| Position / Size | Vector2 | Position and dimensions in pixels. |
| AbsolutePosition / AbsoluteSize | Vector2 | Calculated client-space bounds after a UI update. |
| Visible / Active | boolean | Visibility and pointer interaction. |
| ZIndex | number | Relative draw layer, combined with ancestor layers. |
| BackgroundColor3 | Color3 | Background fill color. |
| BackgroundTransparency | number | 0 is opaque; 1 is transparent, unlike primitive Transparency. |
| Draggable | boolean | Allow dragging this control with the left mouse button. |
| ClipsDescendants | boolean | Clip descendants to this control’s rectangle. |
| CanvasSize / ScrollOffset | number | ScrollingFrame content height and vertical scroll offset. |
Text and values
| Property | Type | Description |
|---|---|---|
| Text | string | UTF-8 text, limited to 65536 bytes. |
| TextColor3 / PlaceholderColor3 | Color3 | Normal text and placeholder colors. |
| TextSize / Font / Padding | number | Font size, Drawing.Fonts identifier and horizontal padding. |
| PlaceholderText | string | Shown when an unfocused textbox is empty. |
| TextEditable / ClearTextOnFocus | boolean | Allow editing, or clear contents when focus is acquired. |
| Multiline | boolean | Enter inserts a newline; Ctrl+Enter submits. |
| MaxLength | number | Maximum UTF-8 byte length. |
| Cursor / Anchor | number | Zero-based UTF-8 byte offsets defining the caret and selection. |
| Value | boolean | number | Checkbox state or slider value. |
| Min / Max | number | Slider range. |
| Image | string | Encoded image bytes for ImageLabel. |
Control events
| Event | Arguments | Description |
|---|---|---|
| Focused | () | Textbox acquired keyboard focus. |
| FocusLost | submitted: boolean | Textbox lost focus; true indicates submission. |
| TextChanged | text: string | Textbox contents changed. |
| Changed | property: string | A property changed. |
| InputBegan | key: string, control: boolean, shift: boolean | Key received by the focused textbox. |
| MouseButton1Click | () | Press and release completed inside the control. |
| MouseButton1Down / MouseButton1Up | () | Left mouse press or release. |
Available functions
ButtonAn alias-style control kind with TextButton behavior.CheckboxA toggle control.FrameA rectangular container for retained controls.ImageLabelDisplays an image.ScrollingFrameA container with vertical scrolling.SliderA numeric slider control.TextBoxAn editable text control.TextButtonA clickable text control.TextLabelDisplays text.Control:CaptureFocusFocuses a textbox.Control:DestroyDestroys a control and its children.Control:GetChildrenLists a control's direct children.Control:GetPropertyChangedSignalObserves changes to a control property.Control:GetSelectionReads the selected text.Control:InsertTextInserts text at the current selection.Control:IsFocusedChecks whether a textbox has focus.Control:ReleaseFocusReleases textbox focus.Control:SelectAllSelects all text.Drawing.createCreates a retained UI control.Drawing.destroyuiDestroys all controls in a UI context.Drawing.getfocusedtextboxFinds the focused textbox.Drawing.getpointerReads the UI context's last pointer position.Drawing.isuiChecks whether a retained control is live.Drawing.newcontextCreates a separate retained UI context.Drawing.stepUpdates retained UI input, layout, and rendering.