Skip to content

feat(VFileUpload): integrate VInput & split internal logic#22637

Merged
J-Sek merged 15 commits intomasterfrom
haviles04/v-file-upload-changes
Mar 4, 2026
Merged

feat(VFileUpload): integrate VInput & split internal logic#22637
J-Sek merged 15 commits intomasterfrom
haviles04/v-file-upload-changes

Conversation

@Haviles04
Copy link
Copy Markdown
Contributor

@Haviles04 Haviles04 commented Feb 21, 2026

fixes: #22651

<script lang="ts" setup>
  import { ref } from 'vue'

  const single = ref()
  const insetSingle = ref()
  const multi = ref([])
  const insetMulti = ref([])
  const validated = ref()
  const custom = ref([])
  const form = ref()

  const required = [(v: any) => {
    const files = Array.isArray(v) ? v : v ? [v] : []
    return files.length > 0 || 'File is required'
  }]

  async function onSubmit () {
    const { valid } = await form.value.validate()
    if (valid) alert('Form is valid!')
  }

  function onReset () {
    form.value.reset()
  }

</script>

<template>
  <v-app theme="dark">
    <v-container max-width="800">
      <h2 class="text-h5 mb-4">Single File (list below)</h2>
      <v-file-upload v-model="single" clearable show-size />

      <v-divider class="my-8" />

      <h2 class="text-h5 mb-4">Single File (inset)</h2>
      <v-file-upload v-model="insetSingle" clearable inset-file-list show-size />

      <v-divider class="my-8" />

      <h2 class="text-h5 mb-4">Multiple Files (list below)</h2>
      <v-file-upload v-model="multi" clearable multiple show-size />

      <v-divider class="my-8" />

      <h2 class="text-h5 mb-4">Multiple Files (inset)</h2>
      <v-file-upload v-model="insetMulti" clearable inset-file-list multiple show-size />

      <v-divider class="my-8" />

      <h2 class="text-h5 mb-4">Custom Default Slot (Multiple list below)</h2>
      <v-file-upload v-model="custom" multiple>
        <v-file-upload-dropzone>
          <template #default="{ isDragging, props }">
            <div class="d-flex flex-column align-center w-100 py-16 px-4">
              <v-icon
                class="mb-4"
                icon="$upload"
                size="48"
                style="opacity: var(--v-medium-emphasis-opacity);"
              />

              <div class="text-h5 font-weight-semibold">
                {{ isDragging ? 'Release to drop' : 'Drag and drop files here' }}
              </div>

              <div class="d-flex align-center my-8" style="width: 150px;">
                <v-divider />
                <span class="mx-4 text-medium-emphasis text-caption">or</span>
                <v-divider />
              </div>

              <v-btn size="large" variant="tonal" @click="props.onClick">
                Browse Files
              </v-btn>
            </div>
          </template>
        </v-file-upload-dropzone>
        <v-file-upload-list v-if="custom.length" :files="custom">
          <template #default="{ files, onClickRemove }">
            <v-file-upload-item
              v-for="(file, index) in files"
              :key="index"
              :file="file"
              clearable
              show-size
              @click:remove="onClickRemove(index)"
            />
          </template>
        </v-file-upload-list>
      </v-file-upload>

      <v-divider class="my-8" />

      <h2 class="text-h5 mb-4">Form Validation</h2>
      <v-form ref="form" @submit.prevent="onSubmit">
        <v-file-upload
          v-model="validated"
          :rules="required"
          clearable
          show-size
        />

        <div class="d-flex ga-4 mt-4">
          <v-btn color="primary" type="submit">Submit</v-btn>
          <v-btn variant="outlined" @click="onReset">Reset</v-btn>
        </div>
      </v-form>
    </v-container>
  </v-app>
</template>

@Haviles04 Haviles04 changed the title feat: break apart components and add default slot feat: Add default slot to v-file-upload and add prop Feb 21, 2026
@Haviles04 Haviles04 changed the title feat: Add default slot to v-file-upload and add prop feat: V-file-upload enhancements Feb 21, 2026
@Haviles04 Haviles04 marked this pull request as ready for review February 24, 2026 00:37
@J-Sek J-Sek added this to the v4.0.x milestone Mar 3, 2026
@johnleider johnleider added P: elite sponsor T: feature A new feature labs Must be completed for this component to leave labs labels Mar 3, 2026
- fix compact density
- fix form reset not propagating to file model
- fix dragleave flickering on child elements
- add missing examples and remove the boring ones
- add API descriptions
@J-Sek J-Sek dismissed johnleider’s stale review March 4, 2026 02:26

unlocking merge

@J-Sek J-Sek merged commit 027ab86 into master Mar 4, 2026
16 checks passed
@J-Sek J-Sek deleted the haviles04/v-file-upload-changes branch March 4, 2026 02:34
@J-Sek J-Sek changed the title feat: V-file-upload enhancements feat(VFileUpload): integrate VInput & split internal logic Mar 4, 2026
J-Sek pushed a commit that referenced this pull request Mar 4, 2026
- extract VFileUploadDropzone and VFileUploadList
- wrap in VInput for better VForm integration
- add inset-file-list prop
- add #single slot
- update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: VFileUpload labs Must be completed for this component to leave labs P: elite sponsor T: feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.12.1] Title slot is used both in the VFileUpload and nested VFileUploadItem

3 participants