@itwin/itwinui-react
Version:
A react component library for iTwinUI
34 lines (33 loc) • 1.37 kB
TypeScript
import * as React from 'react';
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
type FileUploadProps = {
/**
* Content shown over `children` when file is being dragged onto the component.
* Should always be used when drag content differs from `children` being wrapped.
*/
dragContent?: React.ReactNode;
/**
* Callback fired when files are dropped onto the component.
*
* The first argument is the `files` list, and the second argument is the underlying "drop" event.
*/
onFileDropped: (files: FileList, event: React.DragEvent) => void;
/**
* Component to wrap `FileUpload` around.
* Either pass `FileUploadCard` (for default state) or a different component to wrap.
*/
children: React.ReactNode;
/**
* Allows for custom prop to be passed for content.
*/
contentProps?: React.ComponentProps<'div'>;
};
/**
* File upload component to be wrapped around `FileUploadCard` or any arbitrary component.
* Provides support for dragging and dropping multiple files.
* @example
* <FileUpload onFileDropped={console.log}><FileUploadCard /></FileUpload>
* <FileUpload dragContent='Drop file here' onFileDropped={console.log}><Textarea /></FileUpload>
*/
export declare const FileUpload: PolymorphicForwardRefComponent<"div", FileUploadProps>;
export {};