Skip to content

UWrapper ​

File: src/Services/View/UWrapper.php

UWrapper is a static factory for building grid-layout wrapper schemas. It composes UComponent instances into v-row / v-col structures without requiring instantiation.

Methods ​

MethodSignatureDescription
make()static make(): selfReturns a new instance (rarely needed)
makeGridSectionstatic makeGridSection($elements, $rowAttributes, $colAttributes): arrayWraps an array of components in a v-row with one v-col per element
makeFormWrapperstatic makeFormWrapper($forms): arrayConverts an array of form attribute arrays into a grid of ue-form components
makeProfileWrapperstatic makeProfileWrapper($elements, $attributes)Stub — not yet implemented

makeGridSection ​

Produces a v-row → v-col[] schema. Each element in $elements becomes one column.

php
$grid = UWrapper::makeGridSection(
    elements: [$componentA, $componentB],
    rowAttributes: ['class' => 'my-4'],
    colAttributes: ['cols' => 12, 'lg' => 6],
);

Element types accepted:

TypeBehaviour
UComponent instanceAppended directly as a child of the column
Associative array with content keyContents split across the column; parent_attributes merged into col attributes
Plain array with multiple itemsEach item appended as a child of the same column
Plain array with one itemThat item appended as the column's child

Default column attributes: ['class' => '', 'cols' => 12, 'lg' => 6] — merged with $colAttributes.

makeFormWrapper ​

Shorthand for rendering a list of form schemas as a responsive grid:

php
$layout = UWrapper::makeFormWrapper([
    ['model' => 'profile', 'action' => '/profile'],
    ['model' => 'password', 'action' => '/password'],
]);

Internally calls makeGridSection() after wrapping each element in UComponent::makeUeForm().

Example ​

php
use Unusualify\Modularous\Services\View\UComponent;
use Unusualify\Modularous\Services\View\UWrapper;

$grid = UWrapper::makeGridSection([
    UComponent::makeUeCard(['title' => 'Revenue']),
    UComponent::makeUeCard(['title' => 'Users']),
    UComponent::makeUeCard(['title' => 'Orders']),
], [], ['cols' => 12, 'lg' => 4]);

return Inertia::render('Dashboard', ['grid' => $grid]);