# @apideck/file-picker

> A React file picker component that works with the Apideck [File Storage API](https://developers.apideck.com/apis/file-storage/reference).

Latest version **1.0.3** (published 2023-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @apideck/file-picker
pnpm add @apideck/file-picker
yarn add @apideck/file-picker
bun add @apideck/file-picker
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-01-31 |
| First published | 2021-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 7 |
| Unpacked size | 961.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jake Prins |
| Maintainers | brahimmouhamou, gdewilde, geertwille, jakeprins, nicklloyd, eliasmeire, trinix |

## Links

- npm: https://www.npmjs.com/package/@apideck/file-picker
- npm.io page: https://npm.io/package/@apideck/file-picker

## Dependencies (7)

- [swr](https://npm.io/package/swr.md) ^1.0.1
- [react-table](https://npm.io/package/react-table.md) ^7.7.0
- [react-dropzone](https://npm.io/package/react-dropzone.md) ^11.4.2
- [react-waypoint](https://npm.io/package/react-waypoint.md) ^10.1.0
- [@apideck/vault-js](https://npm.io/package/@apideck/vault-js.md) ^1.1.2
- [@headlessui/react](https://npm.io/package/@headlessui/react.md) ^1.7.8
- [isomorphic-unfetch](https://npm.io/package/isomorphic-unfetch.md) ^3.1.0

## Recent versions

- 1.0.3 (latest) — 2023-01-31
- 0.1.5-0 (beta) — 2021-09-14
- 1.0.2 — 2023-01-30
- 1.0.1 — 2023-01-19
- 1.0.0 — 2023-01-19
- 0.7.0 — 2022-01-13
- 0.6.0 — 2021-12-17
- 0.5.1 — 2021-12-07
- 0.5.0 — 2021-12-07
- 0.4.0 — 2021-09-30
- 0.3.2 — 2021-09-29
- 0.3.1 — 2021-09-29
- 0.3.0 — 2021-09-29
- 0.2.2 — 2021-09-24
- 0.2.1 — 2021-09-24
- … 15 more at https://npm.io/package/@apideck/file-picker/versions

## README

# Apideck File Picker

A React file picker component that works with the Apideck [File Storage API](https://developers.apideck.com/apis/file-storage/reference).

Sign up for a free account at [apideck.com](https://app.apideck.com/signup) to obtain an API key and App ID.

## Usage

Install the component

```sh
yarn add @apideck/file-picker
```

Create a [Vault session](https://developers.apideck.com/apis/vault/reference#operation/sessionsCreate) inside your application to get a JSON Web Token.

Pass the JWT together with your App ID and a consumer ID to the FilePicker component

```js
import { FilePicker } from '@apideck/file-picker'
import '@apideck/file-picker/dist/styles.css'

const MyComponent = () => {
  const handleSelect = (file) => {
    console.log(file)
  }

  return (
    <FilePicker
      onSelect={handleSelect}
      trigger={<button>Pick a file</button>}
      token="<session-token>"
    />
  )
}
```

You can also provide a file through the `fileToSave` prop that will force the FilePicker to go into "Upload" mode. This will allow the user to select the connector and folder that the file needs to get saved to.

### Properties

| Property           | Type    | Required | Default             | Description                                                           |
| ------------------ | ------- | -------- | ------------------- | --------------------------------------------------------------------- |
| token              | string  | true     | -                   | The JSON Web Token returned from the Create Session call              |
| onSelect           | event   | false    | -                   | The function that gets called when a file is selected                 |
| onConnectionSelect | event   | false    | -                   | The function that gets called when a connection is selected           |
| trigger            | element | false    | -                   | The component that should trigger the File Picker modal on click      |
| title              | string  | false    | Apideck File Picker | Title shown in the modal                                              |
| subTitle           | string  | false    | Select a file       | Subtitle shown in the modal                                           |
| showAttribution    | boolean | false    | true                | Show "Powered by Apideck" in the backdrop of the modal backdrop       |
| open               | boolean | false    | false               | Opens the file picker if set to true                                  |
| onClose            | event   | false    | -                   | Function that gets called when the modal is closed                    |
| fileToSave         | file    | false    | -                   | Forces "Upload" mode to select the folder to upload the provided file |

### Using Tailwind?

The FilePicker is styled using [Tailwind CSS](https://tailwindcss.com/). If you were to use the File Picker component in a project that also uses Tailwind CSS, you can omit the CSS file import, and include the package in the purge path of the tailwind.config.css.

```js
// tailwind.config.js
purge: [
  './node_modules/@apideck/file-picker/dist/*.js',
],
```

---
_Source: https://npm.io/package/@apideck/file-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
