---
title: File Search
description: A search box that streams matching keys with switchable match modes — driven by useFiles.
---

Streams [`search()`](/api/search) results into a list. Switch between substring, glob, regex and exact matching, toggle case sensitivity, and the previous search is aborted the moment a new one starts.

<ComponentPreview name="file-search/file-search-basic" />

## Installation

<ComponentInstall name="file-search" />

## Usage

```tsx lineNumbers
import { useFiles } from "files-sdk/react";

import { FileSearch } from "@/components/files-sdk/file-search";

export function Search() {
  const files = useFiles({ endpoint: "/api/files" });

  return (
    <FileSearch
      files={files}
      prefix="docs/"
      defaultMatch="glob"
      onSelect={(file) => console.log(file.key)}
    />
  );
}
```

Matching runs over keys, not contents — the same four modes [`search()`](/api/search) exposes. Scope a search with `prefix` to keep it cheap on large buckets, and `maxResults` caps how many matches are collected per run.

## Props

<AutoTypeTable
  path="registry/files-sdk/file-search/file-search.tsx"
  name="FileSearchProps"
/>
