Field
Label, hint and error around any custom control — the frame input and select use internally.
Real scenarios
The component as it is used in a product — not a specimen grid.
Store brand settings — the controls inputs don’t cover
A native color picker and a time input, each wrapped in the field frame: the label points at your control through for, the hint gets its id, and the star marks what’s required. The preview beneath updates live.
Check it against both themes before saving.
Visitors see this on the contact card.
#5647E6
·
opens at 09:00
A password with a reveal toggle and a live error
Your own control inside an nx-input-group: a native password box plus a toggle button, state kept in the demo’s Livewire state. The error is computed as you type — the frame turns red, the message rolls in, and the wiring (aria-invalid, aria-describedby → hint and error ids) is exactly what the frame renders for you.
At least 8 characters; mix letters and digits.
The toggle keeps its state through Livewire updates — no Alpine needed, just $toggle on the state array.
A daily budget cap with a currency addon
A number box and its glued «تومان» addon as one composite control; the frame carries the label, the hint with the locale-formatted minimum, and the error when the cap is too low. The monthly estimate below reads the same number back in Persian digits.
The minimum is 50,000 — delivery pauses when the cap is hit.
Type a cap of 50,000 or more to see the monthly ceiling.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| for | string | null | Your control’s id; wires the label’s for and gives the hint/error the ids “{for}-hint” and “{for}-error” — point the control’s own aria-describedby at those ids. |
| label / hint / error | string | null | The label, helper text and error message; an error flags the frame with data-invalid and turns the nx-input/… controls red. |
| required | bool | false | Adds the required star to the label; put required itself on the native control. |
Snippet
<x-nx::field label="رنگ برند" hint="در هر دو تم بررسی شود" for="brand-color" required>
<input type="color" id="brand-color" class="nx-input"
aria-describedby="brand-color-hint" wire:model.live.debounce.200ms="state.brandColor" />
</x-nx::field>
<x-nx::field label="رمز عبور تازه" for="pw" required error="دستکم ۸ نویسه">
<input id="pw" class="nx-input" type="password" dir="ltr" aria-invalid="true"
aria-describedby="pw-hint pw-error" wire:model.live="state.password" />
</x-nx::field>