Skip to content

File Trigger

Free

A button that opens the file picker and gives the picked files to the app, with no list and no checks.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 16, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put the icon and the words in FileTrigger as children. onSelect gets the picked files; your app checks and sends them.

import-contacts.tsx

FileTrigger

<button>
PropTypeDefaultDescription
classNamestring—
busybooleanfalseThe button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start""start"center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
onSelect—The picked files, after each pick (also the same file again). It does not run on a cancel.
onPickError—A pick that fails (a picker blocked in a cross-origin frame). Default: reportError.
acceptstring—The types the picker offers (accept of the file input): ".csv", "image/*", …
multiplebooleanfalseMore than one file in one pick. Default false.
directorybooleanfalseThe picker chooses a folder (webkitdirectory), and every file in it comes back.
capture"environment" | "user" | boolean—The camera on a phone (capture): "user" (front) or "environment" (back).
actionsRefRefObject<{ open: () => void; } | null>—Gets open: the picker, called in a user press (a menu item, a shortcut).
render—Another element to press instead of the Button: render={<MenuItem />} makes a menu item that opens the picker (a source menu). It gets the press and data-popup-open only.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
style—Style applied to the element, or a function that returns a style object based on the component's state.
nativeButtonbooleantrueWhether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Use onSelect to get the files.
  • Use accept, multiple, or directory for the pick.
  • Use render={<MenuItem />} to make a source menu item that opens the picker.
  • Use actionsRef to open the picker from a shortcut, in the press itself.
  • When the form must hold and show the files, use a File Input.
  • For a large drop area, use a Dropzone.
EnterorSpaceOpens the file picker.

It is a native <button>: Enter and Space open the picker.

An icon-only trigger needs an aria-label.

Press
press · 100ms · ease-out (0, 0, 0.2, 1) · the Button moves down 1px
Picker open
hover · 150ms · ease-out (0, 0, 0.2, 1) · the hover fill stays while the picker is open (`data-popup-open`)

Built with

Installs with File Trigger

Components
Button
  1. AddedFile Trigger, with Button.
Open the release