Forms
Input
A single-line text field with a built-in label, description and error message — wired together for assistive technology.
Installation #
With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:
Copy
import { JInput } from '@juxtui/ui'Usage #
Copy
<JInput v-model="email" label="Email" type="email" placeholder="you@example.com" />Variants & examples #
Leading and trailing icons#
Anything in the leading and trailing slots sits inside the field. Clicking the frame focuses the input.
/
.juxt.dev
Validation#
Pass a message to error. It replaces the description and is announced through aria-describedby.
Disabled and read-only#
Sizes#
API #
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| modelValue | string | number | null | '' | Bound with v-model. |
| label | string | — | Visible label, also used as the accessible name. |
| description | string | — | Supporting text under the control. Replaced by the error message while one is shown. |
| error | string | boolean | — | An error message, or true to mark the field invalid without a message. |
| required | boolean | false | Marks the field as required, natively and visually. |
| disabled | boolean | false | Disables the control. |
| id | string | — | Id of the control. Generated (SSR-safe) when omitted. |
| type | string | 'text' | Native input type. |
| placeholder | string | — | Placeholder text. Never a substitute for a label. |
| size | 'sm' | 'md' | 'lg' | 'md' | Control height. |
| readonly | boolean | false | Read-only, still focusable and selectable. |
| name | string | — | Form field name. |
| autocomplete | string | — | Native autocomplete hint. |
Events
| Event | Payload | Description |
|---|---|---|
| update:modelValue | string | number | Emitted on input. |
| focus, blur, keydown, … | Event | Any other listener or attribute is forwarded to the native <input>; class and style go on the root. |
Slots
| Slot | Props | Description |
|---|---|---|
| leading | — | Content before the input, usually an icon. |
| trailing | — | Content after the input — an icon, a unit or a small button. |
| label | — | Custom label content. |
Methods
| Method | Signature | Description |
|---|---|---|
| focus() | () => void | Focus the input. |
| select() | () => void | Select the input’s text. |
Accessibility #
- The label is a real
<label for>pointing at the input. - Description and error are linked with
aria-describedby; an error also setsaria-invalid. - Required fields use the native
requiredattribute. The asterisk is decorative and hidden from screen readers.