Forms

Input

A single-line text field with a built-in label, description and error message — wired together for assistive technology.

We’ll only use this to send receipts.

Copy
<script setup lang="ts">
const email = ref('')
</script>

<template>
  <JInput
    v-model="email"
    label="Email"
    type="email"
    placeholder="you@example.com"
    description="We’ll only use this to send receipts."
  />
</template>

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.

Use lowercase letters, numbers and dashes.

Disabled and read-only#

Copy
<template>
  <div class="flex flex-col gap-5">
    <JInput label="Workspace" model-value="Acme Inc." disabled />
    <JInput label="API key" model-value="jx_live_4f9a…c21b" readonly />
  </div>
</template>

Sizes#

Copy
<template>
  <div class="flex flex-col gap-4">
    <JInput size="sm" placeholder="Small" aria-label="Small" />
    <JInput size="md" placeholder="Medium" aria-label="Medium" />
    <JInput size="lg" placeholder="Large" aria-label="Large" />
  </div>
</template>

API #

Props

PropTypeDefault Description
modelValuestring | number | null''Bound with v-model.
labelstring—Visible label, also used as the accessible name.
descriptionstring—Supporting text under the control. Replaced by the error message while one is shown.
errorstring | boolean—An error message, or true to mark the field invalid without a message.
requiredbooleanfalseMarks the field as required, natively and visually.
disabledbooleanfalseDisables the control.
idstring—Id of the control. Generated (SSR-safe) when omitted.
typestring'text'Native input type.
placeholderstring—Placeholder text. Never a substitute for a label.
size'sm' | 'md' | 'lg''md'Control height.
readonlybooleanfalseRead-only, still focusable and selectable.
namestring—Form field name.
autocompletestring—Native autocomplete hint.

Events

EventPayload Description
update:modelValuestring | numberEmitted on input.
focus, blur, keydown, …EventAny other listener or attribute is forwarded to the native <input>; class and style go on the root.

Slots

SlotProps 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

MethodSignature Description
focus()() => voidFocus the input.
select()() => voidSelect 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 sets aria-invalid.
  • Required fields use the native required attribute. The asterisk is decorative and hidden from screen readers.