-
Notifications
You must be signed in to change notification settings - Fork 0
Functional Components
Jamie Nichols edited this page Jan 24, 2022
·
2 revisions
A component is a function that returns an Array of Elements. That's All. Here is an example of the most basic of components
--[[ src/App.lua ]]--
local div = require "beastcraft".ui.div
local monitor = require "beastcraft".utils.monitor
local App = function()
local WIDTH,HEIGHT = monitor.getSize()
return div({
style = {
top=1,
left=1,
width = WIDTH,
height = HEIGHT,
backgroundColor = colors.blue
}
})
end
return App
Beastcraft has a handful of basic essential libraries for creating elements and helpful tools A list of attributes and methods exposed by the beastcraft require can be found <HERE(link to Beastcraft returns)>
Libraries
Elements
DivButton
Input
State
useStateuseRef
useReducer
createContext
useContext
Utils
monitorswitch
Elements
mapfilter