--- title: File Picker layout: nested-component.html ---
Pretty input fields for files. Creates thumbnail previews for images, and shows common filetype icons for other files.
Add the class file-picker to a form-group to initialize this plugin without writing any Javascript.
Alternatively you can instantiate the plugin like this: $('.some-element').filePicker();.
Options can be defined as data-attributes, or as an object when instantiating in Javascript.
| Option | Default | Description |
|---|---|---|
| disablePreview | false |
Disables the image/file drag and drop zone. |
| filePatterns |
|
A list of file types and an associated regex test for the supported file extensions. You can see the default supported tests & icons here |
To instantiate the file-picker with a predefined file, you need to use either of the following data-attributes (but not both :-) )
| Attribute | Description |
|---|---|
| data-image | Will set the preview-image's src to the string defined in the data-attribute |
| data-file | Will set the preview-icon to a an icon matching a regex in the
filePatterns object, or a fallback icon
|
Loading...
NYI
Loading...
NYI
Loading...
NYI
Loading...
NYI
You can control the direction in which elements are rendered both vertically and horizontally by adding any combination of the following modifier classes.
| Class name | Description |
|---|---|
.file-picker--reverse |
Reverses the direction of the drop zone and the input field |
.file-picker--vertical |
Arranges the drop-zone and input in vertical |
Loading...
NYI
Loading...
NYI
Loading...
NYI
Controlling the size of the drop zone is as easy as adding an inline style to the .file-picker__zone.
Keep in mind that inline styling always wins. If you set the width of the drop-zone higher than its parent container, you will introduce scrolling.
Loading...
NYI