Forest Logo
search
package_2

roact

By @firere

Roblox

Mirrored

Roact

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

Installation

Method 1: Filesystem

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

Documentation

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.

Package Details

Install command (Click to copy)


Version

1.5.0

License

Apache-2.0

check_circle

Safe for commercial use

infoModified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved.

Automated license review — not legal advice.