npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

app-icon-preview-kit

v1.0.0

Published

React kit for previewing app icons inside iOS/Android device mockups — home, splash and loading states.

Readme

app-icon-preview-kit

Demo: https://pcordista.github.io/app-icon-preview-kit/


Installation

yarn add app-icon-preview-kit
# or
npm i app-icon-preview-kit

Peer dependencies: react >= 17, react-dom >= 17.

Quick start

import PreviewKit from 'app-icon-preview-kit';

export default function App() {
  return (
    <PreviewKit
      deviceSelected="BOTH"
      viewType="HOME"
      imageUrl="/my-icon.png"
      appName="MyApp"
      showUploadButton
      showCleanButton
    />
  );
}

You can also import the enums to avoid magic strings:

import PreviewKit, {
  PREVIEW_KIT_DEVICE_SELECTION,
  PREVIEW_KIT_VIEW_TYPE,
  PREVIEW_KIT_DEVICE_SIZE,
} from 'app-icon-preview-kit';

<PreviewKit
  deviceSelected={PREVIEW_KIT_DEVICE_SELECTION.BOTH}
  viewType={PREVIEW_KIT_VIEW_TYPE.HOME}
  deviceSize={PREVIEW_KIT_DEVICE_SIZE.MEDIUM}
/>

Props

deviceSelected (required)

Type: 'IOS' | 'ANDROID' | 'BOTH'

Which device(s) to render. 'BOTH' shows iOS and Android side by side (or stacked, depending on containerStyle.layout).

<PreviewKit deviceSelected="IOS" />

viewType

Type: 'HOME' | 'SPLASHSCREEN' | 'PREVIEW' — Default: 'HOME'

Which screen to render. Ignored when loading=true.

  • 'HOME' — home screen with the custom icon highlighted.
  • 'SPLASHSCREEN' — Expo-style splash (image centered on backgroundColor, device chrome overlaid).
  • 'PREVIEW' — render arbitrary content inside the device frame (see preview).
<PreviewKit deviceSelected="BOTH" viewType="SPLASHSCREEN" />

preview

Type: ReactNode | string

Content rendered when viewType='PREVIEW'. A string is loaded inside an <iframe> (uses referrerPolicy="no-referrer"; sites with X-Frame-Options: DENY or restrictive frame-ancestors will refuse to load — use a React node in that case). A ReactNode is rendered inline, filling the screen.

<PreviewKit deviceSelected="IOS" viewType="PREVIEW" preview="https://my-app.dev" />
<PreviewKit deviceSelected="ANDROID" viewType="PREVIEW" preview={<MyAppShell />} />

allowPreviewNavigation

Type: boolean — Default: false

When true, the user can scroll and interact with the preview content. Otherwise the preview is rendered as a passive view (pointer events disabled).

imageUrl

Type: string | null — Default: null

URL or data URL of the icon. Used as the home icon, splash logo, and loading logo.

appName

Type: string — Default: 'Your app'

Label shown under the custom icon in home mode.

deviceSize

Type: 'SMALL' | 'MEDIUM' | 'LARGE' — Default: 'MEDIUM'

Visual size of the rendered device frame(s). MEDIUM is the canonical size; SMALL is ~75% and LARGE is ~130%.

<PreviewKit deviceSelected="BOTH" deviceSize="LARGE" />

showUploadButton

Type: boolean — Default: false

Display the upload button above the mockup.

showCleanButton

Type: boolean — Default: false

Display the button that clears the current image.

canChangeDevice

Type: boolean — Default: true

Allow the user to switch device via UI.

loading

Type: boolean — Default: false

Renders the loading screen (device chrome + native spinner + optional logo). Overrides viewType.

  • iOS — classic activity indicator (8 radial bars with sequential fade).
  • Android — Material circular progress (rotating bi-colored arc).
<PreviewKit deviceSelected="BOTH" loading imageUrl="/logo.png" backgroundColor="#0a0a0a" />

backgroundColor

Type: string — Default: '#ffffff'

Background color of splash/loading screens. Accepts any CSS color (hex, rgb, rgba, transparent).

containerStyle

Type: ContainerStyle

Outer container customization:

| Field | Type | Default | Description | |-------------------|-------------------------------|----------------|-------------| | backgroundColor | string | '#ffffff' | Outer container background color. Any CSS color. | | padding | number \| string | 16 | number'16px'; also accepts CSS shorthand ('16px 24px'). | | layout | 'horizontal' \| 'vertical' | 'horizontal' | Device stacking direction when deviceSelected='BOTH'. | | fitDevices | boolean | false | Scale device frames to best fit the available container size (uses ResizeObserver). |

<PreviewKit
  deviceSelected="BOTH"
  containerStyle={{ backgroundColor: '#111', padding: 24, layout: 'vertical', fitDevices: true }}
/>

onImageChange

Type: (url: string | null) => void

Fired when the image is changed via upload or clear.

onDeviceChange

Type: (device: 'IOS' | 'ANDROID' | 'BOTH') => void

Fired when the user switches device via UI (requires canChangeDevice).


Scripts

| Command | Description | |------------------|-------------| | yarn dev | Run the playground at http://localhost:5173/ | | yarn build | Generate dist/ (ESM, CJS, index.d.ts). CSS is injected by the JS bundle at runtime. | | yarn typecheck | tsc --noEmit | | yarn preview | Preview the playground build |

License

MIT © Pedro Cordista