vide/docs/tut/crash-course/2-creation.md
alicesaidhi f8e84f9f8d
Improve Documentation Site (#41)
* update css and snippets

* Add banner

* improve home page

* Update Banner

* cleanup

* Update font to JetBrains Mono

* Add a quick look to Home

* Simplify Home Page

* Removed banner, removed copyright notice, reduced home page
2024-11-03 17:32:19 +00:00

843 B

Creating UI

Instances are created using create().

Parentheses () can be omitted when calling functions with string or table literals for brevity.

local create = vide.create

return create "ScreenGui" {
    create "Frame" {
        AnchorPoint = Vector2.new(0.5, 0.5),
        Position = UDim2.fromScale(0.5, 0.5),
        Size = UDim2.fromScale(0.4, 0.7),

        create "TextLabel" {
            Text = "hi"
        },

        create "TextLabel" {
            Text = "bye"
        },

        create "TextButton" {
            Text = "click me",

            Activated = function()
                print "clicked!"
            end
        }
    }
}

Assign a value to a string key to set a property, and assign a value to a number key to set a child. Events can be connected to by assigning a function to a string key.