5.1.1 • Published 10 months ago

react-edit-text v5.1.1

Weekly downloads
710
License
MIT
Repository
github
Last release
10 months ago

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
editButtonContentnodeNoSets 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
rowsnumber | 'auto'No3Number of visible rows

Contributing

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

License

MIT © Brian Min

5.1.1

10 months ago

5.1.0

1 year ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.3.0

2 years ago

4.2.0

3 years ago

4.1.0

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago