Forms & inputs
Layout
Input
A single-line text field with sizes, states, and start and end slots for icons or buttons. Use it for names, emails, search and other short text.
Validating a form? vael-form wires this up with a schemaInstall
import { Input } from 'vael-ui'Playground
undefined
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { Input } from 'vael-ui'
const value = ref('')
</script>
<template>
<Input placeholder="Type here…" v-model="value" />
</template>Motion New
Input's motion: values or hooks for its parts (InputPart), its states (invalid, disabled, focus). false turns it off.
<Input
:motion="{ states: { invalid: { root: { scale: 1.04 } } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | rootinputstartend | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | invaliddisabledfocus | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
It has no keyboard interaction of its own.
- Renders a native
<input>and adds no keys of its own. - Inside a
Field, the label names the input.aria-describedbylists your own ids first, then the Field’s description and error. - Outside a
Field, give it anaria-label, which goes to the input. It setsaria-invalidwhen invalid andaria-requiredwhen theFieldis required. - With
clearable, a clear button named “Clear” shows while there’s text. It is a Tab stop, and clearing puts focus back in the input. The#displayslot isaria-hidden; screen readers read the input underneath.