Skip to content

File Input

EFileInput is a commonly used feature in web development allowing users to select and attach one or multiple files in a web application. Demo Here

Usage

vue

<template>
  <EFileInput v-model="value" label="Upload your file"/>
</template>

<script setup>
  const value = ref([]);
</script>

Props

For EFileInput component, the following props are available:

PropTypeDefaultNote
labelString-Component's label
idString-HTML id attribute.
modelValueArray-Value of input element.
disabledBooleanfalseDisables the EFileInput.
chipsBooleanfalseDisplays selected file(s) as chips.
messageString-Adds a message below the file input.
heightString-Sets the component's height.
variantString"fill"The EFileInput element can be represented in four ways: fill and border.
showSizeBooleanfalseDisplays the size of selected file(s).
validateOnString"input"Triggers validation on @values: submit, input.
nameString-HTML name attribute.
acceptArray-Specifies the file types that the input field can accept.
requiredBooleanfalseIndicates that the user must specify a value for the input.
rulesArray-Validation rules. For more info refer to Form Validation.
sizeString"md"The EFileInput element has three predefined sizes: sm, md, lg.
multipleBooleanfalseThe multiple property allows more than one item to be selected at the same time.
colorString"primary"The given color is applied to the element - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
stateString-Validates the user-provided data against established criteria and performs display validation. States can be none if no validation is necessary, danger if the selected file is valid, or success if it is acceptable.
appendIconObject-Inserts a custom EIcon element to the file input that is located after the input value. More Info here.
prependIconObject-Inserts a custom EIcon element to the file input that is located before the input value. More Info here.
squareBooleanfalseRemoves rounded corners of the element.

Emits

The EFileInput component contains following emits.

EmitDescription
update:modelValueControls the selected file(s).
inputIt binds to the component's input event.
changeIt binds to the component's onchange event.
blurIt binds to the component's onblur event.
removeEmitted when the remove file icon is clicked.
appendIconClickEmitted when the append icon is clicked.
prependIconClickEmitted when the prepend icon is clicked.

COPYRIGHT