Skip to content

lettuce-magician/Stir

Repository files navigation

Stir

A collection of Fusion States and Utilities that improve the developer experience.


Code Snippets

Components

local Button = Component({Text="string", Activated="function"}, function(Props)
    return New "TextButton" {
        [OnEvent "Activated"] = Props.Activated
    }
end)

local Test = Button {
    Text = "Hello World!",
    Activated = function()
        print("Clicked!")
    end
}

print(Test.Text) --> Hello World!

Reactive Statements

local State = Value(false)
local CheckBox = New "ImageButton" {
    [If(State)] = { -- Updates whenver the value `State` changes.
        Text = "Activated",
        [Else] = { -- If the state value is false
            Text = "Deactivated"
        }
    },
    [OnEvent "Activated"] = function()
        State:set(not State:get())
    end
}

Child Hydration

local Frame = New "Frame" {
	[Children] = {
		New "UIStroke" {}
	}
}

print(Frame.UIStroke.Color) --> 0, 0, 0

Hydrate (Frame) {
	[Child "UIStroke"] = {
		Color = Color3.new(1,1,1)
	}
}

print(Frame.UIStroke.Color) --> 1, 1, 1

Notices

  • Pull Requests and Issues are welcome! I read all of them.