Skip to content

Stepper Form ^0.9.2

The ue-stepper-form component provides multi-step forms with a built-in summary sidebar, step navigation, validation, and a final preview step. Each step behaves like a standard ue-form, with all schema-driven field types supported.

Architecture

The stepper is composed of five internal sub-components that work together:

ComponentRole
StepperHeaderStep indicator bar at the top
StepperContentMain form area (left column)
StepperSummarySummary sidebar (right column)
StepperPreviewFinal step preview with selectable cards
StepperFinalSummaryFinal summary card shown in the sidebar on the last step
┌──────────────── StepperHeader ────────────────┐
│  Step 1   Step 2   Step 3   Preview & Summary │
└───────────────────────────────────────────────┘
┌────────────────────────┐ ┌────────────────────┐
│                        │ │                    │
│   StepperContent       │ │  StepperSummary    │
│   (ue-form per step)   │ │  (per-step or      │
│                        │ │   final summary)   │
│   StepperPreview       │ │                    │
│   (on final step)      │ │  StepperFinalSummary│
│                        │ │  (on final step)   │
└────────────────────────┘ └────────────────────┘

Basic Usage

php
@php
  $forms = [
    [
      'title'        => 'Step 1 Title',
      'id'           => 'stepper-form-1',
      'previewTitle' => 'Custom preview card title',
      'schema'       => $this->createFormSchema([
        ['type' => 'text',  'name' => 'first_name'],
        ['type' => 'email', 'name' => 'email'],
      ]),
    ],
    [
      'title'  => 'Step 2 Title',
      'schema' => $this->createFormSchema([
        ['type' => 'text', 'name' => 'company'],
      ]),
    ],
  ];
@endphp

<ue-stepper-form
  :forms="@json($forms)"
  action-url="/api/submit"
  redirect-url="/dashboard"
/>

IMPORTANT

This component was introduced in [v0.9.2]

Props

PropTypeDefaultDescription
formsArray[]Array of form definitions. Each entry must have a title and schema. See Form Definition.
modelValueObject{}Initial model values, merged into each form's model on mount.
actionUrlStringEndpoint for the final form submission (POST or PUT if modelValue.id is set).
redirectUrlStringnullURL to navigate to after successful submission.
currentStepNumber1Step to start on.
previewArray[]Initial previewModel values (per-step preview data).
isEditingBooleanfalsePassed down to each ue-form to enable edit mode.
flexBreakpointStringnullBreakpoint at which the stepper switches to flex layout (sm | md | lg | xl | xxl).
cardsNotationString'models.1.pressReleasePackages'Dot-notation path to extract summary card data.
summaryNotationsArray|Object{}Notations that control what appears in the step summary sidebar.
previewNotationsArray|Object[]Notations that control the formatted preview cards on the final step.
finalFormTitleStringnullTitle shown above the selectable cards on the final preview step.
finalFormSubtitleStringnullSubtitle shown below finalFormTitle.
finalFormFieldsArray[]Defines selectable fields on the final step. See Final Form Fields.
protectInitialValueBooleanfalseWhen true, pre-selected items from modelValue are read-only on the final step.
validationScrollingDurationNumber1000Scroll animation duration (ms) when auto-scrolling to a validation error.
validationScrollingEasingString'easeInOutCubic'Easing function for validation scroll.
validationScrollingOffsetNumber0Pixel offset applied during validation scroll.
responseModalIconString'mdi-check-circle-outline'Icon shown in the success modal.
responseModalTitleString$t('Request Complete')Title shown in the success modal.
responseModalMessageString$t('Congratulations!...')Body text shown in the success modal.
responseModalButtonTextString'Ok'Button label in the success modal.
responseModalOptionsObject{}Extra props forwarded to the ue-modal success dialog.

Form Definition

Each element of the forms array is a plain object:

KeyTypeRequiredDescription
titleStringYesLabel shown in the step header and summary.
schemaArrayYesSchema produced by createFormSchema(...).
idStringNoHTML id for the step's form element.
previewTitleStringNoOverrides title for the summary preview card header.
summaryTitleStringNoOverrides title specifically for the sidebar summary.
summarySearchHaystackStringNo'model' (default) or 'schema' — where to resolve the summary title.
summarySearchInputStringNoInput name used to resolve a dynamic schema-based summary title.
fullWidthBooleanNoWhen true, the form takes full width and the summary sidebar is hidden.

Slots

summary-form-{n}

Replaces the default summary card for step n (1-based). Receives a scoped object:

html
<template #summary-form-1="{ title, model, schema, previewModel, index, order, length }">
  <div>Custom summary for step 1</div>
</template>
BindingDescription
indexZero-based step index
orderOne-based step number
titleResolved preview title for this step
modelForm model for this step
schemaForm schema for this step
previewModelPreview model for this step
isPreviewModelFilledFunction: (index) => Boolean
lengthTotal number of steps

summary.final

Replaces the entire final-step summary panel. Receives:

html
<template #summary.final="{ model, schema, previewModel, completeForm }">
  <!-- custom final summary -->
</template>

summary.final.body

Injects content into the body section of the default StepperFinalSummary card:

html
<template #summary.final.body="{ models, schemas, lastStepModel, finalFormFields, lastFormPreview }">
  <!-- line items, pricing breakdown, etc. -->
</template>

summary.final.total.label / summary.final.total

Override the "Total" label and value in the final summary:

html
<template #summary.final.total.label>Price</template>
<template #summary.final.total="{ payload }">
  {{ payload.amount_formatted }}
</template>

summary.final.description

Override the description text below the total:

html
<template #summary.final.description>
  Prices are exclusive of VAT.
</template>

Final Form Fields

finalFormFields defines selectable items shown on the final preview step. Each entry is either a dot-notation string or a configuration object:

js
finalFormFields: [
  {
    modelNotation: 'models.0.package_id',   // dot-path into models
    fieldName:     'selected_packages',      // key written into the payload
    endpoint:      '/api/packages',          // fetches available options
    notation:      'packages',               // key inside each API response item
    afterStep:     1,                        // fetch after leaving step 1
    cardFields:    ['name', 'description', 'tags'],
    format:        'id',                     // 'id' or an object map
    formatSourceKey: 'id',
    formatUniqueKey: 'id',
  }
]
KeyTypeDescription
modelNotationStringDot-path into models whose value provides the selected IDs.
fieldNameStringKey written to the final payload. Defaults to the last segment of modelNotation.
endpointStringAPI endpoint to fetch available items. Receives ?ids[]=... for new IDs.
notationStringProperty inside each fetched item that contains the selectable sub-items.
afterStepNumberStep number after which the fetch is triggered (on step advance).
cardFieldsArrayFields from the item to display in the card. Nested arrays create grouped cells.
formatString|Object'id' stores IDs; an object maps payload keys to item fields.
formatSourceKeyStringSource key on the fetched item for uniqueness checks (default 'id').
formatUniqueKeyStringKey used when matching against the stored object array (default 'id').

Full-Width Steps

Set fullWidth: true on a form definition to make that step span the full container width while hiding the summary sidebar. Navigation uses a v-stepper-actions bar at the bottom instead.

js
{
  title: 'Wide Step',
  fullWidth: true,
  schema: $this->createFormSchema([...]),
}