1.0.14 • Published 6 years ago

react-plaintexteditable v1.0.14

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

react-plaintexteditable

React component for plain text contenteditable element. You can use it as textarea or text input replacement that automatically resize.

Install

npm install react-plaintexteditable

Usage

import React, { useState } from 'react'
import PlainTextEditable from 'react-plaintexteditable'

function MyComponent() {
    const [text, setText] = useState('Hello, World!')

    return <PlainTextEditable style={{caretColor: '#43c633'}} text={ text } onChange={ setText } />
}

Number only example

import React, { useState } from 'react'
import PlainTextEditable from 'react-plaintexteditable'

function NumberOnly() {
    const [text, setText] = useState('')

    const onChange = (val) => {
        setText(val.replace(/[^0-9]/g, '').replace(/^0+/, ''))
    }

    return <PlainTextEditable style={{caretColor: '#43c633'}} text={ text } onChange={ onChange } />
}
1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago