mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
27 lines
643 B
Lua
27 lines
643 B
Lua
-- Number field component
|
|
|
|
---@class UIComponent
|
|
---@field type string
|
|
---@field props? table
|
|
---@field children? UIComponent[]
|
|
|
|
---@class NumberFieldProps
|
|
---@field name string
|
|
---@field label? string
|
|
---@field min? number
|
|
---@field max? number
|
|
|
|
---@param props NumberFieldProps
|
|
---@return UIComponent
|
|
local function number(props)
|
|
return {
|
|
type = "Box",
|
|
children = {
|
|
props.label and { type = "Label", props = { text = props.label, htmlFor = props.name } } or nil,
|
|
{ type = "Input", props = { name = props.name, type = "number", min = props.min, max = props.max } }
|
|
}
|
|
}
|
|
end
|
|
|
|
return number
|