Skip to content

Components

FileTrigger

Component reference

Properties

Use FileTrigger

A button or icon action that hands newly picked files to the application.

Example import style
file-trigger.tsxTSX
"use client";

import { FloodRoot, FileTrigger } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <FileTrigger label="Attach files" multiple onFilesSelect={(files) => appendAttachments(files)} />
    </FloodRoot>
  );
}

Design notes

  • Use for a host-owned attachment queue, import action or image picker. FileInput is the corresponding field for native FormData submission.
  • Each nonempty pick sends a fresh File array. Cancel is quiet and repeated picks of the same file work. The hidden native input is cleared after each pick.
  • Use trigger to compose a named Button or IconButton with the supplied props. accept and capture configure the browser chooser. The host checks the selected content and owns processing.

API reference

PropValuesDefault
labelstringRequired
onFilesSelect(files: File[]) => voidRequired
trigger(props: FileTriggerControlProps) => ReactNode—
Native HTML propsPick<InputHTMLAttributes<HTMLInputElement>, "accept" | "capture" | "multiple" | "disabled">Forwarded
View TypeScript source