Skip to content

Input

Text input component with icon support, size variants, and validation states. Wraps native input with InputWrapper for consistent styling.

Import

typescript
import { Input } from 'vuiii'

Basic Usage

vue
<Input v-model="name" placeholder="Enter your name" />

Props

PropTypeDefaultDescription
modelValuestring | number | Date | null-Bound value (use with v-model)
prefixIconstring-Icon name to show before the input
suffixIconstring-Icon name to show after the input
prefixIconClickablebooleanfalseRenders the prefix icon as a focusable button
suffixIconClickablebooleanfalseRenders the suffix icon as a focusable button
prefixIconLabelstring-Accessible label for a clickable prefix icon
suffixIconLabelstring-Accessible label for a clickable suffix icon
size'small' | 'normal' | 'large''normal'Input size
invalidbooleanfalseApplies the invalid/error styling
pillbooleanfalseRounded pill shape
disabledbooleanfalseDisables the input (native attribute)
placeholderstring-Placeholder text (native attribute)
typestring'text'Native input type (native attribute)
valueAsNumberbooleanfalseEmits the value as a number (for type="number")
valueAsDatebooleanfalseEmits the value as a Date (for type="date")
inputClassany-Class applied to the nested <input> element

Slots

SlotDescription
prefixContent before the input (replaces prefixIcon)
suffixContent after the input (replaces suffixIcon)

Events

EventPayloadDescription
prefix-icon-click-When the prefix icon is clicked
suffix-icon-click-When the suffix icon is clicked

Input Types

type and the other native attributes pass straight through to the underlying <input>.

vue
<Input v-model="email" type="email" placeholder="Email" />
<Input v-model="password" type="password" placeholder="Password" />
<Input v-model="count" type="number" placeholder="Count" />

Typed values

A native input always reports a string. valueAsNumber and valueAsDate make the model receive the parsed value instead, so you do not convert on every change.

vue
<!-- count is a number -->
<Input v-model="count" type="number" value-as-number />

<!-- startsOn is a Date -->
<Input v-model="startsOn" type="date" value-as-date />

With Icons

vue
<Input v-model="search" prefix-icon="search" placeholder="Search..." />
<Input v-model="email" suffix-icon="mail" placeholder="Email" />

Clickable Icons

Mark the icon suffix-icon-clickable (or prefix-icon-clickable) and it becomes a real, focusable button; without it the icon stays decorative and out of the tab order. Give it a label so it is announced.

vue
<Input
  v-model="query"
  suffix-icon="x"
  suffix-icon-clickable
  suffix-icon-label="Clear"
  @suffix-icon-click="query = ''"
/>

Sizes and Validation State

vue
<Input v-model="value" size="small" placeholder="Small" />
<Input v-model="value" :invalid="!!errors.value" placeholder="Invalid" />
<Input v-model="value" pill placeholder="Pill" />
<Input v-model="value" disabled placeholder="Disabled" />

To pair the invalid state with a label and an error message, wrap it in FormGroup — see Composing Forms.

Storybook

For interactive examples with all variants, see Input in Storybook.

Released under the MIT License.