# moroboxai-editor-react

> MoroboxAI editor for React

Latest version **0.1.1-alpha.11** (published 2023-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install moroboxai-editor-react
pnpm add moroboxai-editor-react
yarn add moroboxai-editor-react
bun add moroboxai-editor-react
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1-alpha.11 |
| Published | 2023-11-01 |
| First published | 2022-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 2.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | moroboxai |
| Maintainers | moroboxai |
| Keywords | moroboxai, editor, react |

## Links

- npm: https://www.npmjs.com/package/moroboxai-editor-react
- Repository: https://github.com/moroboxai/moroboxai-editor-react
- Homepage: https://github.com/moroboxai/moroboxai-editor-react#readme
- Issues: https://github.com/moroboxai/moroboxai-editor-react/issues
- npm.io page: https://npm.io/package/moroboxai-editor-react

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [moroboxai-editor-web](https://npm.io/package/moroboxai-editor-web.md) ^0.1.1-alpha.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.1-alpha.11 (latest) — 2023-11-01
- 0.1.1-alpha.10 — 2023-10-31
- 0.1.1-alpha.9 — 2023-10-20
- 0.1.1-alpha.8 — 2023-09-22
- 0.1.1-alpha.7 — 2023-09-22
- 0.1.1-alpha.5 — 2023-09-16
- 0.1.1-alpha.3 — 2022-06-23
- 0.1.1-alpha.2 — 2022-06-14
- 0.1.1-alpha.1 — 2022-06-10
- 0.1.0-alpha.1 — 2022-06-08

## README

# moroboxai-editor-react

[![NPM version](https://img.shields.io/npm/v/moroboxai-editor-react.svg)](https://www.npmjs.com/package/moroboxai-editor-react)
![Node.js CI](https://github.com/moroboxai/moroboxai-editor-react/workflows/Node.js%20CI/badge.svg)
[![gitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/moroboxai/moroboxai-editor-react/blob/master/LICENSE)
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/moroboxai/moroboxai-editor-react.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-editor-react/context:javascript)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/moroboxai/moroboxai-editor-react.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/moroboxai/moroboxai-editor-react/alerts)

Embeddable code editor for coding AIs for [MoroboxAI](https://github.com/moroboxai) in [React](https://reactjs.org/).

## Installation

Using npm:

```bash
npm install moroboxai-editor-react --save
```

Or:

```bash
git clone https://github.com/moroboxai/moroboxai-editor-react.git
cd moroboxai-editor-react
npm i
npm run build
```

## Usage

Setup a simple React app with:

```bash
npx create-react-app my-app --template typescript
```

Add `moroboxai-editor-react` as a dependency:

```bash
cd my-app
npm install moroboxai-editor-react --save
```

Replace `src/App.tsx` with:

```javascript
import './App.css';
import Editor from 'moroboxai-editor-react';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <Editor
          value={'function foo() {\n  console.log("foo");\n}\n'}
          width="500px"
          height="400px"/>
      </header>
    </div>
  );
}

export default App;
```

Build and start a local server to see the result:

```bash
npm run build
npm run start
```

## Playground

This package provides a minimal `React` app under the `playground` directory for playing with and testing the library.

You can run the playground locally on port 3000 with:

 ```bash
 git clone https://github.com/moroboxai/moroboxai-editor-react.git
 cd moroboxai-editor-react
 npm i
 cd playground
 npm i
 npm run dev
 ```

If you want to change something in the library, go to `moroboxai-editor-react/src/...`, the library will be automatically re-built and the playground will use the latest build

## Props

| Name   |      Type      |  Default |  Description |
|:----------|:-------------|:------|:------|
| language | string | javascript | Selected language |
| value | string || Initial content of the editor |
| width | string || Width of the `div` element |
| height | string || Height of the `div` element |
| className | string || Class name for the `div` container |
| onLoad | func | noop | **Signature: function(value: string) => void** <br/> Function called when the Load button is clicked |
| onUnload | func | noop | **Signature: function() => void** <br/> Function called when the Unload button is clicked |

## License

This content is released under the [MIT](http://opensource.org/licenses/MIT) License.

---
_Source: https://npm.io/package/moroboxai-editor-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
