2.45.0 • Published 3 months ago

@vonage/vwc-file-picker v2.45.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

vwc-file-picker

vwc-file-picker is a composite component that enables to perform files selection on from the users environment.

vwc-file-picker allows to pick files either by opening a file selection dialog of the operating system, or via drag'n'drop of the file onto the component's surface.

Example:

<vwc-file-picker label="Avatar image" helper="select image of max 1Mb">
  <input type="file" name="some-file" />
</vwc-file-picker>

Structure

Structure - full example

vwc-file-picker's structure is quite flexible and customizable. In general we have the following particles:

  • label, text to appear above the component ('Pick your favorite' in the picture above)
  • helper message, textual hint with optional error icon; located below the component ('single file of any type' in the picture above)
  • drag'n'drop surface (the dashed area in the picture above)
  • drag'n'drop textual hint, which appears centered within the surface ('Drag & Drop files here' in the picture above)
  • button, triggering file input dialog

The component structure can be simple to rich, as following list (in the ascending order of complexity):

  • drag'n'drop surface only: only drag and drop files allowed here; can optionally add a textual hint via the dd-hint slot (see API slots section below):
    	```html
    	<vwc-file-picker label="Avatar image" helper="select image of max 1Mb">
    		<p slot="dd-hint">Drop the amazing files here!</p>
    		<input type="file" name="some-file" />
    	</vwc-file-picker>
    	```
  • button only: providing a custom vwc-button via the button slot (see API slots section below) and disabling drop zone (see API properties section below); the button then triggers the file input operating system dialog:
    	```html
    	<vwc-file-picker label="Avatar image" helper="select image of max 1Mb" drop-zone="false">
    		<vwc-button slot="button">Upload</vwc-button>
    		<input type="file" name="some-file" />
    	</vwc-file-picker>
    	```
  • drag'n'drop surface with button: this flavor has both, the drag'n'drop surface and the button; here, as well, the drag'n'drop hint text can be customized or removed:
    	```html
    	<vwc-file-picker label="Avatar image" helper="select image of max 1Mb">
    		<vwc-button slot="button">Upload</vwc-button>
    		<input type="file" name="some-file" />
    	</vwc-file-picker>
    	```

In addition to those major variations, there are the label and the helper message, mentioned above, which are customizable as well.

API

Properties

PropertyAttributeTypeDefaultDescription
labellabelstring''label text, if any
helperhelperstring''text to be shown in helper message in normal (non-errorneous) state
drop-zonebooleantrueattribute controlling whether the drop zone should be rendered or not
no-counterbooleanfalseattribute controlling whether counter badge should be always hidden
validationMessagevalidationmessagestring''text to be shown in helper message when component is in erroneous state, when empty, the component falls back to the default messages as below
notAFileErrornotafileerrorstring'only file/s drop allowed'text to be shown specifically when drag'n'drop of not-a-file attempted
tooManyFilesErrortoomanyfileserrorstring'only one file allowed'text to be shown specifically when multiple files droped while slotted input has no multiple attribute defined

Slots

Most of the slots below are for the customization purposes, but one of them, input-file-slot is essential, required and is worthy a special treatment here.

Thus, input-file-slot requires provision of the input element (native) from the consumer. This element MUST have type="file". This element MAY have name, multiple and accept attributes, all as specced out here. Moreover, consumer will use this, his own provided input, in order to listen to change events and/or take the file/s when needed.

NameRequiredDescription
dd-hinttextual hint for the drag'n'drop component
buttonbutton component to add to the components structure
input-file-slotyesinput element of type file that will be actually used as a file collector

CSS Custom Propertis

NameDefaultDescription
--vvd-file-picker-min-height140pxminimum height of the file picker
--vvd-file-picker-min-width320pxminimum width of the file picker
2.45.0

3 months ago

2.44.0

8 months ago

2.43.0

10 months ago

2.43.2

9 months ago

2.43.1

10 months ago

2.41.0

11 months ago

2.42.0

11 months ago

2.38.0

1 year ago

2.37.2

1 year ago

2.40.0

1 year ago

2.39.1

1 year ago

2.39.0

1 year ago

2.37.0

1 year ago

2.36.3

1 year ago

2.36.2

1 year ago

2.36.0

2 years ago

2.36.1

2 years ago

2.35.0

2 years ago

2.34.0

2 years ago

2.34.1

2 years ago

2.33.1

2 years ago

2.33.0

2 years ago

2.32.0

2 years ago

2.31.0

2 years ago

2.29.0

2 years ago

2.30.2

2 years ago

2.30.1

2 years ago

2.30.3

2 years ago

2.30.0

2 years ago

2.28.1

2 years ago

2.28.0

2 years ago

2.28.2

2 years ago

2.27.1

2 years ago

2.27.0

2 years ago

2.26.0

2 years ago

2.25.10

2 years ago

2.25.9

2 years ago

2.25.8

2 years ago

2.25.7

2 years ago

2.25.6

2 years ago

2.25.5

2 years ago

2.25.3

2 years ago

2.25.2

2 years ago

2.25.1

2 years ago

2.25.0

2 years ago

2.24.1

2 years ago

2.24.0

2 years ago

2.23.0

2 years ago

2.22.1

3 years ago

2.22.0

3 years ago

2.21.1

3 years ago

2.21.0

3 years ago

2.20.1

3 years ago

2.20.0

3 years ago

2.19.0

3 years ago

2.18.1

3 years ago

2.18.0

3 years ago

2.17.0

3 years ago

2.16.1

3 years ago

2.16.0

3 years ago

2.15.0

3 years ago

2.14.0

3 years ago

2.13.0

3 years ago

2.12.0

3 years ago

2.11.0

3 years ago

2.10.0

3 years ago

2.9.1

3 years ago

2.9.0

3 years ago

2.8.0

3 years ago

2.7.0

3 years ago

2.6.2

3 years ago

2.6.1

3 years ago

2.6.0

3 years ago

2.5.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.19.1

3 years ago

0.19.0

3 years ago

0.18.0

3 years ago

0.17.2

3 years ago

0.17.1

3 years ago

0.17.0

3 years ago

0.16.2

3 years ago

0.16.1

3 years ago

0.16.0

3 years ago

0.15.3

3 years ago

0.15.2

3 years ago

0.15.1

3 years ago

0.15.0

4 years ago

0.14.0

4 years ago