UNPKG

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