File picker API
Import
Section titled “Import”import { UNSTABLE_FilePicker } from '@cimpress-ui/react';File picker can integrate with native HTML forms. See our forms guide to learn how to work with forms.
API reference
Section titled “API reference”- Ref<HTMLDivElement>
The
reftype for this component.
UNSTABLE_FilePickerProps
- boolean
isDisabled
Section titled “isDisabled” Whether the field is disabled.
- boolean
isRequired
Section titled “isRequired” Whether the field is required.
- boolean
isInvalid
Section titled “isInvalid” Whether the field is invalid.
- string[]
acceptedFileTypes
Section titled “acceptedFileTypes” The allowed file types that can be selected.
- boolean
allowsMultiple
Section titled “allowsMultiple” Whether multiple files can be selected.
- (files: File[] | null) => void
onSelect
Section titled “onSelect” Handler called when files are selected.
- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
- string
The content to display as the label.
- string
aria-labelledby
Section titled “aria-labelledby” Identifies the element (or elements) that labels the current element.
- string
aria-describedby
Section titled “aria-describedby” Identifies the element (or elements) that describes the object.
- string
aria-details
Section titled “aria-details” Identifies the element (or elements) that provide a detailed, extended description for the object.
- string
The
<form>element to associate the input with. The value of this attribute must be the id of a<form>in the same document. See MDN.- string
The name of the input element, used when submitting an HTML form. See MDN.
- string
description
Section titled “description” A description for the field. Provides a hint such as specific requirements for what to choose.
- FieldError
An error message for the field.
- (value: File[]) => string | true | string[] | undefined
validate
Section titled “validate” 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 theerrorprop instead.- 'user' | 'environment'
defaultCamera
Section titled “defaultCamera” Specifies the use of a media capture mechanism to capture the media on the spot.
- boolean
acceptDirectory
Section titled “acceptDirectory” Enables the selection of directories instead of individual files.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “margin” The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “marginX” The amount of margin applied to the left and right edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginY
Section titled “marginY” The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginTop
Section titled “marginTop” The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginRight
Section titled “marginRight” The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin.- Responsive<Spacing | "auto">
marginBottom
Section titled “marginBottom” The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginLeft
Section titled “marginLeft” The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.