mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 06:44:58 +00:00
27 lines
671 B
Lua
27 lines
671 B
Lua
-- Textarea field component
|
|
|
|
---@class UIComponent
|
|
---@field type string
|
|
---@field props? table
|
|
---@field children? UIComponent[]
|
|
|
|
---@class TextareaFieldProps
|
|
---@field name string
|
|
---@field label? string
|
|
---@field rows? number
|
|
---@field placeholder? string
|
|
|
|
---@param props TextareaFieldProps
|
|
---@return UIComponent
|
|
local function textarea(props)
|
|
return {
|
|
type = "Box",
|
|
children = {
|
|
props.label and { type = "Label", props = { text = props.label, htmlFor = props.name } } or nil,
|
|
{ type = "TextArea", props = { name = props.name, rows = props.rows or 4, placeholder = props.placeholder } }
|
|
}
|
|
}
|
|
end
|
|
|
|
return textarea
|