-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathREADME.md
66 lines (43 loc) · 1.59 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# FormFileUpload
## Usage
```jsx
import { FormFileUpload } from '@wordpress/components';
const MyFormFileUpload = () => (
<FormFileUpload
accept="image/*"
onChange={ ( event ) => console.log( event.target.files ) }
>
Upload
</FormFileUpload>
);
```
## Props
The component accepts the following props. Props not included in this set will be passed to the `Button` component.
### accept
A string passed to `input` element that tells the browser which file types can be upload to the upload by the user use. e.g: `image/*,video/*`.
More information about this string is available in https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers.
- Type: `String`
- Required: No
### children
Children are passed as children of `Button`.
- Type: `Boolean`
- Required: No
### icon
The icon to render. Supported values are: Dashicons (specified as strings), functions, WPComponent instances and `null`.
- Type: `String|Function|WPComponent|null`
- Required: No
- Default: `null`
### multiple
Whether to allow multiple selection of files or not.
- Type: `Boolean`
- Required: No
- Default: `false`
### onChange
Callback function passed directly to the `input` file element.
- Type: `Function`
- Required: Yes
### render
Optional callback function used to render the UI. If passed the component does not render any UI and calls this function to render it.
This function receives an object with the property `openFileDialog`. The property is a function that when called opens the browser window to upload files.
- Type: `Function`
- Required: No