Skip to content
Sign upPro
Apps SDKFile picker widgetMenu

File picker widget (Pro)

ProIncluded in $99

Pick files from a connected drive without leaving the chat: folders, a path, search, and files the assistant can't read shown with the reason.

ProOpen Q3 planning, search, and pick up to five files. Video and design files stay muted with the reason.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/file-picker-widget

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { FilePickerWidget } from "@/components/ui/chatcn/pro/file-picker-widget"

<FilePickerWidget
  title="Google Drive"
  meta={["Connected as ana@team.co"]}
  entries={drive}
  accept={["doc", "sheet", "pdf"]}
  max={5}
  onAttach={(files) => readFiles(files)}
/>

Pass the drive as a tree of folders and files. Folders sort first and open with a slide from the end, going back slides from the start, and the path above walks back to any level; Alt with arrow up goes up one. Search looks through the folder you are in and everything under it. Each file shows its size, when it changed and who changed it, with a tint by kind so a column scans by type. Kinds outside accept stay in place, muted, with the reason, so nothing is silently missing; with max the rest lock once it is reached. The bar keeps the count and total size, and Attach turns the widget into the list of what was attached.

Examples

States

ProFiles picked, and the drive still opening.

Props

PropTypeNotes
entriesDriveEntry[]Folders { id, name, kind: "folder", children } and files { id, name, kind, size?, modified?, owner? }
acceptDriveFileKind[]Kinds the assistant can read. Default all
maxnumberMost files at once
defaultSelectedstring[]File ids
onAttach(files) => voidAttach
loadingbooleanWhile the drive connects
title, meta, localeHeader and formatting
labelsPartial<FilePickerWidgetLabels>Every string, for translation

Keyboard

KeyAction
TabThrough the path, search, then each row
SpacePick a file
EnterOpen a folder
Alt and arrow upUp one folder

Accessibility

  • Files are real checkboxes; unreadable ones are disabled and described by the reason.
  • The path is a navigation landmark with the current folder marked.
  • The count and size are a polite live region; attaching is announced.

Motion

Folders slide 16 px with a fade over 240 ms. Reduced motion swaps them in place.