Vertical form
The standard form layout with labels above the fields; there is no separate component, it is built with Tailwind classes.
Form layout zubazar/ui · free (MIT)
Single column
BLADE
In short forms stack the fields with space-y-4; each field carries its own label, hint and error.
<form class="space-y-4">
<zb:input name="contact_name" label="Full name" />
<zb:input name="contact_email" type="email" label="Email" />
<zb:select name="contact_subject" label="Subject" :options="['order' => 'Order', 'billing' => 'Billing', 'other' => 'Other']" placeholder="Select…" />
<zb:textarea name="contact_message" label="Message" rows="3" />
<zb:button type="submit" class="w-full">Send</zb:button>
</form>
| Prop | Values |
|---|---|
space-y-4 | Vertical space between the fields |
Two columns
BLADE
In long forms use two columns with grid md:grid-cols-2 and stretch long fields with md:col-span-2.
<zb:card title="Customer record">
<form class="grid gap-4 md:grid-cols-2">
<zb:input name="first_name" label="First name" />
<zb:input name="last_name" label="Last name" />
<zb:input-group name="phone" label="Phone" prefix="+90" />
<zb:select name="group" label="Customer group" :options="['1' => 'Individual', '2' => 'Business']" placeholder="Select…" />
<div class="md:col-span-2"><zb:textarea name="address" label="Address" rows="2" /></div>
<div class="flex gap-2 md:col-span-2">
<zb:button type="submit">Save</zb:button>
<zb:button variant="white">Cancel</zb:button>
</div>
</form>
</zb:card>
| Prop | Values |
|---|---|
grid gap-4 md:grid-cols-2 | Two columns on wide screens |
md:col-span-2 | Stretches the field to full width |
Required fields and hints
BLADE
required adds a red star to the label and hint states the expected format below the field.
<form class="grid gap-4 md:grid-cols-2">
<zb:input name="req_name" label="Full name" required />
<zb:input-group name="req_phone" label="Phone" prefix="+90" required hint="10 digits, without the leading 0." />
<zb:select name="req_city" label="City" :options="['istanbul' => 'Istanbul', 'izmir' => 'Izmir']" placeholder="Select…" required />
<zb:textarea name="req_note" label="Note" rows="2" hint="Optional." />
</form>
| Prop | Values |
|---|---|
required | Adds * to the label |
hint | Help text below the field |
With Livewire
BLADE
wire:model gives the field its name and errors match that name; dirty-check on zb:form turns on the unsaved-changes guard.
<zb:form wire:submit="save" dirty-check class="grid gap-4 md:grid-cols-2">
<zb:input wire:model="firstName" label="First name" required />
<zb:input wire:model="lastName" label="Last name" required />
<zb:input-group wire:model="phone" label="Phone" prefix="+90" />
<zb:select wire:model="groupId" label="Customer group" :options="$groups" placeholder="Select…" />
<div class="md:col-span-2">
<zb:button type="submit">Save</zb:button>
</div>
</zb:form>
| Prop | Values |
|---|---|
wire:submit | Method called on submit |
dirty-check | Unsaved-changes protection |
Developer notes
zb:formrenders a plain<form>; for the change guard see the Form guard page.