Skip to content

File trigger API

Allows a user to access the file system with any pressable Cimpress UI component. The component doesn’t provide built-in UI for displaying selected files, it offers an onSelect callback that provides the selected FileList, allowing you to build custom file previews or upload interfaces.

import { FileTrigger } from '@cimpress-ui/react';
ref Ref<HTMLInputElement>

The ref type for this component.

FileTriggerProps
acceptedFileTypes readonly string[]

Specifies what mime type of files are allowed.

allowsMultiple boolean

Whether multiple files can be selected.

defaultCamera 'user' | 'environment'

Specifies the use of a media capture mechanism to capture the media on the spot.

onSelect (files: null | FileList) => void

Handler when a user selects a file.

children ReactNode

The children of the component.

acceptDirectory boolean

Enables the selection of directories instead of individual files.