Skip to content

Search documentation

Enter at least two characters.

    CodeEditor

    SDK 0.1.0-preview.2 · ExperimentalDownload & release notes ↗

    An experimental code-editing control. Styling and host admission have their own limits; do not assume the complete planned editor is available.

    Advanced app/host integration API. Useful for lower-level work; ordinary app authors can start with the app-building path. This is public API, not permission to access private toolkit objects.

    Create: Instance.new("CodeEditor", {...}). Inherits: TextBox.

    Parent and children: Use Window, Frame or ScrollingFrame as the Parent. It does not accept visual child content.

    Experimental editor. This demonstrates plain editing, not syntax highlighting or execution of the typed code.

    Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.

    local Window = Instance.new("Window", {
    Title = "LUI example", Size = UDim2.fromOffset(560, 280),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170),
    Size = UDim2.new(1, -32, 0, 72),
    })
    local Editor = Instance.new("CodeEditor", {
    Parent = Window, Text = 'print("Hello")', Size = UDim2.fromOffset(520, 130),
    Position = UDim2.fromOffset(16, 16),
    })
    Editor.TextChanged:Connect(function()
    Status.Text = "Text revision: " .. Editor.TextRevision
    end)
    local Styled = Editor:SetStyles(Editor.TextRevision, {{Start = 0, End = 5, Color = 0x3366CC}})
    assert(Styled == false) -- Public styling is not admitted in this SDK.
    Window.Visible = true

    Expected result: A plain multiline editor appears. Editing advances TextRevision. The example deliberately shows the current refusal of public styling.

    • Plain multiline editing is available, but SetStyles returns false in this SDK. Do not build a syntax-highlighting requirement on the reflected signature.
    • Its text limit is 262,144 UTF-8 bytes. TextBox has the smaller 65,534-byte limit. Physical input-method and accessibility qualification remains platform-specific.

    Always true for CodeEditor; it cannot be reassigned.

    Type: boolean. Default: true; immutable. Read-only.

    Always false for CodeEditor. Use TextBox for secret entry.

    Type: boolean. Default: false; immutable. Read-only.

    Scalar limit within the editor’s 262,144-byte UTF-8 ceiling. The larger limit does not remove execution or memory quotas.

    Type: number. Default: 262144 Unicode scalars; UTF-8 byte ceiling also 262144. Read/write field.

    Revision number that advances when committed text changes. Use it to avoid applying work based on older text.

    Type: number. Default: 1; advances when committed text changes. Read-only.

    Accepts a text revision and zero-based scalar ranges with packed RGB colors. Public styling is currently refused with false in this SDK; use plain editing rather than assuming syntax highlighting works.

    SetStyles(ExpectedRevision: number, Ranges: {{Start: number, End: number, Color: number}}) -> boolean

    You can use these directly on CodeEditor. Follow a member link for its explanation and example.

    Text · Enabled · Multiline · Secret · PlaceholderText · MaxLength · SelectionStart · SelectionLength · IsComposing · CompositionText · TextChanged · SelectionChanged · CompositionStarted · CompositionChanged · CompositionEnded

    Visible · AccessibilityLabel · AccessibilityDescription · Size · Position · AnchorPoint · LayoutOrder · BackgroundColor3 · BackgroundTransparency · BorderColor3 · BorderSizePixel · CornerRadius · Opacity · TextColor3 · TextSize · FontFamily · FontWeight · TextWrapped · TextXAlignment · TextYAlignment · ZIndex · ClipsDescendants · IsFocused · AbsolutePosition · AbsoluteSize · Focus · Focused · FocusLost · MouseEnter · MouseLeave · InputBegan · InputChanged · InputEnded

    Name · Sensitive · EffectiveSensitive · Parent · ClassName · Destroy · Clone · GetChildren · GetDescendants · FindFirstChild · IsA · Changed · Destroying

    Full type declaration — for type checking and deeper reference

    The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.

    export type CodeEditor = TextBox & {
    read Multiline: boolean,
    read Secret: boolean,
    MaxLength: number,
    read TextRevision: number,
    read SetStyles: (Self: CodeEditor, ExpectedRevision: number, Ranges: {{Start: number, End: number, Color: number}}) -> boolean,
    }

    See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.