1.0.14 • Published 5 years ago

react-plaintexteditable v1.0.14

Weekly downloads
2
License
ISC
Repository
github
Last release
5 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

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago