Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

react-media-previewer

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-media-previewer

A media previewer component for React

Source
npmnpm
Version
1.3.9
Version published
Weekly downloads
137
7.87%
Maintainers
1
Weekly downloads
 
Created
Source

React Media Previewer

简体中文 | English

Purpose

react-media-previewer is to create a previewer that is compatible with viewing various media files by one click. It is a component built with React and Typescript. In order to preview media files such as image, video, audio and PDF, we made it.

Installation

npm install react-media-previewer

or

yarn add react-media-previewer

Usage

import { render } from "react-dom";
import PreviewModal from "react-media-previewer";

function App() {
  const [visible, setVisible] = useState(false);
  return (
    <div id="app">
      <button onClick={() => setVisible(true)}>open</button>
      <PreviewModal
        visible={visible}
        name="YOUR IMAGE NAME"
        setVisible={setVisible}
        url="YOUR IMAGE URL"
      />
    </div>
  );
}

render(<App />, document.getElementById("app"));

Preview Files

Live Demo

Try Demo on CodeSandbox

Props

PropertyTypeDescription
visiblebolleanwhether the previewer is visible or not
setVisiblefunctionfunction called to close the previewer when previewer is opened
urlstringmedia file url
namestringmedia file name

Roadmap

  • ✅ Image preview
    • ✅ Image rotate
    • Image scale
    • ✅ Multiple images preview
  • ✅ Audio and video preview
  • ✅ PDF preview
    • PDF pagination
  • ✅ Word preview
  • ✅ Excel preview
  • ✅ PPT preview
  • More features
    • Keyboard support
    • ...

License

MIT

Keywords

react

FAQs

Package last updated on 06 Jan 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