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

Text input

A labeled text input that shows its validation error by itself.

zb:input zubazar/ui · free (MIT)

Basic usage

Basic usage: view
BLADE

label draws a label above the field; the field's name and id come from the wire:model value.

blade
<div class="space-y-4">
    <zb:input wire:model="product_name" label="Product name" placeholder="E.g. Wireless headphones" />
    <zb:input name="custom_code" label="Custom code" value="SKU-01" />
</div>
PropValues
labelLabel above the field
nameField name; defaults to the wire:model value

Label and hint

Label and hint: view
BLADE

hint adds a short help text below the field, and required puts a red asterisk next to the label.

blade
<div class="space-y-4">
    <zb:input wire:model="phone" type="tel" label="Phone" required hint="10 digits, without the leading 0." />
    <zb:input wire:model="custom_code" label="Custom code" hint="Shown as the short name in reports." />
</div>
PropValues
hintHelp text below
requiredAttribute; adds * to the label

Types

Types: view
BLADE

type goes straight to the field (default text); type="search" puts a magnifier on its left.

blade
<div class="space-y-4">
    <zb:input name="email" type="email" label="Email" placeholder="name@example.org" />
    <zb:input name="stock_quantity" type="number" label="Stock quantity" min="0" value="12" />
    <zb:input name="delivery_date" type="date" label="Delivery date" />
    <zb:search wire:model.live.debounce.400ms="search" placeholder="Product name or custom code" aria-label="Search products" />
</div>
PropValues
typetext | email | number | date | tel | search | password …

Password field

Password field: view
BLADE

With type="password" and viewable, an eye button on the right of the field shows and hides the password.

blade
<div class="space-y-4">
    <zb:input wire:model="password" type="password" label="Password" viewable />
    <zb:input wire:model="password_confirmation" type="password" variant="floating" label="Password (again)" viewable />
</div>
PropValues
viewabletrue | false

Validation error

Validation error: view
BLADE

If $errors has an error for the field's name, the border turns red and the message shows below the field, in place of the hint.

blade
<zb:input wire:model="national_id" label="National ID no." value="1234567" hint="11-digit number." />
PropValues
aria-describedbyAttribute; the message id is appended to the given value

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label—nullLabel; * is added next to it when the required attribute is present
name—nullField name; defaults to the wire:model value. The id and the error key also come from it
hint—nullHelp text below while there is no error; linked to the field with aria-describedby
variant—defaultdefault · floating
viewablebooleanfalseShow/hide button on password fields, also usable with the keyboard (aria-pressed)
input-class—nullClasses of the <input> element itself; class places the whole field
(attributes)— — class, style, :class, x-show, x-cloak, wire:key, wire:show, x-transition… go on the outer element that wraps the whole field; type, placeholder, value, name, wire:model, required, disabled, readonly, id, aria-*, data-* and events go straight to the <input> element. aria-describedby is merged with the message id

Advanced

2 examples

Floating label

Floating label: view
BLADE

variant="floating" puts the label inside the field; when the field is focused or filled, the label shrinks up to the top edge. Since the label does the placeholder's job, don't use placeholder; it suits forms with few fields, such as a login screen.

blade
<div class="space-y-4">
    <zb:input wire:model="email" type="email" variant="floating" label="Email" />
    <zb:input name="full_name" variant="floating" label="Full name" value="Ayşe Yılmaz" />
</div>
PropValues
variantdefault | floating

Disabled and read-only

Disabled and read-only: view
BLADE

disabled draws the field gray and its value is not submitted; readonly only gives a gray background, and the value is still submitted and can be copied. On a floating-label field the disabled state is shown faded so the label notch is not broken.

blade
<div class="space-y-4">
    <zb:input name="customer_no" label="Customer no." value="CUS-10482" readonly />
    <zb:input name="registration_date" label="Registration date" value="12.03.2026" disabled />
    <zb:input name="company" variant="floating" label="Company" value="Acme Software" disabled />
</div>
PropValues
disabledAttribute; gray background and text (faded with a floating label)
readonlyAttribute; gray background (except with a floating label)

Developer notes

Events, hooks and details
  • name and id are derived with modifiers such as wire:model.live too; since the id stays the same on every update, focus is not lost during Livewire updates. Without Livewire, pass name.
  • Attributes such as placeholder and value go straight to the <input>, while class, style, x-show and wire:key go on the outer element that wraps the whole field; to style the <input> itself, pass input-class.
  • The hint gives way to the error message when there is one; required also turns on the browser's required-field check.
  • The eye button works with the floating label too.
  • The message id is built by appending -message to the field id (here national_id-message); your own aria-describedby value is kept and the message id is added next to it.
  • In Livewire the error display works by itself after $this->validate(); no extra code is needed.

Accessibility

Label
label renders a <label for> tied to the input id. Without an id, one is built from the name or the wire:model property; the same name a second time on the page gets -2. The floating variant links its label the same way.
Hint and error
The hint or the validation error under the field is linked with aria-describedby. Your own aria-describedby is kept and the two are merged. With an error the input gets aria-invalid="true".
Required
The red asterisk is hidden from screen readers (aria-hidden). The required attribute, which goes straight to the <input>, announces it.
Show password
viewable adds a "Show password" button. It is in the tab order, and aria-pressed tells whether the password is visible.
What you provide
Give a field without label (a search box, for example) an aria-label; it goes on the <input>. The error text is not a live region (no role="alert"), so it is read when the field is focused.
Zubazar UI · ZubazarDesigned for people.