Skip to content

Form ​

The ue-form component is the primary schema-driven form wrapper in Modularous. It wraps Vuetify's v-form, renders inputs from a schema object, handles submission, validation, and optional right-side content panels.

Basic Usage ​

php
@php
  $schema = $this->createFormSchema([
    ['type' => 'text', 'name' => 'name', 'label' => 'Name'],
    ['type' => 'email', 'name' => 'email', 'label' => 'Email'],
  ]);
@endphp

<ue-form
  :model-value='@json($item)'
  :schema='@json($schema)'
  action-url="{{ route('module.store') }}"
  title="Create User"
/>

Props ​

PropTypeDefaultDescription
modelValueObjectrequiredThe form data model
schemaObjectrequiredInput schema — built with createFormSchema()
actionUrlString—Form submission endpoint
titleString|Object—Header title. Pass an object for advanced options (type, weight, color, etc.)
subtitleString—Subtitle shown below the title
noTitleBooleanfalseHide the title row
isEditingBooleanfalseSwitches form into edit mode (PUT vs POST)
asyncBooleantrueSubmit via axios; if false, submits the native HTML form
hasSubmitBooleanfalseRender a built-in submit button
buttonTextString—Label for the built-in submit button
hasDividerBooleanfalseShow a divider below the title row
fillHeightBooleanfalseStretch the form to fill available viewport height
scrollableBooleanfalseMake the input area scrollable (useful inside modals)
formClassString|Array''Extra CSS classes on the inner v-form
noDefaultFormPaddingBooleanfalseRemove the default pa-4 padding
noDefaultSurfaceBooleanfalseRemove the default bg-surface background
actionsArray|Object[]Action button definitions rendered by FormActions
actionsPositionString'top'Where actions render: title-right, title-center, top, middle, bottom, right-top, right-middle, right-bottom
rowAttributeObject{noGutters: false, class: 'py-4'}Props forwarded to the wrapping v-row around inputs
rightSlotWidthNumber|StringnullFixed width (px) of the right-side panel
rightSlotMinWidthNumber|String300Min width (px) of the right-side panel
rightSlotMaxWidthNumber|String600Max width (px) of the right-side panel
rightSlotGapNumber12Margin between the form and the right panel
clearOnSavedBooleanfalseReset form after a successful save
refreshOnSavedBooleanfalseReload the datatable after a successful save
noWaitSourceLoadingBooleanfalseRender inputs immediately without waiting for async source data

Slots ​

SlotScopeDescription
header.left{title, subtitle, model, schema, formItem}Replaces the left side of the title row
headerCenter—Extra content injected into the title row center
top{item, schema}Content above the input block
underside{isEditing, item, schema}Content below the input block
actions.prependactions scopePrepend content before action buttons
actions.appendactions scopeAppend content after action buttons
right-top—Content at the top of the right panel
right-middle—Content in the middle of the right panel
right-bottom—Content at the bottom of the right panel

Events ​

EventPayloadDescription
update:modelValueObjectEmitted on every input change
update:validBooleanEmitted when form validation state changes
inputinput event objectRaw input event from the form base
submittedresponse dataEmitted after a successful async submission
actionCompleteaction resultEmitted when a FormActions button completes

Example — Form Inside a Blade View ​

php
@php
  $schema = $this->createFormSchema([
    ['type' => 'text',   'name' => 'title',  'label' => 'Title',  'rules' => 'required'],
    ['type' => 'textarea','name' => 'body',  'label' => 'Body'],
    ['type' => 'select', 'name' => 'status', 'label' => 'Status',
      'items' => [
        ['value' => 'draft',     'label' => 'Draft'],
        ['value' => 'published', 'label' => 'Published'],
      ]
    ],
  ]);
@endphp

<ue-form
  :model-value='@json($post ?? [])'
  :schema='@json($schema)'
  action-url="{{ route('posts.store') }}"
  title="New Post"
  has-submit
  button-text="Save"
  is-editing="{{ isset($post) ? 'true' : 'false' }}"
/>

Schema Builder

The createFormSchema() helper (available inside Modularous controllers and views) normalises raw field arrays into the schema format ue-form expects. See Hydrates for the full list of supported input types.