@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
44 lines (43 loc) • 2.17 kB
TypeScript
import React from 'react';
import { Factory } from '../../core';
export interface FileButtonProps<Multiple extends boolean = false> {
ref?: React.Ref<HTMLInputElement>;
/** Called when files are picked */
onChange: (payload: Multiple extends true ? File[] : File | null) => void;
/** Function that receives button props and returns react node that should be rendered */
children: (props: {
onClick: () => void;
}) => React.ReactNode;
/** If set, user can pick more than one file */
multiple?: Multiple;
/** File input accept attribute, for example, `"image/png,image/jpeg"` */
accept?: string;
/** Input name attribute */
name?: string;
/** Input form attribute */
form?: string;
/** Reference of the function that should be called when value changes to null or empty array */
resetRef?: React.Ref<() => void>;
/** Disables file picker */
disabled?: boolean;
/** Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. */
capture?: boolean | 'user' | 'environment';
/** Passes down props to the input element used to capture files */
inputProps?: React.ComponentProps<'input'>;
}
export type FileButtonFactory = Factory<{
props: FileButtonProps;
signature: <Multiple extends boolean = false>(props: FileButtonProps<Multiple>) => React.JSX.Element;
}>;
export declare const FileButton: (<Multiple extends boolean = false>(props: FileButtonProps<Multiple>) => React.JSX.Element) & import("../..").ThemeExtend<{
props: FileButtonProps;
signature: <Multiple extends boolean = false>(props: FileButtonProps<Multiple>) => React.JSX.Element;
}> & import("../..").ComponentClasses<{
props: FileButtonProps;
signature: <Multiple extends boolean = false>(props: FileButtonProps<Multiple>) => React.JSX.Element;
}> & Record<string, never> & import("../..").FactoryComponentWithProps<{
props: FileButtonProps;
signature: <Multiple extends boolean = false>(props: FileButtonProps<Multiple>) => React.JSX.Element;
}> & {
displayName?: string;
};