File
You can use the File
to handle file inputs. It supports single and multiple files.
Prop | Type | Default | Description |
---|---|---|---|
name | string | - | The name of the field. |
label | string | undefined | null | ”Drag and drop a file here, or click to select a file to upload.” | The label of the field. |
context | string | ”form” | The context of the form. |
id | string | undefined | null | null | The id of the field. |
dragable | boolean | true | If the field is dragable. |
multiple | boolean | false | If the field is multiple. |
disabled | boolean | false | If the field is disabled. |
accept | string | ”image/*“ | The accept of the field. |
max | number | Infinity | The max size of each file. |
styles | FileStyles | {} | The styles of the field. |
clearOnDestroy | boolean | false | Clear the field value when the component is destroyed. |
Slot | Prop | Description | Available to |
---|---|---|---|
default | - | Customize the label of the field. | all |
preview | { cover: { src: string; alt: string; } | null; file: File; } | Customize the preview of the field. | all |
remove | - | Customize the remove icon. | all |
retry | - | Customize the retry action. | all |
error | { error: string | null } | Show an error message. | all |
Name | Type | Description |
---|---|---|
choose | (file: File | File[]) => void | The event emitted when the user choose a file. |
remove | () => void | The event emitted when the user remove a file. |