Skip to content

useFilepond ​

Sets up FilePond upload props and derives validation rules from the component's schema and prop values. Used internally by VInputFilepond and VInputFilepondAvatar.

File: vue/src/js/hooks/useFilepond.js
Props factory: makeFilepondProps


Usage ​

js
import { useFilepond, makeFilepondProps } from '@/hooks'

const props = defineProps({ ...makeFilepondProps() })
const { filepondRules, max } = useFilepond(props, context)
html
<file-pond
  :max-files="max"
  :rules="filepondRules"
  ...
/>

Props (via makeFilepondProps) ​

PropTypeDefaultDescription
maxFilesNumber2Maximum number of files
minNumber—Minimum required files
rulesArray[]Additional validation rules
noRulesBooleanfalseSkip rule injection
endPointsObject{}FilePond server endpoint config
acceptedFileTypesString''Comma-separated MIME types
allowImagePreviewBooleanfalseEnable image preview plugin
allowMultipleBooleanfalseAllow multiple file uploads
allowProcessBooleantrueAuto-upload on file add
allowRemoveBooleantrueAllow file removal
allowDropBooleantrueAllow drag-to-drop upload
allowReorderBooleanfalseAllow drag to reorder files
allowReplaceBooleanfalseReplace file on re-upload
allowFileSizeValidationBooleantrueEnable file size validation
maxFileSizeString'5MB'Maximum single file size
minFileSizeString'1KB'Minimum single file size
maxTotalFileSizeStringnullMaximum total upload size
hintStringnullHelper text
hideDetailsBooleanfalseHide error/hint details
disabledBooleanfalseDisable the input
labelWeightString'regular'Label font weight
subtitleStringnullSubtitle text
subtitleWeightString'thin'Subtitle font weight
hintWeightString'thin'Hint font weight

Returns ​

NameTypeDescription
filepondRulesRef<Array>Computed validation rule array (includes a required rule if min is set and the input is creatable/editable)
maxRef<Number>Effective max files (clamped to be ≥ min, minimum 5 if zero)

Rule injection logic ​

When min > 0 and noRules is false and the input is in create/edit mode, a required:array:{min} rule is automatically prepended to filepondRules.

See Also ​