# @team-griffin/react-file-input

> ```sh npm i --save @team-griffin/react-file-input

Latest version **1.0.0** (published 2017-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @team-griffin/react-file-input
pnpm add @team-griffin/react-file-input
yarn add @team-griffin/react-file-input
bun add @team-griffin/react-file-input
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-04-14 |
| First published | 2017-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joshua Thornton |
| Maintainers | jshthornton |

## Links

- npm: https://www.npmjs.com/package/@team-griffin/react-file-input
- Repository: https://github.com/team-griffin/react-file-input
- Homepage: https://github.com/team-griffin/react-file-input#readme
- Issues: https://github.com/team-griffin/react-file-input/issues
- npm.io page: https://npm.io/package/@team-griffin/react-file-input

## Dependencies (3)

- [recompose](https://npm.io/package/recompose.md) ^0.23.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8
- [lodash.reduce](https://npm.io/package/lodash.reduce.md) ^4.6.0

## Recent versions

- 1.0.0 (latest) — 2017-04-14
- 0.0.3 — 2017-03-28
- 0.0.2 — 2017-03-28
- 0.0.1 — 2017-03-28

## README

# react-file-input

```sh
npm i --save @team-griffin/react-file-input

yarn add @team-griffin/react-file-input
```

This package allows you to design fancy file inputs, whilst not having an opinion on how you want to handle your forms or design.

## Usage

```jsx
import FileInput from '@team-griffin/react-file-input';

return (
  <FileInput
    id="a-unique-id-for-this-this-field"
    value={theListOfFilesNormallyStoredInReduxForm}
    button={(
      <button type="button">
        The button displayed
      </button>
    )}
    onChange={(e) => howToHandleTheChange}
  />
);
```

**Note:** It is recommended that in your application you wrap this component so that you are not having to constantly recode it. I would suggest also calling your component `FileInput` and then importing this component as `ReactFileInput`.

## Customization

By default the file input will automatically render the text and layout for you. But you are welcome to configure this as much as you desire.

On the `<FileInput/>` component there are 2 props `layout` and `text`. You can use these to augment how this component renders.

```jsx
const MyText = ({
  multiple,
  value,
}) => {
  return (
    <span>
      How ever you'd like to diplay your values.
    </span>
  );
};

const MyLayout = ({
  input,
  button,
  text,
  multiple,
  value,
}) => {
  return (
    <div>
      Your structure.
    </div>
  );
};

return (
  <FileInput
    button={<button>My Button</button>}
    layout={(<MyLayout/>)}
    text={(<MyText/>)}
  />
);

```

## API

### FileInput

All other props are passed through to the input.

| Prop     | Description                             | Type    | Default |
|----------|-----------------------------------------|---------|---------|
| id*      | Field Id                                | String  |         |
| value    | Array of values                         | Array   |         |
| multiple | To support multiple values              | Bool    | false   |
| button   | The button to render                    | Element |         |
| text     | The text to render                      | Element | Text    |
| layout   | The layout to render                    | Element | Layout  |
| onChange | The callback for when the input changes | Func    |         |

### Layout

The layout component is an internal component. But these are the props we pass to it or your custom one.

| Prop     | Description                | Type    | Default |
|----------|----------------------------|---------|---------|
| value    | Array of values            | Array   |         |
| multiple | To support multiple values | Bool    |         |
| input    | The input render           | Element |         |
| button   | The button to render       | Element |         |
| text     | The text to render         | Element |         |

### Text

The text component is an internal component. But these are the props we pass to it or your custom one.

| Prop     | Description                | Type  | Default |
|----------|----------------------------|-------|---------|
| value    | Array of values            | Array |         |
| multiple | To support multiple values | Bool  |         |

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