Skip to content

File trigger

Pro

Makes any library button open the file picker, or the camera on phones; useFileTrigger does it from a menu item. Not an M3 component (@windmorph/react-pro).

import { FileTrigger, useFileTrigger } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Playground

Nothing chosen yet.

Code

import { Button } from '@windmorph/react';import { FileTrigger } from '@windmorph/react-pro'; <FileTrigger  accept={['image/*', '.pdf']}  onFileAccept={(files) => console.log(files)}>  <Button variant="tonal">Choose files</Button></FileTrigger>

Examples

Buttons, the camera and a tooltip

From a menu item (useFileTrigger)

A folder, or several documents