1.0.4 • Published 7 months ago

@craydel/craydel-file-input v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

CraydelFileInput

Installation

Get the latest version by NPM:

$ npm i @craydel/craydel-file-input

Register Plugin

If you use the plugin API, the component will be registered as a global component just like when including it with the script tag, but you won't need to re-register it through the components property in your own components.

Create the plugin file e.g craydel-components.js file.

// craydel-components.js
import Vue from 'vue'
import CraydelFileInput from '@craydel/craydel-file-input/src/CraydelFileInput.vue'

const Components = {
  CraydelFileInput,
};

Object.keys(Components).forEach(name => {
  Vue.component(name, Components[name]);
});

export default Components;

Next reference the plugin file in your nuxt.config.js

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
  '~/plugins/craydel-components.js'
]

Props

NameTypeDefaultDescription
idstringrandom IDSets the DOM id on the component.
acceptstringallFile types the file input should accept.
placeholderstring'Attach file'Sets the component's placeholder text.
is-requiredbooleanfalsePuts component in a required state.
required-errorstring'Field is required'Puts the component in an error state and passes through the custom required error message.
multiplebooleanfalseAdds the multiple attribute to the input, allowing multiple file selections.
hintstringundefinedHint text.
no-validationbooleanfalseRemoves the validation styling from the component.
disabledbooleanfalseDisables the component.
loadingboolean | stringfalseDisplays linear progress bar. Can either be a String which specifies which color is applied to the progress bar (any material color or theme color - primary, secondary, success, info, warning, error) or a Boolean which uses the primary color.
counterbooleanfalseCreates counter for number of files and total file size.

Usage

An example showing a file input that accepts images with multiple file selections.

<craydel-file-input accept="image/*" multiple></craydel-file-input>
1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago