UNPKG

2.25 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent } from "../../common";
3import { Props } from "../../common/props";
4export interface FileInputProps extends React.LabelHTMLAttributes<HTMLLabelElement>, Props {
5 /**
6 * Whether the file input is non-interactive.
7 * Setting this to `true` will automatically disable the child input too.
8 */
9 disabled?: boolean;
10 /**
11 * Whether the file input should take up the full width of its container.
12 */
13 fill?: boolean;
14 /**
15 * Whether the user has made a selection in the input. This will affect the component's
16 * text styling. Make sure to set a non-empty value for the text prop as well.
17 *
18 * @default false
19 */
20 hasSelection?: boolean;
21 /**
22 * The props to pass to the child input.
23 * `disabled` will be ignored in favor of the top-level prop.
24 * `type` will be ignored, because the input _must_ be `type="file"`.
25 * Pass `onChange` here to be notified when the user selects a file.
26 */
27 inputProps?: React.HTMLProps<HTMLInputElement>;
28 /**
29 * Whether the file input should appear with large styling.
30 */
31 large?: boolean;
32 /**
33 * Callback invoked on `<input>` `change` events.
34 *
35 * This callback is offered as a convenience; it is equivalent to `inputProps.onChange`.
36 *
37 * __Note:__ The top-level `onChange` prop is passed to the `<label>` element rather than the `<input>`,
38 * which may not be what you expect.
39 */
40 onInputChange?: React.FormEventHandler<HTMLInputElement>;
41 /**
42 * Whether the file input should appear with small styling.
43 */
44 small?: boolean;
45 /**
46 * The text to display inside the input.
47 *
48 * @default "Choose file..."
49 */
50 text?: React.ReactNode;
51 /**
52 * The button text to display on the right side of the input.
53 *
54 * @default "Browse"
55 */
56 buttonText?: string;
57}
58/**
59 * File input component.
60 *
61 * @see https://blueprintjs.com/docs/#core/components/file-input
62 */
63export declare class FileInput extends AbstractPureComponent<FileInputProps> {
64 static displayName: string;
65 static defaultProps: FileInputProps;
66 render(): JSX.Element;
67 private handleInputChange;
68}