@carbon/react
Version:
React components for the Carbon Design System
88 lines (87 loc) • 2.56 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { type HTMLAttributes } from 'react';
export interface FileUploaderProps extends HTMLAttributes<HTMLSpanElement> {
/**
* Specify the types of files that this input should be able to receive
*/
accept?: string[];
/**
* Specify the type of the `<FileUploaderButton>`
*/
buttonKind?: 'primary' | 'secondary' | 'danger' | 'ghost' | 'danger--primary' | 'danger--ghost' | 'danger--tertiary' | 'tertiary';
/**
* Provide the label text to be read by screen readers when interacting with
* the `<FileUploaderButton>`
*/
buttonLabel?: string;
/**
* Provide a custom className to be applied to the container node
*/
className?: string;
/**
* Specify whether file input is disabled
*/
disabled?: boolean;
/**
* Specify the status of the File Upload
*/
filenameStatus: 'edit' | 'complete' | 'uploading';
/**
* Provide a description for the complete/close icon that can be read by screen readers
*/
iconDescription?: string;
/**
* Specify the description text of this `<FileUploader>`
*/
labelDescription?: string;
/**
* Specify the title text of this `<FileUploader>`
*/
labelTitle?: string;
/**
* Specify if the component should accept multiple files to upload
*/
multiple?: boolean;
/**
* Provide a name for the underlying `<input>` node
*/
name?: string;
/**
* Provide an optional `onChange` hook that is called each time the input is
* changed
*/
onChange?: (event: any) => void;
/**
* Provide an optional `onClick` hook that is called each time the
* FileUploader is clicked
*/
onClick?: (event: any) => void;
/**
* Provide an optional `onDelete` hook that is called when an uploaded item
* is removed
*/
onDelete?: (event: any) => void;
/**
* Specify the size of the FileUploaderButton, from a list of available
* sizes.
*/
size?: 'sm' | 'small' | 'md' | 'field' | 'lg';
}
export interface FileUploaderHandle {
/**
* Clear internal state
*/
clearFiles: () => void;
}
declare const FileUploader: {
<ItemType>(props: FileUploaderProps): React.ReactElement<any>;
propTypes?: any;
contextTypes?: any;
defaultProps?: any;
};
export default FileUploader;