Skip to content

zk-input ​

Base input component. Renders <input> wrapped in a field structure. All typed input shorthands (zk-email, zk-date, etc.) delegate to this component.

Props ​

PropTypeDefaultDescription
typestring'text'Input type attribute
namestring|nullnullname attribute
idstring|nullnullid attribute — auto-generated from name when a label is present
valuemixednullInput value — uses old() automatically on repopulation
placeholderstring|nullnullPlaceholder text
labelstring|nullnullLabel text — renders a <label> element
labelBeforebooltruePlace the label before the input; set false for label-after (e.g. x-zk-checkbox overrides this to false)
requiredboolfalseAdds required and aria-required="true"
disabledboolfalseAdds disabled attribute
readonlyboolfalseAdds readonly attribute
multipleboolfalseAdds multiple attribute
autofocusboolfalseAdds autofocus attribute
checkedboolfalseAdds checked attribute (for checkbox/radio types)
autocompletestring|nullnullautocomplete attribute
patternstring|nullnullpattern validation attribute
minstring|nullnullmin attribute
maxstring|nullnullmax attribute
stepstring|nullnullstep attribute
maxlengthint|nullnullmaxlength attribute
acceptstring|nullnullaccept attribute (file inputs)
liststring|nullnulllist attribute — links to a <datalist> id
sizeint|nullnullsize attribute
widthint|nullnullwidth attribute
heightint|nullnullheight attribute
classstring|nullnullCSS class(es) on the <input> element
fieldbooltrueWrap in field structure — set false to render bare input
fieldClassstring|nullnullCSS class(es) on the field wrapper
iconBeforestring|nullnullLeading icon name (Material Symbols)
iconAfterstring|nullnullTrailing icon name
prefixstring|nullnullText prefix inside the input wrapper
suffixstring|nullnullText suffix inside the input wrapper
supportingTextstring|nullnullHelper text below the field — overridden by validation error
supportingCounterstring|nullnullCharacter counter text below the field

Examples ​

Basic text input ​

blade
<x-zk-input name="username" label="Username" />

With validation and repopulation ​

blade
<x-zk-input
    name="email"
    type="email"
    label="Email address"
    :value="$user->email"
    required />

No field wrapper (bare input) ​

blade
<x-zk-input name="q" placeholder="Search..." :field="false" />

Label after the input ​

blade
<x-zk-input name="username" label="Username" :labelBefore="false" />

With icons and supporting text ​

blade
<x-zk-input
    name="email"
    label="Email"
    iconBefore="mail"
    supportingText="We will never share your email." />

With prefix/suffix ​

blade
<x-zk-input name="price" type="number" prefix="€" suffix="HT" />

With datalist ​

blade
<x-zk-input name="city" list="cities-list" />
<x-zk-datalist id="cities-list" :options="['Paris' => 'Paris', 'Lyon' => 'Lyon']" />

Alpine.js integration ​

blade
<x-zk-input name="q" x-model="query" @input.debounce="search" />

Notes ​

  • old() is called automatically — no need to wrap value in old($name, $value) manually.
  • id is auto-generated from name only when a label is present, to maintain correct <label for=""> linkage.
  • Validation errors from $errors bag automatically populate supportingText.

Documentation of 3.2.0 , built from c93e21f on 3.2.0 by pipeline #2919741884 on 2026-10-06.