Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-files-preview

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-files-preview

[![Netlify Status](https://api.netlify.com/api/v1/badges/f1c6d960-e969-4396-bdaa-33e245a72bf6/deploy-status)](https://app.netlify.com/sites/react-file-view/deploys) [![codecov](https://codecov.io/github/musama619/react-file-view/branch/main/graph/bad

  • 1.0.21
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
471
increased by8.53%
Maintainers
1
Weekly downloads
 
Created
Source

Netlify Status codecov npm

react-files-preview

A file view component for react.

Installation

Step: 1

npm i react-files-preview

Step: 2

Install Tailwindcss

(skip this step if you have tailwindcss already installed)

Step: 3

Because react-files-preview uses Tailwindcss, you need to add "./node_modules/react-files-preview/**/*.{html,ts,js}" in tailwind.config.js file:

    /** @type {import('tailwindcss').Config} */
    export default {
      content: [
        .....
        + "./node_modules/react-files-preview/**/*.{html,ts,js}" 
      ],
      theme: {
        extend: {},
      },
      plugins: [],
    }

Usage

import { ReactFilesPreview } from 'react-files-preview'
function App() {
  return (
    <>
      <ReactFilesPreview files={[]} />
    </>
  )
}

export default App

View Demo

NameTypeDefaultDescription
filesFile[][]array of file objects
urlstringnullimage url
downloadFilebooleantrueenables file download
removeFilebooleantrueshows file remove icon on file hover
showFileSizebooleantrueshows file size under files
showSliderCountbooleantrueshows slides count under file slider
multiplebooleantrueaccepts one or more files
acceptstringcomma-separated lists of file types. See MIME Types
maxFileSizenumbermaximum allowed file size in bytes e.g. 1024 x 1024 x 5 == 5MB
maxFilesnumbermaximum files allowed to be added
widthstringbasis-11/12tailwind css flex-basis class https://tailwindcss.com/docs/flex-basis
heightstringtailwind css height class https://tailwindcss.com/docs/height
fileWidthstringw-44tailwind css width class https://tailwindcss.com/docs/width
fileHeightstringh-32tailwind css height class https://tailwindcss.com/docs/height
getFilefuncreturns all current files
onChangefuncreturns selected file(s)
onRemovefuncreturns the removed file
onErrorfuncreturns error message as string
onClickfuncreturns file on click

Keywords

FAQs

Package last updated on 16 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc