Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Firere/roact

This branch is 16 commits ahead of, 1 commit behind Roblox/roact:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

60b8659 · Apr 4, 2023
Jan 10, 2023
Sep 25, 2021
Jan 11, 2023
Jan 12, 2023
Sep 25, 2021
Sep 16, 2021
Jan 11, 2023
May 3, 2019
Sep 25, 2021
Mar 13, 2018
May 3, 2019
Jun 10, 2022
Jan 11, 2023
Jan 11, 2023
May 3, 2019
Jan 11, 2023
Aug 12, 2019
May 3, 2019
Jun 10, 2022
Jan 12, 2023
Sep 16, 2021
Jan 11, 2023
Sep 25, 2021
Jun 10, 2022
Sep 25, 2021
Jan 11, 2023

Repository files navigation

Roact

An extension of [Roblox's Roact](https://github.com/Roblox/roact)
 

Installation

Method 1: Filesystem

  • Copy the src directory into your codebase
  • Rename the folder to Roact
  • Use a plugin like Rojo to sync the files into a place

Method 2: Wally

  • Add Wally to your project
  • Add firere/roact to your dependencies in wally.toml

What's the difference?

  • Whenever a prop is passed into a host component which is not a valid property of the target Roblox class, it does not error and simply skips over trying to apply it
  • Whenever children are passed in both the Roact.Children key of props and in the children arguments of createElement, it will automatically merge them both
    • If 2 keys with the same name are found in both arguments, the children argument will replace the one in props; this can be configured

For a detailed guide and examples, check out the documentation.

local LocalPlayer = game:GetService("Players").LocalPlayer

local Roact = require(Roact)

-- Create our virtual tree describing a full-screen text label.
local tree = Roact.createElement("ScreenGui", {
	[Roact.Children] = {
		Image = Roact.createElement("ImageLabel", {
			InvalidProp = "InvalidProp is not a valid property on the ImageLabel class" -- This does not produce an error.
		})
	}
}, {
	Label = Roact.createElement("TextLabel", { -- Both Image and Label will be children of tree.
		Text = "Hello, world!",
		Size = UDim2.new(1, 0, 1, 0),
	}),
})

-- Turn our virtual tree into real instances and put them in PlayerGui
Roact.mount(tree, LocalPlayer.PlayerGui, "HelloWorld")

License

Roact is available under the Apache 2.0 license. See LICENSE.txt for details.

Packages

No packages published

Languages

  • Lua 99.8%
  • Shell 0.2%