Skip to content

Commit c512f91

Browse files
dehlin1k0
authored andcommitted
Added ref to FileWidget. (rjsf-team#355)
1 parent 8ae5315 commit c512f91

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ const schema = {
378378

379379
> Note that storing large dataURIs into form state might slow rendering.
380380
381+
##### File widget input ref
382+
383+
The included `FileWidget` exposes a reference to the `<input type="file" />` element node as an `inputRef` component property.
384+
385+
This allows you to programmatically trigger the browser's file selector which can be used in a custom file widget.
386+
381387
### Object fields ordering
382388

383389
The `uiSchema` object spec also allows you to define in which order a given object field properties should be rendered using the `ui:order` property:

src/components/widgets/FileWidget.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class FileWidget extends Component {
100100
<div>
101101
<p>
102102
<input
103+
ref={ref => this.inputRef = ref}
103104
id={id}
104105
type="file"
105106
disabled={readonly || disabled}

0 commit comments

Comments
 (0)