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

simple-smartphone-screen

v0.8.2

Published

Simple lightweight ReactJS component to mimic a common smartphone screen for anyone :)

Readme

Simple Smartphone Screen

I didn't like any options available for a lightweight ReactJS component to look like a smartphone Plan is to make it have optional callbacks dropped in for user input - easy component to use for chat bot apps

commands

  • npm run prep

Main props to pass into the SimpleSmartphoneComponent

/**
 * This component will render a smartphone looking container to display
 * the messages you pass into it. There is an option to have a picture
 * in the top center of the screen like on a normal phone, and functions for
 * typing/send message events.
 * Upcoming: Configurable styles for sent/received
 */
export default interface SmartphoneProps {
  /**
   * Pass in whatever function you want to execute when the user hits the "Send" button
   * @param userContent Whatever the user typed in prior to hitting send
   */
  onSend?: (userContent: string) => void;
  
  /**
   * Fires every time a user types something. Might be a bit much to do something
   * every time but I wanted to leave that up to you. In general, debounce
   * @param value
   */
  onTyping?: (value: string) => void;
  
  /**
   * Array of messages you pass in. You'll want to keep your messages in state
   * and feed them back into this component.
   */
  messages: Message[];
  
  /**
   * Optional argument to have someone's picture in the middle of the smartphone screen
   */
  mainImageUrl?: string;
}

The shape of the message interface:

/**
 * Shape we are expecting each message to be passed in as.
 * From and Media are optional. If from is not provided, it is assumed you want it
 * displayed as being sent from the person viewing the application.
 * If the "from" property is given, it is assumed that text message is being received by the user looking at the
 * rendered component. The media property refers to a picture in an MMS message or video in video message. Either way
 * we should only be pointing to a link of the hosted source material
 */
export default interface Message {
  /**
   * Who sent the message? If null, it is assumed that this was sent by the person looking at the component. Optional
   */
  from?: string;
  
  /**
   * If true, it will show who sent the message. Otherwise, just denote by color difference and orientation. Optional
   * NOT YET WORKING
   */
  shouldShowFromSignature?: boolean;
  
  /**
   * Link to publicly available media content of some kind. Optional
   */
  media?: string;
  
  /**
   * Text of what the message says
   */
  messageBody?: string;
}

Example of this component's usage in a React project

import SimpleSmartphoneComponent from 'simple-smartphone-screen';

const exampleMessages = [{
  media: 'This is an image link - it is optional',
  messageBody: 'This is a message body - it is required',
},{
  messageBody: 'This is a message without an image'
}];

const Component = () => {
    
    const [messages, setMessages] = useState(exampleMessages);
    
    const handleAddMessage = (value: string) => {
      setMessages((prev) => [...prev, { messageBody: value }]);
    }
    
    return (
        <SimpleSmartphoneComponent
            onSend={handleAddMessage}
            messages={messages}
            mainImageUrl={"https://www.beautifulperson.com"} 
        />
    );
};