Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developit/preact-richtextarea

:newspaper: A text field that supports HTML editing. :memo:
https://github.com/developit/preact-richtextarea

Last synced: about 2 months ago
JSON representation

:newspaper: A text field that supports HTML editing. :memo:

Awesome Lists containing this project

README

        

# preact-richtextarea

[![NPM](http://img.shields.io/npm/v/preact-richtextarea.svg)](https://www.npmjs.com/package/preact-richtextarea)
[![travis-ci](https://travis-ci.org/developit/preact-richtextarea.svg)](https://travis-ci.org/developit/preact-richtextarea)

A `` that supports HTML editing, powered by [Preact] & contentEditable.

---

### Usage Example

Use `` like a normal ``. It supports the same props/attributes, including `value`, `onInput()` and `onChange()`.

```js
import RichTextArea from 'preact-richtextarea';

const HtmlEditor = ({ html, ...props }) => (

Body HTML:


);

let html = `

hello

Testing 1 2 3...

`;
render(, document.body);
```

### Usage with Linked State

`` works with Linked State exactly the same way as any other input field:

```js
import RichTextArea from 'preact-richtextarea';

class Form extends Component {
render({ }, { html }) {
return (



);
}
}

render(, document.body);
```

---

### License

[MIT]

[Preact]: https://github.com/developit/preact
[MIT]: http://choosealicense.com/licenses/mit/