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

@robertfyffe/react-editable-textbox

v1.0.1

Published

React component for creating a contentEditable textbox.

Readme

react-content-editable

Build Status Coverage Status

react-content-editable is a simple, flexible contentEditable textbox built using React.js.

It is extremely simple to use and get started with.

What does it do?

react-content-editable provides a HTML element with editable text. Included is HTML sanitization with the ability to customize to suit your requirements. The editable text will be automatically formatted using paragraph and single line break tags.

Table of Contents

Installation

To install, you can use npm or yarn:

$ npm install @robertfyffe/react-editable-textbox
$ yarn add @robertfyffe/react-editable-textbox

API documentation

<EditableTextBox
  theme={
    {
      editor: {
        background: '#f8d7da',
        borderRadius: '5px',
        fontSize: '16px',
        margin: '0 0 15px',
        padding: '6px 0 6px 10px',
        textSpacing: '0 0 15px',
        height: '33px'
      },
      placeholder: {
        color: '#721c24',
        fontSize: '16px',
        padding: '6px 0 6px 10px'
      },
      entry: {
        border: '1px solid #f5c6cb',
        focusBorderColor: '#5C656F',
        borderRadius: '5px',
        color: '#721c24',
        fontSize: '16px',
        lineHeight: '21px',
        padding: '6px 0 6px 10px',
        textSpacing: '0 0 15px',
        height: '33px',
        zIndex: 10
      }
    }
    /* Object indicating theme override styles to be used.
      It has three keys, `editor`, `placeholder` and `entry`.
      The properties are fixed using this method of styling.
      If more precise styling is required use the styles prop. */
  }
  styles={
    {
      placeholder: {
        fontStyle: 'italic'
      },
      entry: {
        borderWidth: '4px',
        outline: 0
      }
    }
    /* Object indicating custom styles to be used.
      It has three keys, `editor`, `placeholder` and `entry`.
      All CSS properties can be passed. */
  }
  aria={
    {
      'aria-placeholder': 'Content Editable Textbox',
      'aria-labelledby': 'contentEditableLabel'
    }
    /* Aria attributes (optional). */
  }
  role={
    'textbox'
    /* String indicating the role of the textbox.
      This attribute is `textbox` by default. */
  }
  defaultText={
    'Default text...'
    /* String to set as the default text of the textbox. */
  }
  placeholder={
    'Placeholder text...'
    /* String to set as the placeholder text of the textbox. */
  }
  disabled={
    false
    /* Boolean describing if the textbox should be disabled. */
  }
  isGhost={
    false
    /* Boolean describing if the textbox should be loading with the ghost theme.
    This attribute is false by default. */
  }
  allowedTags={
    ['p']
    /* Array of allowed HTML tags for editor.
      This attribute is `['p']` by default. */
  }
  allowedAttributes={
    []
    /* Array of allowed HTML attributes for editor.
      All attributes disabled` by default. */
  }
  onFocus={
    resp => console.log('onFocus!', resp)
    /* Function that will be run when the editor gains focus. 
      An object will be returned with the following structure:
      { 
        charCount: 0,
        text: 'Resp text'
      }
    */
  }
  onBlur={
    resp => console.log('onBlur!', resp)
    /* Function that will be run when the editor looses focus.
      An object will be returned with the following structure:
      { 
        charCount: 0,
        text: 'Resp text'
      }
    */
  }
  onInput={
    resp => console.log('onInput!', resp)
    /* Function that will be run when text is inputted.
      An object will be returned with the following structure:
      { 
        charCount: 0,
        text: 'Resp text'
      }
    */
  }
/>

Advanced

The component is configured to handle the children prop. This is useful in scenarios where you want full control over the content of the textbox from the consuming component.

<EditableTextBox>{this.state.html}</EditableTextBox>

Examples

Here is a simple example of react-editable-textbox being used in an app:

import React from 'react';
import ReactDOM from 'react-dom';
import { EditableTextBox } from '@robertfyffe/react-content-editable';

const App = () => <EditableTextBox />;

const appElement = document.getElementById('example');
ReactDOM.render(<App />, appElement);

You can find more examples in the examples directory, which you can run in a local development server using npm run start or yarn run start.