File Trigger

Loading...

Installation

Add the component with the CLI.

npx shadcn@latest add @intentui/file-trigger

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Install the dependencies, then copy the component source into your project.

npm install react-aria-components @heroicons/react tailwind-variants

Anatomy

import { FileTrigger } from "@/components/ui/file-trigger"

<FileTrigger />

Examples

Folder

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

Loading...

Multiple

A FileTrigger that enables users to select multiple files.

Loading...

Camera

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

Loading...

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.

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Combine FileTrigger with Avatar to select a profile image.

Loading...

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.

Loading...

Circle

Use a circular trigger button.

Loading...

Controlled

Use onSelect to receive the selected files.

Loading...

Disabled

Set isDisabled to prevent file selection.

Loading...

Component API

FileTrigger

FileTrigger extends the React Aria Components <FileTrigger> component.

classNamestring
intent"primary" | "secondary" | "warning" | "danger" | "success" | "outline" | "plain"
Default: outline
isCircletrue | false
Default: false
isDisabledboolean
isPendingboolean
size"xs" | "sm" | "md" | "lg" | "sq-xs" | "sq-sm" | "sq-md" | "sq-lg"
Default: md

See the React Aria for the full API reference.

Design