Skip to content

File picker API

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

The ref type for this component.

UNSTABLE_FilePickerProps
isDisabled boolean

Whether the field is disabled.

isRequired boolean

Whether the field is required.

isInvalid boolean

Whether the field is invalid.

acceptedFileTypes string[]

The allowed file types that can be selected.

allowsMultiple boolean

Whether multiple files can be selected.

onSelect (files: null | File[]) => void

Handler called when files are selected.

id string

The element's unique identifier. See MDN.

data-cim-style-root boolean

Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.

UNSAFE_className string

Sets the CSS className for the element. Only use as a last resort. Use style props instead.

See styling guide.

UNSAFE_style CSSProperties

Sets the CSS style for the element. Only use as a last resort. Use style props instead.

See styling guide.

label string

The content to display as the label.

aria-labelledby string

Identifies the element (or elements) that labels the current element.

aria-describedby string

Identifies the element (or elements) that describes the object.

aria-details string

Identifies the element (or elements) that provide a detailed, extended description for the object.

name string

The name of the input element, used when submitting an HTML form. See MDN.

description string

A description for the field. Provides a hint such as specific requirements for what to choose.

error FieldError

An error message for the field.

validate (value: File[]) => undefined | string | true | string[]

A function that returns an error message (or true) if a given value is invalid. Validation errors are displayed to the user when the form is submitted. For real-time validation, use the error prop instead.

defaultCamera 'user' | 'environment'

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

acceptDirectory boolean

Enables the selection of directories instead of individual files.

StyleProps
margin Responsive<Spacing | "auto">

The amount of margin applied to all edges of this component.

marginX Responsive<Spacing | "auto">

The amount of margin applied to the left and right edges of this component. Takes priority over margin.

marginY Responsive<Spacing | "auto">

The amount of margin applied to the top and bottom edges of this component. Takes priority over margin.

marginTop Responsive<Spacing | "auto">

The amount of margin applied to the top edge of this component. Takes priority over marginY and margin.

marginRight Responsive<Spacing | "auto">

The amount of margin applied to the right edge of this component. Takes priority over marginX and margin.

marginBottom Responsive<Spacing | "auto">

The amount of margin applied to the bottom edge of this component. Takes priority over marginY and margin.

marginLeft Responsive<Spacing | "auto">

The amount of margin applied to the left edge of this component. Takes priority over marginX and margin.