Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-edit-text

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-edit-text

Simple editable text component for React

  • 4.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6K
decreased by-9.76%
Maintainers
1
Weekly downloads
 
Created
Source

React Edit Text

Quality Gate Status travis npm 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

Please visit https://brianmin.com/react-edit-text/ for a live demo and various examples.

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 from 'react';

import { EditText, EditTextarea } from 'react-edit-text';
import 'react-edit-text/dist/index.css';

export default function Example() {
  return (
    <div>
      <EditText showEditButton />
      <EditTextarea />
    </div>
  );
}

Props

Shared props

PropTypeRequiredDefaultDescription
idstringNoHTML DOM id attribute
namestringNoHTML input name attribute
classNamestringNoHTML class attribute for the display component
inputClassNamestringNoHTML class attribute for the input component
valuestringNoValue of the component
defaultValuestringNoDefault value of the component
placeholderstringNo''Placeholder value
formatDisplayTextfunctionNo(x) => xCallback function applied on the value to display the formatted value
onSavefunctionNoCallback function triggered when input is saved
onChangefunctionNoCallback function triggered when input is changed
onEditModefunctionNoCallback function triggered when component is clicked
onBlurfunctionNoCallback function triggered when input is blurred
styleobjectNoSets CSS style of input and view component
readonlyboolNofalseDisables the input and only displays the view component

EditText props

PropTypeRequiredDefaultDescription
typestringNo'text'HTML DOM input text type
inlineboolNofalseSets inline display
showEditButtonboolNofalseDisplays an edit button that can be pressed to enable edit mode
editButtonContentnodeNoeditIconSets the content for the edit button. This can be any valid element
editButtonPropsobjectNo{}Sets the props passed to the edit button. This can be any valid DOM attribute

EditTextarea props

PropTypeRequiredDefaultDescription
rowsnumberNo3Number of visible rows

Contributing

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

License

MIT © Brian Min

Keywords

FAQs

Package last updated on 30 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc