Skip to content

useFileDialog ​

Category
Browser

Hook to handle file input

typescript
import { useFileDialog } from '@siberiacancode/reactuse';

Usage ​

typescript
const { values, open, reset } = useFileDialog((value) => console.log(value));

Demo ​

Api ​

Parameters

NameTypeDefaultNote
callback(value: FileList | null) => void-The callback to execute when a file is selected
options.multiple?booleantrueWhether multiple files can be selected
options.accept?string'*'The accepted file types
options.reset?booleanfalseWhether the input should be reset when the callback is called
options.capture?string-The capture value

Parameters

NameTypeDefaultNote
options.multiple?booleantrueWhether multiple files can be selected
options.accept?string'*'The accepted file types
options.reset?booleanfalseWhether the input should be reset when the callback is called
options.capture?string-The capture value

Contributors ​

Source • Demo