kibana/packages/shared-ux/file/file_picker/impl
Jean-Louis Leysens f1b0dd4720
[Files] Add meta prop to <FilePicker /> (#151417)
## Summary

Added the `meta` prop to the `FilePicker` component, also pass this down
to the `FileUpload` component so that files created via the picker can
have meta set.

Close https://github.com/elastic/kibana/issues/151375

## How to test

1. Start Kibana with examples `yarn start --run-examples`
2. Go to the "Developer examples" in the side-nav menu under analytics
3. Go to "Files example"
4. Upload a file via the "Select file" button, should present an empty
file picker if you have no files, otherwise use the little upload
component bottom left
5. Either select files or dismiss the modal
6. Inspect the uploaded file and see the `myCool: 'meta'` entry included
with other metadata

## Screenshot

A file uploaded via the `FilePicker` in the "Files example" plugin.

<img width="897" alt="Screenshot 2023-02-16 at 11 41 06"
src="https://user-images.githubusercontent.com/8155004/219342872-c39b5d81-7421-4187-bb1c-d6815d80a3dc.png">


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-02-16 04:58:48 -07:00
..
src [Files] Add meta prop to <FilePicker /> (#151417) 2023-02-16 04:58:48 -07:00
index.tsx
jest.config.js
kibana.jsonc [codeowners] rename global experience to @elastic/appex-sharedux 2023-01-18 10:02:49 -07:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.mdx
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

---
id: sharedUX/Components/FilePicker
slug: /shared-ux/components/file-picker
title: File picker
description: Pick or upload files from Kibana.
tags: ['shared-ux', 'component', 'files']
date: 2022-11-22
---

## Description

A component designed to capture the UX of picking files. Use cases include:

* A dashboard user wanting to upload an image to their dashboard
* A user picking a new avatar
* A cases user selecting from a set of text files they want to attach to a case
* ...and many more

## Usage

Must be wrapped in the `FilesContext`.

```tsx
<FilesContext ...>
  <FilePicker ... />
</FilesContext>
```