Device Emulator Component

Installation:

Installation: npm install react-simple-device-emulator

Usage:

import { DeviceComponent } from "react-simple-device-emulator";

Configuration:

  • The <DeviceComponent> can accept any element beteen the opening and closing tab to display in the viewport, but the default stlying only accomodates iframes and images.

    <DeviceComponent> <iframe src="https://react.dev" height="100%" width="100%" title="Iframe Example" ></iframe> </DeviceComponent>
  • Options: "mobile", "tablet", "desktop"

    deviceType={"mobile"}
  • Sets device pixel width - Requires number.

    deviceWidth={400}
  • Sets device pixel height - Requires number.

    deviceHeight={600}
  • Used to set the scale for desktop - This keeps the device dimensions, but scales down the size.

    scaleDesktop={1}
  • Used to set the scale for tablet - This keeps the device dimensions, but scales down the size.

    scaleTablet={.6}
  • Used to set the scale for mobile - This keeps the device dimensions, but scales down the size.

    scaleMobile={.8}
  • Sets breakpoint - Used for responsive, set to your sites resonsive breakpoints.

    mobileBreakPoint={450}
  • Sets breakpoint - Used for responsive, set to your sites resonsive breakpoints.

    tabletBreakPoint={768}
  • Sets breakpoint - Used for responsive, set to your sites resonsive breakpoints.

    desktopBreakPoint={1024}

Device Emulator Component Example

Mobile

Desktop