@govuk-react/file-upload

File input component with label expected as children.

Stats

StarsIssuesVersionUpdatedCreatedSize
@govuk-react/file-upload
0.9.114 days ago4 years agoMinified + gzip package size for @govuk-react/file-upload in KB

Readme

FileUpload

Import

  import FileUpload from '@govuk-react/file-upload';

Usage

Simple

import { FileUpload } from 'govuk-react'

<FileUpload name="group0">Upload a document</FileUpload>

Input with hint text

<FileUpload
  name="group1"
  acceptedFormats=".jpg, .png"
  hint={['This can be in either JPG or PNG format']}
>
  Upload a photo
</FileUpload>

Input with hint text & error

const meta = {
  touched: true,
  error: 'Example',
};

<FileUpload
  name="group1"
  acceptedFormats=".jpg, .png"
  hint={['This can be in either JPG or PNG format']}
  meta={meta}
>
  Upload a photo
</FileUpload>

References:

Properties

Prop Required Default Type Description
acceptedFormats undefined string
children true `````` node
hint undefined string Optional hint text
meta {} shape[object Object] Final form meta object, pending adjustment/removal
name undefined string
onChange undefined func

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.