EN
Getting started
57 · Forms

Input group

Puts a fixed add-on to the left or right of a text field: a country code, currency, unit, domain name or icon. The label, hint and validation error work the same as in acun:input.

acun:input-group
01

Prefix and suffix

prefix adds text to the left of the field and suffix to the right, separated by a thin line; when the field is clicked, the border and the line turn to the primary color; the two can be used together. The add-on is not included in the submitted value; it is purely visual.

LIVE EXAMPLE
<div class="space-y-4">
    <acun:input-group name="phone" label="Phone" prefix="+90" placeholder="5xx xxx xx xx" />
    <acun:input-group name="price" label="Product price" suffix="₺" placeholder="0.00" inputmode="decimal" />
    <acun:input-group name="site" label="Website" prefix="https://" suffix=".com" />
</div>
PropValues
prefixText on the left
suffixText on the right
02

With icons

To place an icon or other content instead of text, use the before and after slots. When a slot is given, the prefix / suffix on the same side is ignored.

LIVE EXAMPLE
<div class="space-y-4">
    <acun:input-group name="email" type="email" label="Email" placeholder="[email protected]">
        <acun:slot:before><acun:icon name="envelope" size="4" /></acun:slot:before>
    </acun:input-group>
    <acun:input-group name="search" type="search" label="Search customers" placeholder="Name, email or phone">
        <acun:slot:after><acun:icon name="magnifying-glass" size="4" /></acun:slot:after>
    </acun:input-group>
</div>
PropValues
beforeCustom content on the left (slot)
afterCustom content on the right (slot)
03

Label, hint and required field

label is shown above the field and hint below it. The required attribute adds a red asterisk to the label and is also passed to the field itself. Other attributes such as type, placeholder, value and disabled are added directly to the inner input.

LIVE EXAMPLE
<acun:input-group name="fee" label="Monthly subscription fee" suffix="₺" required hint="Per-user monthly price, excluding VAT." />
PropValues
labelLabel above
hintHelp text below
requiredAdds * to the label
04

Validation error

If there is a validation error for the field name (name or wire:model), the border turns red and the message is shown below the field in place of the hint.

LIVE EXAMPLE
<acun:input-group name="weight" label="Package weight" suffix="kg" value="-3" hint="Shipping cost is calculated from this weight." />
PropValues
nameThe error is looked up by this name; otherwise wire:model is used
05

With Livewire

When wire:model is given, the field name is taken from that property, so you do not need to write name. Modifiers such as .live and .live.blur are also supported. To validate on the server when the field loses focus, write .live.blur: in Livewire 4, .blur alone only updates the value in the browser and sends no request.

BLADE
<acun:input-group wire:model.live.blur="phone" label="Phone" prefix="+90" />
PropValues
wire:modelThe bound Livewire property
API

Props and slots

The values the component accepts.

PropDefaultDescription
labelnullLabel above the field
namenullField name; otherwise the wire:model value is used
hintnullHelp text below; when there is an error, the error is shown instead. Both are linked to the field with aria-describedby; aria-invalid is added on error
prefixnullText add-on on the left
suffixnullText add-on on the right
typetextInput type; other attributes are added to the input as well
disabled · readonlyfalseMuted background like acun:input; the box fits narrow columns
Slots: before, after: an icon or custom content; when given, shown instead of prefix / suffix.
Acun UI · Input groupDetailed usage and examples