@highlight-ui/file-management
v4.2.11
Published
This is file management package consisting of file uploader and file list
Downloads
2,168
Maintainers
Keywords
Readme
@highlight-ui/file-management
Installation
Using npm:
npm install @highlight-ui/file-management
Using yarn:
yarn add @highlight-ui/file-management
Using pnpm:
pnpm install @highlight-ui/file-management
In your (S)CSS file:
@import url('@highlight-ui/file-management');
Once the package is installed, you can import the library:
import { FileUploader, FileList } from '@highlight-ui/file-management';
Usage
import React, { useState } from 'react';
import { FileUploader, FileList } from '@highlight-ui/file-management';
export default function FileManagementExample() {
return (
<>
<FileUploader
disabled={false}
description="Drag and drop files here or click to upload"
maxFileSize={20840}
onDrop={handleDrop}
onDragOverText="Drop here!"
showIcon
title="Primary text"
image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAoCAYAAABXRRJPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAVSSURBVHgB7VhbTCNVGP6nF6il7EyRW7HQ4Q4LhVm5hIuRJsSoUeM2PK36sNEnTXzkwRgN2RfxQdf4SEwkPviwWSOo8XGtGldEIGVBlO4uHYgWdrO47bZAodMZzz+2TYfOwCoYJxu+ZDLn/Gdy5nznP//tAJxAH6AOGuzp6WEFQWC1xmdmZnygA5i0Brq6urhV7+sXhYfL+aTZwtVbBfKxGLYKuzyOLy/dmHeXu5iFrz6bgGOEx+OBeDzOJhIJrr+/31VWVsYlk0lucnJyXJKkiCiKYfKZz+/3hw8lceuJl863P9bpGXOswPr6umKs0GaFWwP98MKnpX74FySyF0q6DEVRXG1trctisXBut5utqKgAm80GhYWF8veNjY3Q2to64vV6wysrK8GhoSGeiP2HkpDyLEyVRYRYdAfWNzaVg+UAtEMESkywnZ2dHq05yK6xZIF0srCouvl0Ez3Q1sLSNM0WFxczdrud2b/Yg4DfI+GamhqXwWDg7osE4us7+VDlbABoagDaJEE0tgP5G0HgN7ZgLbgILqOBKT/36seO2zdgJbTBOu00WEvKobnKCbTZAA6HQ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woeCj4C8YKXdUXCboURIs1R65JAs+b+d4dXdUXxA1JW3XtORureXmG0bvr/dfaV8+PjAgFtJcit9GkhGUUbwz7ohghwYWGo0PKtFJzUoIg1zeUJN6lxGTYFNu8Vrj4o5iE/dwOAGaJ5KaaAZ1hamqKhxOc4AQPNv4CL98fSS/xcLcAAAAASUVORK5CYII="
/>
<FileList files={files} />
</>
);
}
Props 📜
FileUploader
| Prop | Type | Required | Default | Description |
| :--------------- | :---------------------------------------------------------------- | :------- | :------ | :------------------------------------------------------------------------------------------------------ |
| description
| string
| Yes | | Allows providing the description message which is shown on the uploader |
| onDragOverText
| string
| Yes | | Allows providing a text to be shown when dragging over the uploader |
| onDrop
| (acceptedFiles: File[], rejectedFiles: FileRejection[]) => void
| Yes | | Allows providing a callback for when drop event occurs |
| accept
| string
| No | | Allows providing a list of supported file extensions |
| multiple
| boolean
| No | true
| Allows user to select multiple files or restrict it to only single file |
| className
| string
| No | | Allows providing a custom class name |
| disabled
| boolean
| No | false
| Allows disabling the uploader |
| image
| string
| No | | Allows providing an image for the uploader, this value will be passed to src attribute of the image tag |
| maxFileSize
| number
| No | | Allows providing the maximum file size supported by the uploader |
| showIcon
| boolean
| No | true
| Allows showing or hiding the image |
| title
| string
| No | | Allows providing a title to be shown for the uploader |
| onDragEnter
| () => void
| No | | Allows providing a callback for when dragenter event occurs |
| onDragLeave
| () => void
| No | | Allows providing a callback for when dragleave event occurs |
| onDragOver
| () => void
| No | | Allows providing a callback for when dragover event occurs |
FileList
| Prop | Type | Required | Default | Description |
| :---------- | :------------------------ | :------- | :-------- | :------------------------------------------------------------------------------------------------------- |
| files
| FileListItem[]
| Yes | | A list of files. See FileListItem
definition below. |
| className
| string
| No | | Allows providing a custom class name |
| onDelete
| (id) => void
| No | | Allows providing a callback for when deleting a file |
| variant
| 'default', 'selectable'
| No | default
| The FileList variant. When selectable
, users can provide addition props selectedItems
and onSelect
|
FileListItem
| Prop | Type | Required | Default | Description |
| :------------------ | :-------------------------------------------- | :------- | :------ | :-------------------------------------- |
| id
| string
| Yes | | List item unique id |
| filename
| string
| Yes | | List item file name |
| canDelete
| boolean
| No | false
| Can this item be deleted |
| downloadUrl
| string
| No | | The download url of the list item |
| previewUrl
| string
| No | | The preview url of the list item |
| validationStatus
| "valid", "validating", "invalid", "warning"
| No | | The validation status of the list item |
| validationMessage
| string
| No | | The validation message of the list item |
Contributing 🖌️
Please visit personio.design for usage guidelines and visual examples.
If you're interested in contributing, please visit our contribution page.