v0.0.2
Demos (demo panel, opens in a new tab)

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

Single column: view
BLADE

In short forms stack the fields with space-y-4; each field carries its own label, hint and error.

blade
<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>
PropValues
space-y-4Vertical space between the fields

Two columns

Two columns: view
BLADE

In long forms use two columns with grid md:grid-cols-2 and stretch long fields with md:col-span-2.

blade
<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>
PropValues
grid gap-4 md:grid-cols-2Two columns on wide screens
md:col-span-2Stretches the field to full width

Required fields and hints

Required fields and hints: view
BLADE

required adds a red star to the label and hint states the expected format below the field.

blade
<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>
PropValues
requiredAdds * to the label
hintHelp 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.

blade
<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>
PropValues
wire:submitMethod called on submit
dirty-checkUnsaved-changes protection

Developer notes

Events, hooks and details
  • zb:form renders a plain <form>; for the change guard see the Form guard page.
Zubazar UI · ZubazarDesigned for people.