Classes

Learn how to create classes for more theming possibilities.

Classes in Enoria work pretty much like CSS classes. They let you define properties and apply them to any element.

Classes are defined in a ModuleScript. Here's how it looks like, for defining a Title class:

ProjectPath.style.Classes.lua
local Classes = {
    Title = {
        BackgroundColor3 = Color3.fromRGB(255, 0, 0),
        TextTheme = {
            TextSize = 32,
            Font = Enum.Font.GothamSemibold
        }
    }
}

return Classes

Then, in your project main LocalScript, you have to tell Enoria that you want to use this ModuleScript for classes:

local Enoria = require(game.ReplicatedStorage.Common.Enoria.packages.Enoria.Enoria)
local CustomTheme = require(script.Parent.Parent.style.Theme)
local Classes = require(script.Parent.Parent.style.Classes)

local e = Enoria.new()
e.Context.Theme = CustomTheme
e.Context.Classes = Classes

e:RunApp({
	Name = script.Parent.Parent.Name,
	Home = e.TextLabel("Welcome to Enoria!", {
		Class = "Title" -- This is where you assign a class
	})
})

However, at the moment, there's no way to assign multiple classes.

Last updated