File Trigger

A FileTrigger allows a user to access the file system with any pressable React Aria or React Spectrum component, or custom components built with usePress.

Installation

npx shadcn add https://hq-ui.vercel.app/r/nova/file-trigger

Preview

Examples

Folder

A FileTrigger that allows users to select a folder from the file system.

file-trigger-folder-example

Multiple

A FileTrigger that enables users to select multiple files.

file-trigger-multiple-example

Camera

A FileTrigger that lets users capture images using their device's camera.

file-trigger-camera-example

Avatar

A FileTrigger that allows users to select an avatar from their file system. It integrates components like avatar and drop-zone, enabling users to either drag and drop or manually select a file.

This how you can use the FileTrigger combined with an Avatar component.

file-trigger-avatar-example

Pending

A FileTrigger can indicate a pending state using the isPending prop. This provides feedback for actions that take time, communicates the status to assistive technologies, and disables interactions except for focus.

file-trigger-pending-example

Controlled

You can use the onSelect prop to snag the selected files.

file-trigger-controlled-example

Disabled

A FileTrigger that is disabled.

file-trigger-disabled-example

API Reference

FileTrigger

The FileTrigger component opens the system file picker from a styled trigger.

PropTypeDefault
classNamestring-
variant"default" | "outline" | "ghost" | "destructive" | "secondary" | "link""default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"
isDisabledboolean-
isPendingboolean-