Forms & inputs
Layout
FileUpload
A drop zone and file list for picking files, with validation. Use it for attachments and uploads in forms.
Validating a form? vael-form wires this up with a schemaInstall
import { FileUpload } from 'vael-ui'Playground
Drop files here
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { FileUpload } from 'vael-ui'
</script>
<template>
<FileUpload />
</template>Motion New
FileUpload's rows: values or hooks for item, and the list's stagger and leaving.
<FileUpload
:motion="{ initial: { item: { opacity: 0, y: 8 } }, stagger: 0.04 }"
/>| Name | Type | Description |
|---|---|---|
initialexit | item | 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. |
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. |
staggerleavingappear | number | 'pop' | 'hold' | boolean | Items coming in together start stagger seconds apart. A leaving item lifts out so the rest close the gap ('pop'), or keeps its space until it's gone ('hold'). appear: true also brings in the items already there when it mounts. |
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
| Key | Action |
|---|---|
| EnterSpace | Opens the file picker from the Browse button. |
| EnterSpace | Removes the file from its remove button. |
- The native file input is visually hidden and out of the tab order. The Browse button is the keyboard entry point; the drop zone isn’t focusable. Cmd or Ctrl with V pastes files while focus is inside it.
- Each remove button is named “Remove” plus the file name. After a removal, focus moves to the next row’s button, the previous one, or the Browse button.
- Rejected files are announced through a polite live region, such as “photo.png wasn’t added: it’s too large.”, and set
aria-invalid. - Inside a
Field, the Browse button reads the label, then “Browse files”, and the description and error describe it. Outside aField, it reads “Browse files”.