---
title: "Upload and contact forms"
description: "The form components for what people send the app: <UploadField>, a checked upload with progress, and <ContactForm>, a contact or feedback form delivered to your team. One section each, with its props, slots, events, states and accessibility."
canonical_url: "https://nuxt-backend.dev/docs/reference/components/forms"
---
# Upload and contact forms

> The form components for what people send the app: <UploadField>, a checked upload with progress, and <ContactForm>, a contact or feedback form delivered to your team. One section each, with its props, slots, events, states and accessibility.

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Two components take in what people send your app. `<UploadField>` uploads a file the deployment checks before it keeps it. `<ContactForm>` sends a message to your team, . Each keeps the [component contract](https://nuxt-backend.dev/docs/reference/components#the-component-contract), so its props, slots, events, states and accessibility are listed below.

## `<UploadField>`

A labelled file field that uploads with the base module's `useUpload` and the URL `setupStorage` mints (`api.storage.generateUploadUrl`). It shows the upload's progress and a cancel button, then calls your `claim` function, the mutation that keeps the file, where the deployment checks its type, its size and the plan's storage quota. It sets `v-model` only when the claim went through ([Accept checked uploads](https://nuxt-backend.dev/docs/build/data/files/checked-uploads)). A keyboard reaches the picker by a button, and dropping a file onto the field is a second path.

<table>
<thead>
  <tr>
    <th>
      At a glance
    </th>
    
    <th>
      
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Rendered by
    </td>
    
    <td>
      no ready-made page: place it yourself
    </td>
  </tr>
  
  <tr>
    <td>
      Family
    </td>
    
    <td>
      <code>
        data-upload
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Labels
    </td>
    
    <td>
      <code>
        upload
      </code>
      
      , a group of its own
    </td>
  </tr>
  
  <tr>
    <td>
      Slots
    </td>
    
    <td>
      <code>
        default
      </code>
      
      , <code>
        file
      </code>
      
      , <code>
        error
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Events
    </td>
    
    <td>
      <code>
        update:modelValue
      </code>
      
      , <code>
        error
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      States
    </td>
    
    <td>
      ready, uploading, claiming, done, refused, error
    </td>
  </tr>
  
  <tr>
    <td>
      Status
    </td>
    
    <td>
      Built
    </td>
  </tr>
</tbody>
</table>

**Props**

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      What it does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        modelValue
      </code>
    </td>
    
    <td>
      <code>
        string | null
      </code>
    </td>
    
    <td>
      <code>
        null
      </code>
    </td>
    
    <td>
      The storage id of the claimed file. Bind it with <code>
        v-model
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        claim
      </code>
    </td>
    
    <td>
      <code>
        (storageId: string) => Promise<unknown>
      </code>
    </td>
    
    <td>
      none
    </td>
    
    <td>
      Your mutation that keeps the file. A refusal it throws is tied to the field.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        accept
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      none
    </td>
    
    <td>
      The file types the picker offers, written as the <code>
        accept
      </code>
      
       attribute writes them. The claim checks the type again, whatever the picker allowed.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        labels
      </code>
    </td>
    
    <td>
      <code>
        LabelOverrides
      </code>
    </td>
    
    <td>
      none
    </td>
    
    <td>
      Copy for this field, over app config and the translations.
    </td>
  </tr>
</tbody>
</table>

**Slots:** `default` holds the words of the picker button; `file` shows the chosen file and receives `{ file, progress, cancel }`; `error` shows why a file was refused and receives `{ error }`.

**Events:** `error` carries the refusal, such as `invalid_input` for a type or a size `setupStorage` does not take, or `quota_exceeded` when the plan's storage is full.

```vue [app/components/CoverField.vue]
<script setup lang="ts">
import { api } from '#backend/api'

const props = defineProps<{ storyId: string }>()
const setCover = useMutation(api.stories.setCover)
const coverId = ref<string | null>(null)
</script>

<template>
  <UploadField
    v-model="coverId"
    accept="image/png,image/jpeg,image/webp"
    :claim="id => setCover({ id: props.storyId, coverId: id })"
  />
</template>
```

`<StorageImage>` shows the claimed image from storage, and the `@nuxt/image` provider serves it resized ([Show images from storage](https://nuxt-backend.dev/docs/build/data/files/images)).

**Accessibility:** The picker is a native file input with a visible label, so a keyboard and a screen reader reach it without drag and drop. Progress and refusals are announced in a live region, the cancel button is named in words, and a refused file says why in an alert.

## `<ContactForm>`

A contact form for visitors, and a feedback form for signed-in people, from one component with no props of its own. It calls `submitContactMessage` from `email.api`: a bot check through `useHumanCheck` and `verifyHuman`, a honeypot field, a limit per sender and one for the whole deployment, then a stored message that the deployment copies to the support inbox (`setupEmail({ inbound: { support } })`), else to `setupEmail({ contact: { to } })`, through the email queue, so a provider outage never loses one. Every message lands in the admin console's Inbox tab. The form never emails the address someone typed ([Add a contact form](https://nuxt-backend.dev/docs/build/email/inbound/contact-form)). Without the component, [`useContactForm`](https://nuxt-backend.dev/docs/reference/nuxt/composables) gives markup of your own the same state, actions and bindings.

<table>
<thead>
  <tr>
    <th>
      At a glance
    </th>
    
    <th>
      
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Rendered by
    </td>
    
    <td>
      no ready-made page: place it yourself
    </td>
  </tr>
  
  <tr>
    <td>
      Family
    </td>
    
    <td>
      <code>
        data-contact
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Labels
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/configuration/labels#contact">
        <code>
          contact
        </code>
      </a>
      
      , a group of its own
    </td>
  </tr>
  
  <tr>
    <td>
      Slots
    </td>
    
    <td>
      <code>
        fields
      </code>
      
      , <code>
        sent
      </code>
      
      , <code>
        error
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Events
    </td>
    
    <td>
      <code>
        sent
      </code>
      
      , <code>
        error
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      States
    </td>
    
    <td>
      ready, pending, sent, error, refused
    </td>
  </tr>
  
  <tr>
    <td>
      Status
    </td>
    
    <td>
      Built
    </td>
  </tr>
</tbody>
</table>

**Props:** `labels` alone, copy for this form over app config and the translations. Signed out, the form asks for a name, an address to answer and a message. Signed in, it sends as the account and asks for the message alone. A message runs from 10 to 2,000 characters.

**Slots:** `fields` replaces the fields and receives the form's values and its `send`; `sent` shows what follows a message that went through and receives `{ another }`, which clears the form for a second message; `error` shows a refusal and receives `{ error }`.

**Events:** `sent` fires once the deployment stored the message; `error` carries the refusal, such as `rate_limited` with `retryAfter`, or `forbidden` with reason `bot_check`.

```vue [app/pages/contact.vue]
<template>
  <main>
    <h1>Contact us</h1>
    <ContactForm />
  </main>
</template>
```

**Accessibility:** Every field has a visible label; the honeypot is hidden from people and from assistive technology; the send button keeps focus while the message is on its way (`aria-disabled`) and says so; a sent message is a polite status, and a refusal is an alert that says what to do next.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
