Wondering what’s next for npm?Check out our public roadmap! »

    react-edit-text
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/react-edit-text package

    4.0.3 • Public • Published

    React Edit Text

    travis npm

    This is an easy-to-use editable text component for React. Simply click on the textbox to edit!

    Made with ❤️ by Brian Min

    demo

    Demo

    Feel free to check out the live demo

    Install

    npm install react-edit-text --save

    Type definitions

    npm install @types/react-edit-text --save-dev

    Usage

    Make sure to import the CSS stylesheet before using the component.

    import React, { Component } from 'react';
    
    import { EditText, EditTextarea } from 'react-edit-text';
    import 'react-edit-text/dist/index.css';
    
    class Example extends Component {
      render() {
        return (
          <div>
            <EditText />
            <EditTextarea />
          </div>
        );
      }
    }

    Props

    Shared props

    Prop Type Required Default Description
    id string No HTML DOM id attribute
    name string No HTML input name attribute
    className string No HTML class attribute
    value string No Value of the component
    defaultValue string No Default value of the component
    placeholder string No '' Placeholder value
    onSave function No Callback function triggered when input is saved
    onChange function No Callback function triggered when input is changed
    style object No Sets CSS style of input and view component
    readonly bool No false Disables the input and only displays the view component

    EditText props

    Prop Type Required Default Description
    type string No 'text' HTML DOM input text type
    inline bool No false Sets inline display

    EditTextarea props

    Prop Type Required Default Description
    rows number No 3 Number of visible rows

    Contributing

    Contributions are very much appreciated and welcome. Please refer to the contributing guidelines for more details.

    License

    MIT © Brian Min

    Install

    npm i react-edit-text

    DownloadsWeekly Downloads

    585

    Version

    4.0.3

    License

    MIT

    Unpacked Size

    308 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar