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

react-whatsapp-editor

v0.3.0

Published

A plug-and-play WhatsApp-style rich text editor for React.

Readme

react-whatsapp-editor

NPM Version License React

🌟 Try the Live Interactive Demo Here! 🌟

A plug-and-play, enterprise-grade rich text editor for React that perfectly replicates WhatsApp's unique Markdown formatting rules. Built on top of Meta's powerful Lexical framework.

React WhatsApp Editor Demo

🚀 Why this editor?

Standard Markdown editors break when you try to apply WhatsApp's strict formatting rules (like disabling bolding inside code blocks or preventing multiline inline styles).

React WhatsApp Editor is engineered specifically for chat applications, CRM tools, and messaging clones. It provides a polished UI with built-in toolbar controls, smart markdown parsing, and zero configuration required.

✨ Features

  • WhatsApp Markdown Rules: Supports *bold*, _italic_, ~strikethrough~, `inline code`, and ```multiline code```.
  • Native Emoji Picker: Built-in, responsive emoji menu that automatically syncs with your light/dark theme.
  • Smart Toolbar: Context-aware formatting buttons that disable themselves when inside conflicting block elements.
  • Two-Way Binding: Safely load database strings into the editor without cursor jumping.
  • First-Class Dark Mode: Built-in light and dark themes.
  • Lexical Engine: Powered by the same robust text engine used by Meta.

📦 Installation

Install the package via your preferred package manager:

npm install react-whatsapp-editor
# or
yarn add react-whatsapp-editor
# or
pnpm add react-whatsapp-editor

⚠️ Important: You must import the compiled CSS file in your app for the editor and toolbar to render correctly!


💻 Quick Start

Here is a minimal example of how to use the editor in your React application:

import React, { useState } from 'react';
import { WhatsappEditor } from 'react-whatsapp-editor';

// 1. Import the default styles!
import 'react-whatsapp-editor/style.css'; 

export default function ChatApp() {
  const [message, setMessage] = useState('');

  return (
    <div style={{ maxWidth: '600px', margin: '0 auto', padding: '20px' }}>
      <WhatsappEditor 
        value={message}
        onChange={(newValue) => setMessage(newValue)}
        theme="light"
        placeholder="Type a message..."
      />
      
      <div style={{ marginTop: '20px' }}>
        <strong>Raw Output:</strong>
        <pre>{message}</pre>
      </div>
    </div>
  );
}

📖 Displaying Messages (The Viewer)

Don't write your own markdown parser! Use the built-in <WhatsappViewer /> component to securely and perfectly render the saved markdown back into your UI.

import { WhatsappViewer } from 'react-whatsapp-editor';

// Inside your chat bubble component:
<WhatsappViewer value="I am *bold* and _italic_" />

🛠 API Reference (Props)

| Prop | Type | Default | Description | | --- | --- | --- | --- | | value | string | "" | The raw Markdown string to populate the editor. | | onChange | (value: string) => void | undefined | Callback fired on every keystroke. Returns the formatted Markdown string. | | theme | 'light' | 'dark' | 'light' | Toggles the built-in UI color variables. | | placeholder | string | "" | Text to display when the editor is empty. | | className | string | "" | Optional CSS class to append to the root wrapper. |


📝 Supported Formatting

This editor strictly enforces modern WhatsApp syntax:

  • Bold: Wrap text in asterisks *like this*.
  • Italic: Wrap text in underscores _like this_.
  • Strikethrough: Wrap text in tildes ~like this~.
  • Inline Code: Wrap text in single backticks like this.
  • Multiline Code Block: Type three backticks ````` and start typing to create a shaded code block.
  • Emojis: Use the built-in toolbar smiley face to open the picker, or use your native OS emoji keyboard. Emojis are parsed and exported as standard Unicode characters.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📜 License

This project is MIT licensed.