Skip to main content

File List

v.5.0.0

Installation

yarn add @mercell/file-list-react

Usage

Using the File List is as simple as importing it like this.

import { FileList } from '@mercell/file-list-react';
Live Editor
Result

Types, definitions, etc.

FilesListProps
interface FileListProps {
id: string;
files: ListFile[];
actions?: FileAction[];
actionMenuLabel?: string;
selectAllLabel?: string;
getAllLabel?: (label: string) => string;
} & JSX.IntrinsicElements['table']
NameTypeDefaultRequiredDescription
idstring-yesUnique identifier
filesarray-yesArray of files
actionsarray-yesArray of functions for handler
actionMenuLabelstring-noLabel for action menu
selectAllLabelstring'Select all'noLabel text for select all checkbox
getAllLabelfunction-noOnly for cases where the labels passed inside action are not to be rendered. You can use this method to render a custom label from elsewhere
FileAction
interface FileAction {
label: string;
Icon: CarbonIconType;
schemeType: 'horizontal' | 'vertical';
handler: (files: File[]) => void;
className?: string;
}
NameTypeDefaultRequiredDescription
labelstring-yesActionMenu label
IconCarbonIconType-yesIcon for ActionMenu
schemeType'horizontal' | 'vertical'-yesAlignment for icon
handlerfunction-yesWhat happens on clicking the icon buttons
classNamefunction-noClass for ActionMenu