Components
Modal Form

Client Side Use

local formResponse = exports["bs-uicore"]:showModalForm({
  title = "Example title",
  fields = {
    { key = 'vehicleName', type = 'text', label = 'Vehicle name', description = 'Enter the name of your vehicle', placeholder = 'Enter name' },
    { key = 'vehiclePrice', type = 'number', label = 'Vehicle price', description = 'Enter the amount you want to list your vehicle for', placeholder = 'Enter price' }
  }
})
print("form response", formResponse)

Server Side Use

local formResponse = lib.callback.await('bs-uicore:client:callback:showModalForm', source, {
  title = "Example title",
  fields = {
    { key = 'vehicleName', type = 'text', label = 'Vehicle name', description = 'Enter the name of your vehicle', placeholder = 'Enter name' },
    { key = 'vehiclePrice', type = 'number', label = 'Vehicle price', description = 'Enter the amount you want to list your vehicle for', placeholder = 'Enter price' }
  }
})
print("form response", formResponse)

Parameters

  • title (string) — Dialog title.
  • fields (array)
    • key (string) — Unique identifier for the field. Used as the key in the returned fields object.
    • type (string) — Field type. Supported values: text, number, checkbox, select, textarea.
    • label (string) — Field label.
    • description (string, optional) — Helper text or description shown under the label.
    • placeholder (string, optional) — Placeholder text for text, number, and textarea types.
    • options (table, required for select) — Array of options for select fields; each option is a table: { label = '...', value = '...' }.

Returns

  • Returns a table (or nil) representing the user's response. Typical shape:
{
  id = <string|number|nil>, -- optional dialog/response id
  fields = {
    <key> = <value>, -- field key mapped to the submitted value
    -- examples: vehicleName = 'My car', vehiclePrice = 15000, vehicleNegotiable = true
  }
}